PIXI Controls: Opacity parameter
This commit is contained in:
parent
510a7c6387
commit
ec14489b9d
2 changed files with 20 additions and 9 deletions
|
@ -246,6 +246,7 @@ ONSControls.updateButtons = function() {
|
|||
buttons[3].y = -(buttonsSize / 2 + buttonsSize / 4);
|
||||
container.width = buttonsSize * 2;
|
||||
container.height = buttonsSize * 2;
|
||||
container.alpha = ConfigManager.ONSConfig.buttonsOpacity;
|
||||
container.position.set(ConfigManager.ONSConfig.buttonsX, ConfigManager.ONSConfig.buttonsY);
|
||||
|
||||
// Update DPAD
|
||||
|
@ -253,15 +254,18 @@ ONSControls.updateButtons = function() {
|
|||
const dpadContainer = this._dPadContainer;
|
||||
dpadContainer.width = dPadSize;
|
||||
dpadContainer.height = dPadSize;
|
||||
dpadContainer.alpha = ConfigManager.ONSConfig.buttonsOpacity;
|
||||
dpadContainer.position.set(ConfigManager.ONSConfig.dPadX, ConfigManager.ONSConfig.dPadY);
|
||||
|
||||
// Update LB/RB
|
||||
const LBsprite = this._LBsprite;
|
||||
const RBsprite = this._RBsprite;
|
||||
LBsprite.position.set(ConfigManager.ONSConfig.LBX, ConfigManager.ONSConfig.LBY);
|
||||
LBsprite.alpha = ConfigManager.ONSConfig.buttonsOpacity;
|
||||
LBsprite.width = ConfigManager.ONSConfig.bumpersWidth;
|
||||
LBsprite.height = ConfigManager.ONSConfig.bumpersHeight;
|
||||
RBsprite.position.set(ConfigManager.ONSConfig.RBX, ConfigManager.ONSConfig.RBY);
|
||||
RBsprite.alpha = ConfigManager.ONSConfig.buttonsOpacity;
|
||||
RBsprite.width = ConfigManager.ONSConfig.bumpersWidth;
|
||||
RBsprite.height = ConfigManager.ONSConfig.bumpersHeight;
|
||||
|
||||
|
@ -271,6 +275,7 @@ ONSControls.updateButtons = function() {
|
|||
showButton.position.set(ConfigManager.ONSConfig.showX, ConfigManager.ONSConfig.showY);
|
||||
showButton.width = ConfigManager.ONSConfig.additonalSize;
|
||||
showButton.height = ConfigManager.ONSConfig.additonalSize;
|
||||
showButton.alpha = ConfigManager.ONSConfig.buttonsOpacity;
|
||||
// switchButton.position.set(ConfigManager.ONSConfig.switchX, ConfigManager.ONSConfig.switchY);
|
||||
// switchButton.width = ConfigManager.ONSConfig.additonalSize;
|
||||
// switchButton.height = ConfigManager.ONSConfig.additonalSize;
|
||||
|
@ -389,6 +394,7 @@ ONSControls.configManager = function() {
|
|||
//=============================================================================
|
||||
ConfigManager.ONSConfig ||= {};
|
||||
ConfigManager.ONSConfig.buttonsScale ||= this.options.buttonsScale;
|
||||
ConfigManager.ONSConfig.buttonsOpacity ||= this.options.buttonsOpacity;
|
||||
ConfigManager.ONSConfig.controlsOffsetX ||= 32;
|
||||
ConfigManager.ONSConfig.controlsOffsetY ||= 16;
|
||||
ConfigManager.ONSConfig.buttonsSize ||= ONSControls._controlsCanvas.vh(0.18) * ConfigManager.ONSConfig.buttonsScale;
|
||||
|
@ -423,6 +429,7 @@ ConfigManager.restoreDefaultConfig = function () {
|
|||
base = path.join(base, 'save/');
|
||||
if (fs.existsSync(base + "config.rpgsave")) { fs.unlinkSync(base + "config.rpgsave"); }
|
||||
ConfigManager.ONSConfig.buttonsScale = this.options.buttonsScale;
|
||||
ConfigManager.ONSConfig.buttonsOpacity = this.options.buttonsOpacity;
|
||||
ConfigManager.ONSConfig.controlsOffsetX = 32;
|
||||
ConfigManager.ONSConfig.controlsOffsetY = 16;
|
||||
ConfigManager.ONSConfig.buttonsSize = ONSControls._controlsCanvas.vh(0.18) * ConfigManager.ONSConfig.buttonsScale;
|
||||
|
@ -454,6 +461,7 @@ ConfigManager.restoreDefaultConfig = function () {
|
|||
//=============================================================================
|
||||
ConfigManager.ONSConfig.updateData = function() {
|
||||
ConfigManager.ONSConfig.buttonsScale = ConfigManager.ONSConfig.buttonsScale;
|
||||
ConfigManager.ONSConfig.buttonsOpacity = ConfigManager.ONSConfig.buttonsOpacity;
|
||||
ConfigManager.ONSConfig.controlsOffsetX = ConfigManager.ONSConfig.controlsOffsetX;
|
||||
ConfigManager.ONSConfig.controlsOffsetY = ConfigManager.ONSConfig.controlsOffsetY;
|
||||
ConfigManager.ONSConfig.buttonsSize = ONSControls._controlsCanvas.vh(0.18) * ConfigManager.ONSConfig.buttonsScale;
|
||||
|
@ -494,6 +502,7 @@ ConfigManager.makeData = function () {
|
|||
config.ONSConfig.controlsOffsetX = this.ONSConfig.controlsOffsetX;
|
||||
config.ONSConfig.controlsOffsetY = this.ONSConfig.controlsOffsetY;
|
||||
config.ONSConfig.buttonsScale = this.ONSConfig.buttonsScale;
|
||||
config.ONSConfig.buttonsOpacity = this.ONSConfig.buttonsOpacity;
|
||||
config.ONSConfig.additionalOffset = this.ONSConfig.additionalOffset;
|
||||
config.ONSConfig.buttonsSize = this.ONSConfig.buttonsSize;
|
||||
config.ONSConfig.buttonsX = this.ONSConfig.buttonsX;
|
||||
|
@ -527,6 +536,7 @@ ConfigManager.applyData = function (config) {
|
|||
this.ONSConfig.controlsOffsetX = config.ONSConfig.controlsOffsetX;
|
||||
this.ONSConfig.controlsOffsetY = config.ONSConfig.controlsOffsetY;
|
||||
this.ONSConfig.buttonsScale = config.ONSConfig.buttonsScale;
|
||||
this.ONSConfig.buttonsOpacity = config.ONSConfig.buttonsOpacity;
|
||||
this.ONSConfig.additionalOffset = config.ONSConfig.additionalOffset;
|
||||
this.ONSConfig.buttonsSize = config.ONSConfig.buttonsSize;
|
||||
this.ONSConfig.buttonsX = config.ONSConfig.buttonsX;
|
||||
|
@ -642,9 +652,10 @@ Window_OmoMenuOptionsONSControls.prototype.makeOptionsList = function () {
|
|||
// Get Text
|
||||
//var text = LanguageManager.getPluginText('optionsMenu', 'audio');
|
||||
var text = {
|
||||
buttonsScale: {help: "Change scale of A/B/X/Y buttons.", text: "BUTTONS SCALE", persent: true},
|
||||
bumpersOffsetX: {help: "Change x coordinate offset of LB/RB.", text: "LB/RB X OFFSET", persent: false},
|
||||
bumpersOffsetY: {help: "Change y coordinate offset of LB/RB.", text: "LB/RB Y OFFSET", persent: false}
|
||||
buttonsScale: {help: "Change on-screen controls scale.", text: "CONTROLS SCALE", persent: true, maxValue: 500},
|
||||
buttonsOpacity: {help: "Change on-screen controls opacity.", text: "CONTROLS OPACITY", persent: true, maxValue: 100},
|
||||
bumpersOffsetX: {help: "Change x coordinate offset of LB/RB.", text: "LB/RB X OFFSET", persent: false, maxValue: 500},
|
||||
bumpersOffsetY: {help: "Change y coordinate offset of LB/RB.", text: "LB/RB Y OFFSET", persent: false, maxValue: 500}
|
||||
}
|
||||
// Get Config
|
||||
var config = ConfigManager;
|
||||
|
@ -660,9 +671,9 @@ Window_OmoMenuOptionsONSControls.prototype.makeOptionsList = function () {
|
|||
var data = text[name];
|
||||
// Add Option
|
||||
if (data.persent) {
|
||||
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name] * 100, helpText: data.help, persent: data.persent });
|
||||
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name] * 100, helpText: data.help, persent: data.persent, maxValue: data.maxValue });
|
||||
} else {
|
||||
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name], helpText: data.help, persent: data.persent });
|
||||
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name], helpText: data.help, persent: data.persent, maxValue: data.maxValue });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -704,7 +715,7 @@ Window_OmoMenuOptionsONSControls.prototype.cursorRight = function (wrap) {
|
|||
// Get Data
|
||||
if (data) {
|
||||
var rate = Input.isLongPressed('right') ? 5 : 5
|
||||
data.option = Math.min(data.option + rate, 500);
|
||||
data.option = Math.min(data.option + rate, data.maxValue);
|
||||
this.updateOptionBar(this.index(), data.option, data.persent);
|
||||
};
|
||||
};
|
||||
|
@ -731,7 +742,7 @@ Window_OmoMenuOptionsONSControls.prototype.updateOptionBar = function (index, op
|
|||
var data = this._optionsList[index];
|
||||
// Get Back and Front Sprite
|
||||
var front = this._optionSprites[(index * 2) + 1];
|
||||
front._frame.width = option / 5 * 4;
|
||||
front._frame.width = option / (data.maxValue / 100) * 4;
|
||||
front._refresh();
|
||||
// Get Itm Rect
|
||||
var rect = this.itemRect(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue