From 510a7c6387a29047feb27d8f1bbf92e6e1be1604 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sun, 4 Feb 2024 11:44:01 +0300 Subject: [PATCH] PIXI Controls: Load config from startup --- www.rus/js/plugins/VND_ONSControls.js | 142 +++++++++++++------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/www.rus/js/plugins/VND_ONSControls.js b/www.rus/js/plugins/VND_ONSControls.js index 8618575..5be56dc 100644 --- a/www.rus/js/plugins/VND_ONSControls.js +++ b/www.rus/js/plugins/VND_ONSControls.js @@ -412,82 +412,12 @@ ConfigManager.ONSConfig.showY ||= ONSControls._controlsCanvas.screen.height - (C ConfigManager.ONSConfig.switchX ||= ConfigManager.ONSConfig.additonalSize / 2 + ConfigManager.ONSConfig.additionalOffset; ConfigManager.ONSConfig.switchY ||= ONSControls._controlsCanvas.screen.height - (ConfigManager.ONSConfig.additonalSize / 2 + ConfigManager.ONSConfig.additionalOffset); //============================================================================= -// * Original functions -//============================================================================= -var ConfigManager_makeData = ConfigManager.makeData; -var ConfigManager_applyData = ConfigManager.applyData; -var ConfigManager_restoreDefaultConfig = ConfigManager.restoreDefaultConfig; -//============================================================================= -// * Make Data -//============================================================================= -var _ConfigManager_makeData = ConfigManager.makeData; -ConfigManager.makeData = function () { - var config = _ConfigManager_makeData.apply(this, arguments); - config.ONSConfig = {}; - config.ONSConfig.controlsOffsetX = this.ONSConfig.controlsOffsetX; - config.ONSConfig.controlsOffsetY = this.ONSConfig.controlsOffsetY; - config.ONSConfig.buttonsScale = this.ONSConfig.buttonsScale; - config.ONSConfig.additionalOffset = this.ONSConfig.additionalOffset; - config.ONSConfig.buttonsSize = this.ONSConfig.buttonsSize; - config.ONSConfig.buttonsX = this.ONSConfig.buttonsX; - config.ONSConfig.buttonsY = this.ONSConfig.buttonsY; - config.ONSConfig.dPadSize = this.ONSConfig.dPadSize; - config.ONSConfig.dPadX = this.ONSConfig.dPadX; - config.ONSConfig.dPadY = this.ONSConfig.dPadY; - config.ONSConfig.bumpersWidth = this.ONSConfig.bumpersWidth; - config.ONSConfig.bumpersHeight = this.ONSConfig.bumpersHeight; - config.ONSConfig.bumpersOffsetX = this.ONSConfig.bumpersOffsetX; - config.ONSConfig.bumpersOffsetY = this.ONSConfig.bumpersOffsetY; - config.ONSConfig.LBX = this.ONSConfig.LBX; - config.ONSConfig.LBY = this.ONSConfig.LBY; - config.ONSConfig.RBX = this.ONSConfig.RBX; - config.ONSConfig.RBY = this.ONSConfig.RBY; - config.ONSConfig.additionalOffset = this.ONSConfig.additionalOffset; - config.ONSConfig.additonalSize = this.ONSConfig.additonalSize; - config.ONSConfig.showX = this.ONSConfig.showX; - config.ONSConfig.showY = this.ONSConfig.showY; - config.ONSConfig.switchX = this.ONSConfig.switchX; - config.ONSConfig.switchY = this.ONSConfig.switchY; - return config; -} -//============================================================================= -// * Apply Data -//============================================================================= -var _ConfigManager_applyData = ConfigManager.applyData; -ConfigManager.applyData = function (config) { - _ConfigManager_applyData.apply(this, arguments); - this.ONSConfig.controlsOffsetX = config.ONSConfig.controlsOffsetX; - this.ONSConfig.controlsOffsetY = config.ONSConfig.controlsOffsetY; - this.ONSConfig.buttonsScale = config.ONSConfig.buttonsScale; - this.ONSConfig.additionalOffset = config.ONSConfig.additionalOffset; - this.ONSConfig.buttonsSize = config.ONSConfig.buttonsSize; - this.ONSConfig.buttonsX = config.ONSConfig.buttonsX; - this.ONSConfig.buttonsY = config.ONSConfig.buttonsY; - this.ONSConfig.dPadSize = config.ONSConfig.dPadSize; - this.ONSConfig.dPadX = config.ONSConfig.dPadX; - this.ONSConfig.dPadY = config.ONSConfig.dPadY; - this.ONSConfig.bumpersWidth = config.ONSConfig.bumpersWidth; - this.ONSConfig.bumpersHeight = config.ONSConfig.bumpersHeight; - this.ONSConfig.bumpersOffsetX = config.ONSConfig.bumpersOffsetX; - this.ONSConfig.bumpersOffsetY = config.ONSConfig.bumpersOffsetY; - this.ONSConfig.LBX = config.ONSConfig.LBX; - this.ONSConfig.LBY = config.ONSConfig.LBY; - this.ONSConfig.RBX = config.ONSConfig.RBX; - this.ONSConfig.RBY = config.ONSConfig.RBY; - this.ONSConfig.additionalOffset = config.ONSConfig.additionalOffset; - this.ONSConfig.additonalSize = config.ONSConfig.additonalSize; - this.ONSConfig.showX = config.ONSConfig.showX; - this.ONSConfig.showY = config.ONSConfig.showY; - this.ONSConfig.switchX = config.ONSConfig.switchX; - this.ONSConfig.switchY = config.ONSConfig.switchY; -} -//============================================================================= // * Restore defaults //============================================================================= var _ConfigManager_restoreDefaultConfig = ConfigManager.restoreDefaultConfig; ConfigManager.restoreDefaultConfig = function () { _ConfigManager_restoreDefaultConfig.apply(this, arguments); - const fs = require("fs"); + const fs = require("fs");j const path = require('path'); var base = path.dirname(process.mainModule.filename); base = path.join(base, 'save/'); @@ -549,6 +479,76 @@ ConfigManager.ONSConfig.updateData = function() { ONSControls.updateButtons(); } } +//============================================================================= +// * Original functions +//============================================================================= +var ConfigManager_makeData = ConfigManager.makeData; +var ConfigManager_applyData = ConfigManager.applyData; +//============================================================================= +// * Make Data +//============================================================================= +var _ConfigManager_makeData = ConfigManager.makeData; +ConfigManager.makeData = function () { + var config = _ConfigManager_makeData.apply(this, arguments); + config.ONSConfig = {}; + config.ONSConfig.controlsOffsetX = this.ONSConfig.controlsOffsetX; + config.ONSConfig.controlsOffsetY = this.ONSConfig.controlsOffsetY; + config.ONSConfig.buttonsScale = this.ONSConfig.buttonsScale; + config.ONSConfig.additionalOffset = this.ONSConfig.additionalOffset; + config.ONSConfig.buttonsSize = this.ONSConfig.buttonsSize; + config.ONSConfig.buttonsX = this.ONSConfig.buttonsX; + config.ONSConfig.buttonsY = this.ONSConfig.buttonsY; + config.ONSConfig.dPadSize = this.ONSConfig.dPadSize; + config.ONSConfig.dPadX = this.ONSConfig.dPadX; + config.ONSConfig.dPadY = this.ONSConfig.dPadY; + config.ONSConfig.bumpersWidth = this.ONSConfig.bumpersWidth; + config.ONSConfig.bumpersHeight = this.ONSConfig.bumpersHeight; + config.ONSConfig.bumpersOffsetX = this.ONSConfig.bumpersOffsetX; + config.ONSConfig.bumpersOffsetY = this.ONSConfig.bumpersOffsetY; + config.ONSConfig.LBX = this.ONSConfig.LBX; + config.ONSConfig.LBY = this.ONSConfig.LBY; + config.ONSConfig.RBX = this.ONSConfig.RBX; + config.ONSConfig.RBY = this.ONSConfig.RBY; + config.ONSConfig.additionalOffset = this.ONSConfig.additionalOffset; + config.ONSConfig.additonalSize = this.ONSConfig.additonalSize; + config.ONSConfig.showX = this.ONSConfig.showX; + config.ONSConfig.showY = this.ONSConfig.showY; + config.ONSConfig.switchX = this.ONSConfig.switchX; + config.ONSConfig.switchY = this.ONSConfig.switchY; + return config; +} +//============================================================================= +// * Apply Data +//============================================================================= +var _ConfigManager_applyData = ConfigManager.applyData; +ConfigManager.applyData = function (config) { + _ConfigManager_applyData.apply(this, arguments); + this.ONSConfig = config.ONSConfig; + this.ONSConfig.controlsOffsetX = config.ONSConfig.controlsOffsetX; + this.ONSConfig.controlsOffsetY = config.ONSConfig.controlsOffsetY; + this.ONSConfig.buttonsScale = config.ONSConfig.buttonsScale; + this.ONSConfig.additionalOffset = config.ONSConfig.additionalOffset; + this.ONSConfig.buttonsSize = config.ONSConfig.buttonsSize; + this.ONSConfig.buttonsX = config.ONSConfig.buttonsX; + this.ONSConfig.buttonsY = config.ONSConfig.buttonsY; + this.ONSConfig.dPadSize = config.ONSConfig.dPadSize; + this.ONSConfig.dPadX = config.ONSConfig.dPadX; + this.ONSConfig.dPadY = config.ONSConfig.dPadY; + this.ONSConfig.bumpersWidth = config.ONSConfig.bumpersWidth; + this.ONSConfig.bumpersHeight = config.ONSConfig.bumpersHeight; + this.ONSConfig.bumpersOffsetX = config.ONSConfig.bumpersOffsetX; + this.ONSConfig.bumpersOffsetY = config.ONSConfig.bumpersOffsetY; + this.ONSConfig.LBX = config.ONSConfig.LBX; + this.ONSConfig.LBY = config.ONSConfig.LBY; + this.ONSConfig.RBX = config.ONSConfig.RBX; + this.ONSConfig.RBY = config.ONSConfig.RBY; + this.ONSConfig.additionalOffset = config.ONSConfig.additionalOffset; + this.ONSConfig.additonalSize = config.ONSConfig.additonalSize; + this.ONSConfig.showX = config.ONSConfig.showX; + this.ONSConfig.showY = config.ONSConfig.showY; + this.ONSConfig.switchX = config.ONSConfig.switchX; + this.ONSConfig.switchY = config.ONSConfig.switchY; +}