-
DKTools.PreloadManager._finish
()
privatestatic
-
Finishes the preloading
- Version:
-
DKTools.PreloadManager._generateAudioKey
(path)String
privatestatic
-
Generates an audio key
Name |
Type |
Description |
path |
String
|
Path |
- Since:
Returns:
Type |
Description |
String
|
Generated key |
-
DKTools.PreloadManager._generateImageKey
(path, hue)String
privatestatic
-
Generates an image key
Name |
Type |
Default |
Description |
path |
String
|
|
Path |
hue |
Number
|
0
|
optional
Hue |
- Since:
Returns:
Type |
Description |
String
|
Generated key |
-
DKTools.PreloadManager._log
(message)
privatestatic
-
Logs the message in the console
Name |
Type |
Description |
message |
String
|
Message |
- Version:
-
DKTools.PreloadManager._onFileLoad
(data)
privatestatic
-
Processes the loading of the data
Name |
Type |
Description |
data |
WebAudio
|
Bitmap
|
Data |
- Version:
- Since:
-
DKTools.PreloadManager._preload
(type, object)
privatestatic
-
Adds the object to preload queue
Name |
Type |
Description |
type |
String
|
Type (audio or image) |
object |
Object
|
Object with parameters
Name |
Type |
Description |
path |
String
|
Path to file or directory |
hue |
Number
|
optional
Hue (only for images) |
caching |
Boolean
|
optional
Caching |
|
- Version:
- Since:
-
DKTools.PreloadManager._processAudioFile
(file, object)
privatestatic
-
- Version:
- Since:
-
DKTools.PreloadManager._processImageFile
(file, object)
privatestatic
-
- Since:
-
DKTools.PreloadManager._processLoadAudioFiles
()Array.<Promise>
privatestatic
-
Processes audio loading
- Version:
- Since:
Returns:
Type |
Description |
Array.<Promise>
|
Loaded audio files |
-
DKTools.PreloadManager._processLoadImageFiles
()Array.<Promise>
privatestatic
-
Processes image loading
- Version:
- Since:
Returns:
Type |
Description |
Array.<Promise>
|
Loaded image files |
-
DKTools.PreloadManager.canPreloadAudioFiles
()Boolean
static
-
Returns true if can preload audio files
- Since:
Returns:
Type |
Description |
Boolean
|
Can preload audio files |
-
DKTools.PreloadManager.canPreloadImageFiles
()Boolean
static
-
Returns true if Can preload image files
- Since:
Returns:
Type |
Description |
Boolean
|
Can preload image files |
-
DKTools.PreloadManager.clearCache
()
static
-
Clears the cache
- Version:
-
DKTools.PreloadManager.clearQueue
()
static
-
Clears the preload queue
- Version:
-
DKTools.PreloadManager.getCachedAudioByKey
(key)WebAudio | undefined
static
-
Returns a cached audio by key
Name |
Type |
Description |
key |
String
|
Key of the cached audio |
- Since:
Returns:
Type |
Description |
WebAudio
|
undefined
|
Cached audio by key |
-
DKTools.PreloadManager.getCachedAudioByPath
(path)WebAudio | undefined
static
-
Returns a cached audio by path
Name |
Type |
Description |
path |
String
|
Path of the cached audio |
- Since:
Returns:
Type |
Description |
WebAudio
|
undefined
|
Cached audio by path |
-
DKTools.PreloadManager.getCachedImageByKey
(key)Bitmap | undefined
static
-
Returns a cached image by key
Name |
Type |
Description |
key |
String
|
Key of the cached image |
- Since:
Returns:
Type |
Description |
Bitmap
|
undefined
|
Cached bitmap or null |
-
DKTools.PreloadManager.getCachedImageByPath
(path)Bitmap | undefined
static
-
Returns a cached image by path
Name |
Type |
Description |
path |
String
|
Path of the cached image |
- Since:
Returns:
Type |
Description |
Bitmap
|
undefined
|
Cached image or null |
-
DKTools.PreloadManager.getTotal
()Number
static
-
Returns the total amount of resources to preload
- Since:
Returns:
Type |
Description |
Number
|
Total amount of resources to preload |
-
DKTools.PreloadManager.initialize
()
static
-
Initializes preloading
- Version:
-
DKTools.PreloadManager.isAudioCachedByKey
(key)Boolean
static
-
Returns true if the audio by key is cached
Name |
Type |
Description |
key |
String
|
Key of the cached audio |
- Since:
Returns:
Type |
Description |
Boolean
|
Audio by key is cached |
-
DKTools.PreloadManager.isAudioCachedByPath
(path)Boolean
static
-
Returns true if the audio by path is cached
Name |
Type |
Description |
path |
String
|
Path of the cached audio |
- Since:
Returns:
Type |
Description |
Boolean
|
Audio by path is cached |
-
DKTools.PreloadManager.isFinished
()Boolean
static
-
Returns true if the preloading is finished
- Since:
Returns:
Type |
Description |
Boolean
|
Preloading is finished |
-
DKTools.PreloadManager.isImageCachedByKey
(key)Boolean
static
-
Returns true if the image by key is cached
Name |
Type |
Description |
key |
String
|
Key of the cached image |
- Since:
Returns:
Type |
Description |
Boolean
|
Image by key is cached |
-
DKTools.PreloadManager.isImageCachedByPath
(path, hue)Boolean
static
-
Returns true if the image by path is cached
Name |
Type |
Default |
Description |
path |
String
|
|
Path of the cached image |
hue |
Number
|
0
|
optional
Hue |
- Since:
Returns:
Type |
Description |
Boolean
|
Image by path is cached |
-
DKTools.PreloadManager.isReady
()Boolean
static
-
Returns true if the preload manager is ready
- Since:
Returns:
Type |
Description |
Boolean
|
Preload manager is ready |
-
DKTools.PreloadManager.isStarted
()Boolean
static
-
Returns true if the preloading is started
- Since:
Returns:
Type |
Description |
Boolean
|
Preloading is started |
-
DKTools.PreloadManager.onFileLoad
(callback)
static
-
Adds a callback function to handle file load
All callback functions will be cleared after the preload is finished
Callback function takes 1 argument - object with following properties:
file (WebAudio or Bitmap), loaded, total
Name |
Type |
Description |
callback |
function
|
Callback |
- Since:
Example
DKTools.PreloadManager.onFileLoad(() => {
Graphics.updateLoading();
});
-
DKTools.PreloadManager.onFinish
(callback)
static
-
Adds a callback function to handle finish of preloading
All callback functions will be cleared after the preload is finished
Callback function takes 1 argument - object with following properties:
loaded, skipped, preloadingTime (seconds), total
Name |
Type |
Description |
callback |
function
|
Callback |
- Since:
Example
DKTools.PreloadManager.onFinish(() => {
Graphics.endLoading();
});
-
DKTools.PreloadManager.preloadAudio
(object)
static
-
Adds the audio to preload queue
Name |
Type |
Description |
object |
Object
|
Object with parameters
Name |
Type |
Description |
path |
String
|
Path to file or directory (only for local mode) |
caching |
Boolean
|
optional
Caching |
|
- Version:
- Since:
Examples
// folder preloading
const path = 'audio/se/';
DKTools.PreloadManager.preloadAudio({
path: path,
caching: false
});
DKTools.PreloadManager.start();
// file preloading
// auto converts extension for mobile devices
const path = 'audio/se/Cancel1.ogg';
DKTools.PreloadManager.preloadAudio({
path: path,
caching: false
});
DKTools.PreloadManager.start();
-
DKTools.PreloadManager.preloadImage
(object)
static
-
Adds the image to preload queue
Name |
Type |
Description |
object |
Object
|
Object with parameters
Name |
Type |
Description |
path |
String
|
Path to file or directory (only for local mode) |
hue |
Number
|
optional
Hue |
caching |
Boolean
|
optional
Caching |
|
- Version:
- Since:
Examples
// folder preloading
const path = 'img/system/';
DKTools.PreloadManager.preloadImage({
path: path,
hue: 0,
caching: false
});
DKTools.PreloadManager.start();
// file preloading
const path = 'img/system/Window.png';
DKTools.PreloadManager.preloadImage({
path: path,
hue: 0,
caching: false
});
DKTools.PreloadManager.start();
-
DKTools.PreloadManager.releaseAudioByKey
(key)
static
-
Releases the audio by key from a cache
Name |
Type |
Description |
key |
String
|
Key of the cached audio |
- Since:
-
DKTools.PreloadManager.releaseAudioByPath
(path)
static
-
Releases the audio by path from a cache
Name |
Type |
Description |
path |
String
|
Path of the cached audio |
- Since:
-
DKTools.PreloadManager.releaseImageByKey
(key)
static
-
Releases the image by key from a cache
Name |
Type |
Description |
key |
String
|
Key of the cached image |
- Since:
-
DKTools.PreloadManager.releaseImageByPath
(path, hue)
static
-
Releases the image by path from a cache
Name |
Type |
Description |
path |
String
|
Path of the cached image |
hue |
Number
|
optional
Hue |
- Since:
-
DKTools.PreloadManager.setDebugging
(enabled)
static
-
Sets the output of debugging information to the console
Each finish resets debugging
Name |
Type |
Description |
enabled |
Boolean
|
Enable output |
- Since:
-
DKTools.PreloadManager.start
()Promise
static
-
Starts the preloading
Returns the promise
- Version:
Returns: