Skip to content

Commit

Permalink
Version 8.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DKPlugins committed Apr 16, 2020
1 parent 147a578 commit 347c4fc
Show file tree
Hide file tree
Showing 13 changed files with 1,107 additions and 121 deletions.
518 changes: 464 additions & 54 deletions DKTools.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Author**: DK

**Version**: Public 8.2.0
**Version**: Public 8.3.0

**Description**: Library for RPG Maker MV. Contains many tools for developing.

Expand Down
188 changes: 177 additions & 11 deletions dev/DKTools.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/DKTools.js

Large diffs are not rendered by default.

186 changes: 176 additions & 10 deletions src/DKTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Title: DKTools
Author: DK (Denis Kuznetsov)
Site: https://dk-plugins.ru
E-mail: [email protected]
Version: 8.2.0
Version: 8.3.0
Release: 31.10.2019
First release: 13.01.2016
Supported languages: Russian, English
Expand All @@ -14,22 +14,22 @@ Supported languages: Russian, English
Автор: DK (Денис Кузнецов)
Сайт: https://dk-plugins.ru
E-mail: [email protected]
Версия: 8.2.0
Версия: 8.3.0
Релиз: 31.10.2019
Первый релиз: 13.01.2016
Поддерживаемые языки: Русский, Английский
*/

/*:
* @plugindesc v.8.2.0 Library for RPG Maker. Made with ♥ by DKPlugins
* @plugindesc v.8.3.0 Library for RPG Maker. Made with ♥ by DKPlugins
* @author DK (Denis Kuznetsov)
* @help
### Info about plugin ###
Title: DKTools
Author: DK (Denis Kuznetsov)
Site: https://dk-plugins.ru
Version: 8.2.0
Version: 8.3.0
Release: 31.10.2019
First release: 13.01.2016
Supported languages: Russian, English
Expand Down Expand Up @@ -288,7 +288,7 @@ E-mail: [email protected]
* @parent Functions
* @desc Preloading resources
* @type struct<PreloadManager>
* @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"}
* @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Loading: %1\"}"}
* @param Screenshots
* @parent Functions
Expand All @@ -299,15 +299,15 @@ E-mail: [email protected]
*/

/*:ru
* @plugindesc v.8.2.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins
* @plugindesc v.8.3.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins
* @author DK (Денис Кузнецов)
* @help
### Информация о плагине ###
Название: DKTools
Автор: DK (Денис Кузнецов)
Сайт: https://dk-plugins.ru
Версия: 8.2.0
Версия: 8.3.0
Релиз: 31.10.2019
Первый релиз: 13.01.2016
Поддерживаемые языки: Русский, Английский
Expand Down Expand Up @@ -588,7 +588,7 @@ E-mail: [email protected]
* @parent Functions
* @desc Предварительная загрузка ресурсов
* @type struct<PreloadManager>
* @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"}
* @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Загрузка: %1\"}"}
* @param Screenshots
* @text Скриншоты
Expand Down Expand Up @@ -818,7 +818,10 @@ E-mail: [email protected]
* @default false
* @param Scene Name
* @desc Name of scene which will be launched instead the title screen. Standard: Scene_Map
* @desc Name of scene which will be launched instead the title screen. Standard: Scene_Title
* @type combo
* @option Scene_Map
* @option Scene_Title
* @default Scene_Map
* @param Skip Saves
Expand All @@ -838,7 +841,10 @@ E-mail: [email protected]
* @param Scene Name
* @text Название сцены
* @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Map
* @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Title
* @type combo
* @option Scene_Map
* @option Scene_Title
* @default Scene_Map
* @param Skip Saves
Expand Down Expand Up @@ -911,6 +917,11 @@ E-mail: [email protected]
* @type struct<PreloadManagerImage>[]
* @default []
* @param Progress Bar
* @desc Preloading process display
* @type struct<PreloadManagerProgressBar>
* @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Loading: %1"}
*/

/*~struct~PreloadManager:ru
Expand Down Expand Up @@ -939,6 +950,12 @@ E-mail: [email protected]
* @type struct<PreloadManagerImage>[]
* @default []
* @param Progress Bar
* @text Прогресс
* @desc Отображение процесса предзагрузки
* @type struct<PreloadManagerProgressBar>
* @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Загрузка: %1"}
*/

/*~struct~PreloadManagerImage:
Expand Down Expand Up @@ -1012,6 +1029,155 @@ E-mail: [email protected]
*/

/*~struct~PreloadManagerProgressBar:
* @param Enabled
* @desc Enable visual display of preloading ?
* @type boolean
* @default false
* @param Background
* @desc Background picture
* @type file
* @dir img/system
* @param Progress Bar Width
* @desc Width of the progress bar
* @type combo
* @option Graphics.boxWidth * 1 / 4
* @option Graphics.boxWidth * 2 / 4
* @option Graphics.boxWidth * 3 / 4
* @default Graphics.boxWidth * 2 / 4
* @param Progress Bar Height
* @desc Height of the progress bar
* @type combo
* @option 36
* @option 42
* @option 48
* @default 48
* @param Progress Bar X
* @desc The X coordinate of the progress bar
* @type combo
* @option (Graphics.boxWidth - width) * 1 / 4
* @option (Graphics.boxWidth - width) * 2 / 4
* @option (Graphics.boxWidth - width) * 3 / 4
* @option (Graphics.boxWidth - width) * 1 / 5
* @option (Graphics.boxWidth - width) * 1 / 6
* @option (Graphics.boxWidth - width) * 4 / 5
* @option (Graphics.boxWidth - width) * 5 / 6
* @default (Graphics.boxWidth - width) * 2 / 4
* @param Progress Bar Y
* @desc The Y coordinate of the progress bar
* @type combo
* @option (Graphics.boxHeight - height) * 1 / 4
* @option (Graphics.boxHeight - height) * 2 / 4
* @option (Graphics.boxHeight - height) * 3 / 4
* @option (Graphics.boxHeight - height) * 1 / 5
* @option (Graphics.boxHeight - height) * 1 / 6
* @option (Graphics.boxHeight - height) * 4 / 5
* @option (Graphics.boxHeight - height) * 5 / 6
* @default (Graphics.boxHeight - height) * 2 / 4
* @param Progress Bar Background Color
* @desc Progress bar background color
* @type combo
* @option grey
* @default grey
* @param Progress Bar Progress Color
* @desc Progress bar progress color
* @type combo
* @option #33ccff
* @default #33ccff
* @param Progress Bar Text
* @desc Progress bar text. Use to substitute: %1 - url, %2 - loaded, %3 - total
* @default Loading: %1
*/

/*~struct~PreloadManagerProgressBar:ru
* @param Enabled
* @text Включено
* @desc Включить визуальное отображение загрузки ?
* @type boolean
* @default false
* @param Background
* @text Фоновое изображение
* @desc Фоновое изображение
* @type file
* @dir img/system
* @param Progress Bar Width
* @text Ширина прогресс бара
* @desc Ширина прогресс бара
* @type combo
* @option Graphics.boxWidth * 1 / 4
* @option Graphics.boxWidth * 2 / 4
* @option Graphics.boxWidth * 3 / 4
* @default Graphics.boxWidth * 2 / 4
* @param Progress Bar Height
* @text Высота прогресс бара
* @desc Высота прогресс бара
* @type combo
* @option 36
* @option 42
* @option 48
* @default 48
* @param Progress Bar X
* @text X прогресс бара
* @desc X прогресс бара
* @type combo
* @option (Graphics.boxWidth - width) * 1 / 4
* @option (Graphics.boxWidth - width) * 2 / 4
* @option (Graphics.boxWidth - width) * 3 / 4
* @option (Graphics.boxWidth - width) * 1 / 5
* @option (Graphics.boxWidth - width) * 1 / 6
* @option (Graphics.boxWidth - width) * 4 / 5
* @option (Graphics.boxWidth - width) * 5 / 6
* @default (Graphics.boxWidth - width) * 2 / 4
* @param Progress Bar Y
* @text Y прогресс бара
* @desc Y прогресс бара
* @type combo
* @option (Graphics.boxHeight - height) * 1 / 4
* @option (Graphics.boxHeight - height) * 2 / 4
* @option (Graphics.boxHeight - height) * 3 / 4
* @option (Graphics.boxHeight - height) * 1 / 5
* @option (Graphics.boxHeight - height) * 1 / 6
* @option (Graphics.boxHeight - height) * 4 / 5
* @option (Graphics.boxHeight - height) * 5 / 6
* @default (Graphics.boxHeight - height) * 2 / 4
* @param Progress Bar Background Color
* @text Фон прогресс бара
* @desc Фон прогресс бара в веб формате
* @type combo
* @option grey
* @default grey
* @param Progress Bar Progress Color
* @text Цвет прогресс бара
* @desc Цвет прогресс бара в веб формате
* @type combo
* @option #33ccff
* @default #33ccff
* @param Progress Bar Text
* @text Текст прогресс бара
* @desc Текст прогресс бара. Используйте, чтобы подставить: %1 - файл, %2 - загружено, %3 - всего
* @default Загрузка: %1
*/

