-
DKTools.PreloadManager._finish
()
privatestatic
-
Finishes the preloading
-
DKTools.PreloadManager._generateKey
(path)String
privatestatic
-
Generates an audio key
Name |
Type |
Description |
path |
String
|
Path |
Returns:
Type |
Description |
String
|
Generated key |
-
DKTools.PreloadManager._log
(message)
privatestatic
-
Logs the message in the console
Name |
Type |
Description |
message |
String
|
Message |
-
DKTools.PreloadManager._onFileLoad
(data)
privatestatic
-
Processes the loading of the data
Name |
Type |
Description |
data |
WebAudio
|
Bitmap
|
Data |
- Version:
-
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 |
caching |
Boolean
|
optional
Caching |
|
- Version:
-
DKTools.PreloadManager._processAudioFile
(file, object)
privatestatic
-
- Version:
-
DKTools.PreloadManager._processImageFile
(file, object)
privatestatic
-
-
DKTools.PreloadManager._processLoadAudioFiles
()Array.<Promise>
privatestatic
-
Processes audio loading
Returns:
Type |
Description |
Array.<Promise>
|
Loaded audio files |
-
DKTools.PreloadManager._processLoadImageFiles
()Array.<Promise>
privatestatic
-
Processes image loading
Returns:
Type |
Description |
Array.<Promise>
|
Loaded image files |
-
DKTools.PreloadManager.clearCache
()
static
-
Clears the cache
-
DKTools.PreloadManager.clearQueue
()
static
-
Clears the preload queue
-
DKTools.PreloadManager.getCachedAudioByKey
(key)WebAudio | undefined
static
-
Returns a cached audio by key
Name |
Type |
Description |
key |
String
|
Key of the cached audio |
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 |
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 |
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 |
Returns:
Type |
Description |
Bitmap
|
undefined
|
Cached image or null |
-
DKTools.PreloadManager.getTotal
()Number
static
-
Returns the total amount of resources to preload
Returns:
Type |
Description |
Number
|
Total amount of resources to preload |
-
DKTools.PreloadManager.initialize
()
static
-
Initializes preloading
-
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 |
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 |
Returns:
Type |
Description |
Boolean
|
Audio by path is cached |
-
DKTools.PreloadManager.isFinished
()Boolean
static
-
Returns true if the preloading is finished
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 |
Returns:
Type |
Description |
Boolean
|
Image by key is cached |
-
DKTools.PreloadManager.isImageCachedByPath
(path)Boolean
static
-
Returns true if the image by path is cached
Name |
Type |
Description |
path |
String
|
Path of the cached image |
Returns:
Type |
Description |
Boolean
|
Image by path is cached |
-
DKTools.PreloadManager.isReady
()Boolean
static
-
Returns true if the preload manager is ready
Returns:
Type |
Description |
Boolean
|
Preload manager is ready |
-
DKTools.PreloadManager.isStarted
()Boolean
static
-
Returns true if the preloading is started
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 |
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 |
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 |
|
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) |
caching |
Boolean
|
optional
Caching |
|
Examples
// folder preloading
const path = 'img/system/';
DKTools.PreloadManager.preloadImage({
path: path,
caching: false
});
DKTools.PreloadManager.start();
// file preloading
const path = 'img/system/Window.png';
DKTools.PreloadManager.preloadImage({
path: path,
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 |
-
DKTools.PreloadManager.releaseAudioByPath
(path)
static
-
Releases the audio by path from a cache
Name |
Type |
Description |
path |
String
|
Path of the cached audio |
-
DKTools.PreloadManager.releaseImageByKey
(key)
static
-
Releases the image by key from a cache
Name |
Type |
Description |
key |
String
|
Key of the cached image |
-
DKTools.PreloadManager.releaseImageByPath
(path)
static
-
Releases the image by path from a cache
Name |
Type |
Description |
path |
String
|
Path of the cached image |
-
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 |
-
DKTools.PreloadManager.start
()Promise
static
-
Starts the preloading
Returns the promise
Returns: