Move all engine changes into plugin

This commit is contained in:
OleSTEEP 2024-02-06 23:56:10 +03:00
parent 040a56c09f
commit c39ec970f1
10 changed files with 452 additions and 74 deletions

View file

@ -76,10 +76,9 @@ DataManager.loadDatabase = function () {
}
};
window._dfs = require("fs");
DataManager.loadDataFile = function (name, src) {
var xhr = new XMLHttpRequest();
var url = _dfs.cachedAlternativeName('data/' + src);
var url = 'data/' + src;
xhr.open('GET', url);
xhr.overrideMimeType('application/json');
xhr.onload = function () {
@ -863,7 +862,7 @@ ImageManager.loadTitle2 = function (filename, hue) {
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
if (filename) {
var path = folder + filename + '.png';
var path = folder + encodeURIComponent(filename) + '.png';
var bitmap = this.loadNormalBitmap(path, hue || 0);
bitmap.smooth = smooth;
return bitmap;
@ -887,7 +886,7 @@ ImageManager.loadNormalBitmap = function (path, hue) {
var key = this._generateCacheKey(path, hue);
var bitmap = this._imageCache.get(key);
if (!bitmap) {
bitmap = Bitmap.load(decodeURIComponent(replaceSpecialSymbols(path)));
bitmap = Bitmap.load(decodeURIComponent(path));
bitmap.addLoadListener(function () {
bitmap.rotateHue(hue);
});
@ -1877,7 +1876,7 @@ SceneManager.initInput = function () {
SceneManager.initNwjs = function () {
if (Utils.isNwjs()) {
var gui = require('nw.gui');
var win = gui.window;
var win = gui.Window.get();
if (process.platform === 'darwin' && !win.menu) {
var menubar = new gui.Menu({ type: 'menubar' });
var option = { hideEdit: true, hideWindow: true };
@ -1941,7 +1940,7 @@ SceneManager.onKeyDown = function (event) {
break;
case 119: // F8
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
require('nw.gui').window.showDevTools();
require('nw.gui').Window.get().showDevTools();
}
break;
}