/*~struct~Screenshots:
* @param Enabled
Expand Down
6 changes: 6 additions & 0 deletions src/DKTools/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ DKTools.Base = class {
/**
* Turns off the option
*
* @deprecated 8.3.0
* @version 2.0.0
*
* @param {String} option - Name of the option
Expand All @@ -715,6 +716,7 @@ DKTools.Base = class {
/**
* Turns off the options
*
* @deprecated 8.3.0
* @version 2.0.0
*
* @param {String[] | ...String} object - Names of the options
Expand Down Expand Up @@ -1671,6 +1673,7 @@ DKTools.Base = class {
/**
* Turns on the option
*
* @deprecated 8.3.0
* @version 2.0.0
*
* @param {String} option - Name of the option
Expand All @@ -1684,6 +1687,7 @@ DKTools.Base = class {
/**
* Turns on the options
*
* @deprecated 8.3.0
* @version 2.0.0
*
* @param {String[] | ...String} object - Names of the options
Expand Down Expand Up @@ -4131,6 +4135,7 @@ DKTools.Base = class {
/**
* Switches the option
*
* @deprecated 8.3.0
* @version 2.0.0
*
* @param {String} option - Name of the option
Expand All @@ -4144,6 +4149,7 @@ DKTools.Base = class {
/**
* Switches the options
*
* @deprecated 8.3.0
* @version 2.0.0
*
* @param {String[] | ...String} object - Names of the options
Expand Down
15 changes: 10 additions & 5 deletions src/DKTools/IO File.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity {
* DKTools.IO.ERROR_DECOMPRESSING_DATA
* DKTools.IO.ERROR_PARSING_DATA
*
* @version 8.0.0
* @version 8.3.0
*
* @param {Object} object - Options of an operation
*
Expand All @@ -332,6 +332,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity {
* @param {Function} [object.onError] - Callback function upon completion of an operation with error (only for object.sync == false)
* @param {Boolean} [object.decompress] - Use LZString.decompressFromBase64 for a data
* @param {Boolean | Object} [object.parse] - Use JSON.parse for a data
* @param {String} [object.mimeType] - Mime type (only for XMLHttpRequest)
*
* @param {String} [object.options.encoding] - Encoding
* @param {String} [object.options.flag] - File system flag
Expand Down Expand Up @@ -369,10 +370,6 @@ DKTools.IO.File = class extends DKTools.IO.Entity {
return { data: null, status: DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE };
}

if (!object.sync && !DKTools.Utils.isFunction(object.onSuccess)) {
return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE };
}

const absolutePath = this.getAbsolutePath();
const processData = (data) => {
if (data) {
Expand Down Expand Up @@ -413,6 +410,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity {
this.__processError(error, object.onError);
}
} else {
if (!DKTools.Utils.isFunction(object.onSuccess)) {
return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE };
}

fs.readFile(absolutePath, options, (error, data) => {
if (error) {
this.__processError(error, object.onError);
Expand All @@ -422,6 +423,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity {
});
}
} else {
if (!DKTools.Utils.isFunction(object.onSuccess)) {
return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE };
}

if (DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP && this.getFullName() !== 'Stamp.json' && !this.exists()) {
return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST };
}
Expand Down
2 changes: 1 addition & 1 deletion src/DKTools/Imported.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @type {Object}
*/
window.Imported = window.Imported || {};
window.Imported.DKTools = '8.2.0';
window.Imported.DKTools = '8.3.0';



Expand Down
Loading

0 comments on commit 347c4fc

Please sign in to comment.