[Enhancement][QoL] Add option to adjust shop overlay opacity (#2622)

* add option to adjust shop overlay opacity

* add localization

* fix bug

* Update src/locales/fr/settings.ts

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>

* Update src/locales/zh_CN/settings.ts

Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com>

* Update src/locales/fr/settings.ts

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>

* update default value

* update setting values

* re-add value 10

* Update src/locales/pt_BR/settings.ts

Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br>

* Update src/locales/ko/settings.ts

Co-authored-by: Enoch <enoch.jwsong@gmail.com>

* Update src/locales/es/settings.ts

Co-authored-by: InnocentGameDev <asdargmng@gmail.com>

* Update settings.ts

---------

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>
Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com>
Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br>
Co-authored-by: Enoch <enoch.jwsong@gmail.com>
Co-authored-by: InnocentGameDev <asdargmng@gmail.com>
Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
This commit is contained in:
Adrian T 2024-07-11 23:54:37 +08:00 committed by GitHub
parent dd361c5615
commit e879b3c6a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 47 additions and 7 deletions

View File

@ -224,6 +224,9 @@ export default class BattleScene extends SceneBase {
private fieldOverlay: Phaser.GameObjects.Rectangle;
private shopOverlay: Phaser.GameObjects.Rectangle;
private shopOverlayShown: boolean = false;
private shopOverlayOpacity: number = .80;
public modifiers: PersistentModifier[];
private enemyModifiers: PersistentModifier[];
public uiContainer: Phaser.GameObjects.Container;
@ -1428,19 +1431,29 @@ export default class BattleScene extends SceneBase {
});
}
updateShopOverlayOpacity(value: number): void {
this.shopOverlayOpacity = value;
if (this.shopOverlayShown) {
this.shopOverlay.setAlpha(this.shopOverlayOpacity);
}
}
showShopOverlay(duration: integer): Promise<void> {
this.shopOverlayShown = true;
return new Promise(resolve => {
this.tweens.add({
targets: this.shopOverlay,
alpha: 0.8,
alpha: this.shopOverlayOpacity,
ease: "Sine.easeOut",
duration: duration,
duration,
onComplete: () => resolve()
});
});
}
hideShopOverlay(duration: integer): Promise<void> {
this.shopOverlayShown = false;
return new Promise(resolve => {
this.tweens.add({
targets: this.shopOverlay,

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "Controller",
"gamepadSupport": "Controllerunterstützung",
"showBgmBar": "Musiknamen anzeigen",
"shopOverlayOpacity": "Shop Overlay Opacity"
} as const;

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "Controller",
"gamepadSupport": "Gamepad Support",
"showBgmBar": "Show Music Names",
"shopOverlayOpacity": "Shop Overlay Opacity"
} as const;

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "Controller",
"gamepadSupport": "Gamepad Support",
"showBgmBar": "Show Music Names",
"shopOverlayOpacity": "Opacidad de la fase de compra"
} as const;

View File

@ -95,5 +95,6 @@ export const settings: SimpleTranslationEntries = {
"mute": "Muet",
"controller": "Controller",
"gamepadSupport": "Gamepad Support",
"showBgmBar": "Montrer titre de la musique",
"showBgmBar": "Titre de la musique",
"shopOverlayOpacity": "Opacité boutique"
} as const;

View File

@ -3,7 +3,7 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales.js";
export const settings: SimpleTranslationEntries = {
"boy": "Ragazzo",
"girl": "Ragazza",
"general": "General",
"general": "Generale",
"display": "Display",
"audio": "Audio",
"gamepad": "Gamepad",
@ -94,6 +94,7 @@ export const settings: SimpleTranslationEntries = {
"alt": " (Alt)",
"mute": "Mute",
"controller": "Controller",
"gamepadSupport": "Gamepad Support",
"showBgmBar": "Show Music Names",
"gamepadSupport": "Supporto Gamepad",
"showBgmBar": "Mostra Nomi Musica",
"shopOverlayOpacity": "Opacità Finestra Negozio"
} as const;

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "컨트롤러",
"gamepadSupport": "게임패드 지원",
"showBgmBar": "BGM 제목 보여주기",
"shopOverlayOpacity": "상점 오버레이 투명도"
} as const;

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "Controle",
"gamepadSupport": "Suporte para Controle",
"showBgmBar": "Show Music Names",
"shopOverlayOpacity": "Opacidade da Loja"
} as const;

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "控制器",
"gamepadSupport": "手柄支持",
"showBgmBar": "显示音乐名称",
"shopOverlayOpacity": "商店显示不透明度"
} as const;

View File

@ -96,4 +96,5 @@ export const settings: SimpleTranslationEntries = {
"controller": "控制器",
"gamepadSupport": "手柄支持",
"showBgmBar": "Show Music Names",
"shopOverlayOpacity": "Shop Overlay Opacity"
} as const;

View File

@ -16,6 +16,13 @@ const VOLUME_OPTIONS: SettingOption[] = new Array(11).fill(null).map((_, i) => i
value: "Mute",
label: i18next.t("settings:mute")
});
const SHOP_OVERLAY_OPACITY_OPTIONS: SettingOption[] = new Array(9).fill(null).map((_, i) => {
const value = ((i + 1) * 10).toString();
return {
value,
label: value,
};
});
const OFF_ON: SettingOption[] = [
{
value: "Off",
@ -98,6 +105,7 @@ export const SettingKeys = {
SE_Volume: "SE_VOLUME",
Music_Preference: "MUSIC_PREFERENCE",
Show_BGM_Bar: "SHOW_BGM_BAR",
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY"
};
/**
@ -534,7 +542,14 @@ export const Setting: Array<Setting> = [
type: SettingType.AUDIO,
requireReload: true
},
{
key: SettingKeys.Shop_Overlay_Opacity,
label: i18next.t("settings:shopOverlayOpacity"),
options: SHOP_OVERLAY_OPACITY_OPTIONS,
default: 7,
type: SettingType.DISPLAY,
requireReload: false
},
];
/**
@ -759,6 +774,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
}
}
break;
case SettingKeys.Shop_Overlay_Opacity:
scene.updateShopOverlayOpacity(parseInt(Setting[index].options[value].value) * .01);
break;
}
return true;