PIXI Controls: Round displayable values and remove non persent bars

This commit is contained in:
OleSTEEP 2024-02-20 23:14:26 +03:00
parent 8dc514f6cc
commit a29c9c9b24
2 changed files with 22 additions and 42 deletions

View file

@ -836,9 +836,9 @@ Window_OmoMenuOptionsONSControls.prototype.makeOptionsList = function () {
// Get Text
//var text = LanguageManager.getPluginText('optionsMenu', 'audio');
var text = {
buttonsScale: {help: "Change on-screen controls scale.", text: "CONTROLS SCALE", isBar: true, persent: true, minValue: 0, maxValue: 500},
buttonsOpacity: {help: "Change on-screen controls opacity.", text: "CONTROLS OPACITY", isBar: true, persent: true, minValue: 0, maxValue: 100},
safeArea: {help: "Change safe area size for on-screen controls.", text: "SAFE AREA", isBar: true, persent: true, minValue: 10, maxValue: 100},
buttonsScale: {help: "Change on-screen controls scale.", text: "CONTROLS SCALE", isBar: true, minValue: 0, maxValue: 500},
buttonsOpacity: {help: "Change on-screen controls opacity.", text: "CONTROLS OPACITY", isBar: true, minValue: 0, maxValue: 100},
safeArea: {help: "Change safe area size for on-screen controls.", text: "SAFE AREA", isBar: true, minValue: 10, maxValue: 100},
editMenu: {help: "Press Left or Right button on DPad, to open menu.", text: "OPEN EDIT MODE", isBar: false}
}
// Get Config
@ -855,11 +855,7 @@ Window_OmoMenuOptionsONSControls.prototype.makeOptionsList = function () {
var data = text[name];
// Add Option
if (data.isBar) {
if (data.persent) {
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name] * 100, helpText: data.help, isBar: data.isBar, persent: data.persent, minValue: data.minValue, maxValue: data.maxValue });
} else {
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name], helpText: data.help, isBar: data.isBar, persent: data.persent, minValue: data.minValue, maxValue: data.maxValue });
}
this._optionsList.push({ header: data.text + ':', config: name, option: ConfigManager.ONSConfig[name] * 100, helpText: data.help, isBar: data.isBar, minValue: data.minValue, maxValue: data.maxValue });
} else {
this._optionsList.push({ header: data.text, config: name, helpText: data.help, isBar: data.isBar});
}
@ -879,7 +875,7 @@ Window_OmoMenuOptionsONSControls.prototype.drawItem = function (index) {
this.contents.drawText(data.header, rect.x + 50, rect.y, rect.width, 24);
// Update option bar
if (data.isBar) {
this.updateOptionBar(index, data.option, data.persent);
this.updateOptionBar(index, data.option);
}
};
};
@ -907,7 +903,7 @@ Window_OmoMenuOptionsONSControls.prototype.cursorRight = function (wrap) {
var rate = Input.isLongPressed('right') ? 5 : 5
data.option = Math.min(data.option + rate, data.maxValue);
if (data.isBar) {
this.updateOptionBar(this.index(), data.option, data.persent);
this.updateOptionBar(this.index(), data.option);
} else {
ONSControls.openEditMode();
}
@ -926,7 +922,7 @@ Window_OmoMenuOptionsONSControls.prototype.cursorLeft = function (wrap) {
var rate = Input.isLongPressed('left') ? 5 : 5
data.option = Math.max(data.option - rate, data.minValue);
if (data.isBar) {
this.updateOptionBar(this.index(), data.option, data.persent);
this.updateOptionBar(this.index(), data.option);
} else {
ONSControls.openEditMode();
}
@ -935,7 +931,7 @@ Window_OmoMenuOptionsONSControls.prototype.cursorLeft = function (wrap) {
//=============================================================================
// * Update option bar
//=============================================================================
Window_OmoMenuOptionsONSControls.prototype.updateOptionBar = function (index, option, persent) {
Window_OmoMenuOptionsONSControls.prototype.updateOptionBar = function (index, option) {
// Get Data
var data = this._optionsList[index];
// Get Back and Front Sprite
@ -946,15 +942,9 @@ Window_OmoMenuOptionsONSControls.prototype.updateOptionBar = function (index, op
var rect = this.itemRect(index);
rect.x += 415; rect.y += 27; rect.width = 100; rect.height = 40;
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
if (persent) {
this.contents.drawText(option + '%', rect.x, rect.y, rect.width, rect.height, 'right');
// Set Option
ConfigManager.ONSConfig[data.config] = option / 100;
} else {
this.contents.drawText(Math.round(option) + 'px', rect.x, rect.y, rect.width, rect.height, 'right');
// Set Option
ConfigManager.ONSConfig[data.config] = option;
}
this.contents.drawText(Math.round(option) + '%', rect.x, rect.y, rect.width, rect.height, 'right');
// Set Option
ConfigManager.ONSConfig[data.config] = option / 100;
ConfigManager.ONSConfig.updateData();
};
//=============================================================================