Add option to not show level up stats
parent
7e5615c1bb
commit
4f91c47168
|
@ -71,6 +71,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
public bgmVolume: number = 1;
|
public bgmVolume: number = 1;
|
||||||
public seVolume: number = 1;
|
public seVolume: number = 1;
|
||||||
public gameSpeed: integer = 1;
|
public gameSpeed: integer = 1;
|
||||||
|
public showLevelUpStats: boolean = true;
|
||||||
public quickStart: boolean = quickStart;
|
public quickStart: boolean = quickStart;
|
||||||
public finalWave: integer = 200;
|
public finalWave: integer = 200;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ export enum Setting {
|
||||||
Game_Speed = "GAME_SPEED",
|
Game_Speed = "GAME_SPEED",
|
||||||
Master_Volume = "MASTER_VOLUME",
|
Master_Volume = "MASTER_VOLUME",
|
||||||
BGM_Volume = "BGM_VOLUME",
|
BGM_Volume = "BGM_VOLUME",
|
||||||
SE_Volume = "SE_VOLUME"
|
SE_Volume = "SE_VOLUME",
|
||||||
|
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS"
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SettingOptions {
|
export interface SettingOptions {
|
||||||
|
@ -19,14 +20,16 @@ export const settingOptions: SettingOptions = {
|
||||||
[Setting.Game_Speed]: [ '1x', '1.25x', '1.5x', '2x', '2.5x', '3x', '4x', '5x' ],
|
[Setting.Game_Speed]: [ '1x', '1.25x', '1.5x', '2x', '2.5x', '3x', '4x', '5x' ],
|
||||||
[Setting.Master_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
[Setting.Master_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||||
[Setting.BGM_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
[Setting.BGM_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||||
[Setting.SE_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute')
|
[Setting.SE_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||||
|
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const settingDefaults: SettingDefaults = {
|
export const settingDefaults: SettingDefaults = {
|
||||||
[Setting.Game_Speed]: 0,
|
[Setting.Game_Speed]: 0,
|
||||||
[Setting.Master_Volume]: 5,
|
[Setting.Master_Volume]: 5,
|
||||||
[Setting.BGM_Volume]: 10,
|
[Setting.BGM_Volume]: 10,
|
||||||
[Setting.SE_Volume]: 10
|
[Setting.SE_Volume]: 10,
|
||||||
|
[Setting.Show_Stats_on_Level_Up]: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setSetting(scene: BattleScene, setting: Setting, value: integer): boolean {
|
export function setSetting(scene: BattleScene, setting: Setting, value: integer): boolean {
|
||||||
|
@ -46,6 +49,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
||||||
scene.seVolume = value ? parseInt(settingOptions[setting][value]) * 0.01 : 0;
|
scene.seVolume = value ? parseInt(settingOptions[setting][value]) * 0.01 : 0;
|
||||||
scene.updateSoundVolume();
|
scene.updateSoundVolume();
|
||||||
break;
|
break;
|
||||||
|
case Setting.Show_Stats_on_Level_Up:
|
||||||
|
scene.showLevelUpStats = settingOptions[setting][value] === 'On';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -131,6 +131,8 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
promptLevelUpStats(partyMemberIndex: integer, prevStats: integer[], showTotals: boolean, callback?: Function): void {
|
promptLevelUpStats(partyMemberIndex: integer, prevStats: integer[], showTotals: boolean, callback?: Function): void {
|
||||||
|
if (!this.scene.showLevelUpStats)
|
||||||
|
return callback();
|
||||||
const newStats = (this.scene as BattleScene).getParty()[partyMemberIndex].stats;
|
const newStats = (this.scene as BattleScene).getParty()[partyMemberIndex].stats;
|
||||||
let levelUpStatsValuesText = '';
|
let levelUpStatsValuesText = '';
|
||||||
const stats = Utils.getEnumValues(Stat);
|
const stats = Utils.getEnumValues(Stat);
|
||||||
|
|
|
@ -39,13 +39,14 @@ export default class SettingsUiHandler extends UiHandler {
|
||||||
|
|
||||||
this.optionsContainer = this.scene.add.container(0, 0);
|
this.optionsContainer = this.scene.add.container(0, 0);
|
||||||
|
|
||||||
|
const settingLabels = [];
|
||||||
this.optionValueLabels = [];
|
this.optionValueLabels = [];
|
||||||
|
|
||||||
Object.keys(Setting).forEach((setting, s) => {
|
Object.keys(Setting).forEach((setting, s) => {
|
||||||
const settingLabel = addTextObject(this.scene, 8, 28 + s * 16, setting.replace(/\_/g, ' '), TextStyle.SETTINGS_LABEL);
|
settingLabels[s] = addTextObject(this.scene, 8, 28 + s * 16, setting.replace(/\_/g, ' '), TextStyle.SETTINGS_LABEL);
|
||||||
settingLabel.setOrigin(0, 0);
|
settingLabels[s].setOrigin(0, 0);
|
||||||
|
|
||||||
this.optionsContainer.add(settingLabel);
|
this.optionsContainer.add(settingLabels[s]);
|
||||||
|
|
||||||
this.optionValueLabels.push(settingOptions[Setting[setting]].map((option, o) => {
|
this.optionValueLabels.push(settingOptions[Setting[setting]].map((option, o) => {
|
||||||
const valueLabel = addTextObject(this.scene, 0, 0, option, settingDefaults[Setting[setting]] === o ? TextStyle.SETTINGS_SELECTED : TextStyle.WINDOW);
|
const valueLabel = addTextObject(this.scene, 0, 0, option, settingDefaults[Setting[setting]] === o ? TextStyle.SETTINGS_SELECTED : TextStyle.WINDOW);
|
||||||
|
@ -58,13 +59,15 @@ export default class SettingsUiHandler extends UiHandler {
|
||||||
|
|
||||||
const totalWidth = this.optionValueLabels[s].map(o => o.width).reduce((total, width) => total += width, 0);
|
const totalWidth = this.optionValueLabels[s].map(o => o.width).reduce((total, width) => total += width, 0);
|
||||||
|
|
||||||
const totalSpace = 220 - totalWidth / 6;
|
const labelWidth = Math.max(78, settingLabels[s].displayWidth + 8);
|
||||||
|
|
||||||
|
const totalSpace = (300 - labelWidth) - totalWidth / 6;
|
||||||
const optionSpacing = Math.floor(totalSpace / (this.optionValueLabels[s].length - 1));
|
const optionSpacing = Math.floor(totalSpace / (this.optionValueLabels[s].length - 1));
|
||||||
|
|
||||||
let xOffset = 0;
|
let xOffset = 0;
|
||||||
|
|
||||||
for (let value of this.optionValueLabels[s]) {
|
for (let value of this.optionValueLabels[s]) {
|
||||||
value.setPositionRelative(settingLabel, 82 + xOffset, 0);
|
value.setPositionRelative(settingLabels[s], labelWidth + xOffset, 0);
|
||||||
xOffset += value.width / 6 + optionSpacing;
|
xOffset += value.width / 6 + optionSpacing;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue