Fix game speed (#2375)

This commit is contained in:
Alexis Faizeau 2024-06-18 16:07:36 +02:00 committed by GitHub
parent 38b1a7fc61
commit 9b325a6689
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -190,12 +190,12 @@ export class UiInputs {
buttonSpeedChange(up = true): void {
const settingGameSpeed = settingIndex(SettingKeys.Game_Speed);
if (up && this.scene.gameSpeed < 5) {
this.scene.gameData.saveSetting(SettingKeys.Game_Speed, Setting[settingGameSpeed].options.findIndex((item) => item.value === `${this.scene.gameSpeed}x`) + 1);
this.scene.gameData.saveSetting(SettingKeys.Game_Speed, Setting[settingGameSpeed].options.findIndex((item) => item.label === `${this.scene.gameSpeed}x`) + 1);
if (this.scene.ui?.getMode() === Mode.SETTINGS) {
(this.scene.ui.getHandler() as SettingsUiHandler).show([]);
}
} else if (!up && this.scene.gameSpeed > 1) {
this.scene.gameData.saveSetting(SettingKeys.Game_Speed, Math.max(Setting[settingGameSpeed].options.findIndex((item) => item.value === `${this.scene.gameSpeed}x`) - 1, 0));
this.scene.gameData.saveSetting(SettingKeys.Game_Speed, Math.max(Setting[settingGameSpeed].options.findIndex((item) => item.label === `${this.scene.gameSpeed}x`) - 1, 0));
if (this.scene.ui?.getMode() === Mode.SETTINGS) {
(this.scene.ui.getHandler() as SettingsUiHandler).show([]);
}