Add option to toggle generation tooltip

This commit is contained in:
EmberCM 2024-06-26 21:41:29 -05:00
parent 5e51a9e8cb
commit 414b2366fc
13 changed files with 55 additions and 1 deletions

View File

@ -173,6 +173,14 @@ export default class BattleScene extends SceneBase {
*/ */
public typeHints: boolean = false; public typeHints: boolean = false;
/**
* Determines when to show the generation tooltip
* - 0 = Never
* - 1 = During Challenges
* - 2 = Always
*/
public generationTooltip: number = 0;
public disableMenu: boolean = false; public disableMenu: boolean = false;
public gameData: GameData; public gameData: GameData;

View File

@ -0,0 +1,8 @@
/**
* An enum for generation tooltip
*/
export enum GenerationTooltip {
NEVER,
DURING_CHALLENGE,
ALWAYS
}

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Folge", "set": "Folge",
"auto": "Auto", "auto": "Auto",
"disabled": "Deaktiviert", "disabled": "Deaktiviert",
"challengeOnly": "Challenge Only",
"language": "Sprache", "language": "Sprache",
"change": "Ändern", "change": "Ändern",
"uiTheme": "UI Thema", "uiTheme": "UI Thema",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Set", "set": "Set",
"auto": "Auto", "auto": "Auto",
"disabled": "Disabled", "disabled": "Disabled",
"challengeOnly": "Challenge Only",
"language": "Language", "language": "Language",
"change": "Change", "change": "Change",
"uiTheme": "UI Theme", "uiTheme": "UI Theme",
@ -60,6 +61,7 @@ export const settings: SimpleTranslationEntries = {
"fusionPaletteSwaps": "Fusion Palette Swaps", "fusionPaletteSwaps": "Fusion Palette Swaps",
"playerGender": "Player Gender", "playerGender": "Player Gender",
"typeHints": "Type Hints", "typeHints": "Type Hints",
"generationTooltip": "Generation Tooltip",
"masterVolume": "Master Volume", "masterVolume": "Master Volume",
"bgmVolume": "BGM Volume", "bgmVolume": "BGM Volume",
"seVolume": "SE Volume", "seVolume": "SE Volume",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Set", "set": "Set",
"auto": "Auto", "auto": "Auto",
"disabled": "Disabled", "disabled": "Disabled",
"challengeOnly": "Challenge Only",
"language": "Language", "language": "Language",
"change": "Change", "change": "Change",
"uiTheme": "UI Theme", "uiTheme": "UI Theme",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Défini", "set": "Défini",
"auto": "Auto", "auto": "Auto",
"disabled": "Désactivé", "disabled": "Désactivé",
"challengeOnly": "Challenge Only",
"language": "Langue", "language": "Langue",
"change": "Changer", "change": "Changer",
"uiTheme": "Interface", "uiTheme": "Interface",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Set", "set": "Set",
"auto": "Auto", "auto": "Auto",
"disabled": "Disabled", "disabled": "Disabled",
"challengeOnly": "Challenge Only",
"language": "Language", "language": "Language",
"change": "Change", "change": "Change",
"uiTheme": "UI Theme", "uiTheme": "UI Theme",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "토너먼트", "set": "토너먼트",
"auto": "자동", "auto": "자동",
"disabled": "비활성", "disabled": "비활성",
"challengeOnly": "Challenge Only",
"language": "언어", "language": "언어",
"change": "변경", "change": "변경",
"uiTheme": "UI 테마", "uiTheme": "UI 테마",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Definido", "set": "Definido",
"auto": "Automático", "auto": "Automático",
"disabled": "Desativado", "disabled": "Desativado",
"challengeOnly": "Challenge Only",
"language": "Idioma", "language": "Idioma",
"change": "Mudar", "change": "Mudar",
"uiTheme": "Tema da Interface", "uiTheme": "Tema da Interface",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "固定", "set": "固定",
"auto": "自动", "auto": "自动",
"disabled": "禁用", "disabled": "禁用",
"challengeOnly": "Challenge Only",
"language": "语言", "language": "语言",
"change": "选择", "change": "选择",
"uiTheme": "界面风格", "uiTheme": "界面风格",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "固定", "set": "固定",
"auto": "自動", "auto": "自動",
"disabled": "禁用", "disabled": "禁用",
"challengeOnly": "Challenge Only",
"language": "語言", "language": "語言",
"change": "選擇", "change": "選擇",
"uiTheme": "界面風格", "uiTheme": "界面風格",

View File

@ -93,6 +93,7 @@ export const SettingKeys = {
Fusion_Palette_Swaps: "FUSION_PALETTE_SWAPS", Fusion_Palette_Swaps: "FUSION_PALETTE_SWAPS",
Player_Gender: "PLAYER_GENDER", Player_Gender: "PLAYER_GENDER",
Type_Hints: "TYPE_HINTS", Type_Hints: "TYPE_HINTS",
Generation_Tooltip: "GENERATION_TOOLTIP",
Master_Volume: "MASTER_VOLUME", Master_Volume: "MASTER_VOLUME",
BGM_Volume: "BGM_VOLUME", BGM_Volume: "BGM_VOLUME",
SE_Volume: "SE_VOLUME", SE_Volume: "SE_VOLUME",
@ -489,6 +490,26 @@ export const Setting: Array<Setting> = [
default: 0, default: 0,
type: SettingType.DISPLAY type: SettingType.DISPLAY
}, },
{
key: SettingKeys.Generation_Tooltip,
label: i18next.t("settings:generationTooltip"),
options: [
{
value: "Off",
label: i18next.t("settings:off")
},
{
value: "Challenge Only",
label: i18next.t("settings:challengeOnly")
},
{
value: "On",
label: i18next.t("settings:on")
}
],
default: 0,
type: SettingType.DISPLAY
},
{ {
key: SettingKeys.Show_BGM_Bar, key: SettingKeys.Show_BGM_Bar,
label: i18next.t("settings:showBgmBar"), label: i18next.t("settings:showBgmBar"),
@ -691,6 +712,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
case SettingKeys.Type_Hints: case SettingKeys.Type_Hints:
scene.typeHints = Setting[index].options[value].value === "On"; scene.typeHints = Setting[index].options[value].value === "On";
break; break;
case SettingKeys.Generation_Tooltip:
scene.generationTooltip = value;
break;
case SettingKeys.Language: case SettingKeys.Language:
if (value) { if (value) {
if (scene.ui) { if (scene.ui) {

View File

@ -11,6 +11,7 @@ import { BattleStat } from "#app/data/battle-stat";
import BattleFlyout from "./battle-flyout"; import BattleFlyout from "./battle-flyout";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";
import i18next from "i18next"; import i18next from "i18next";
import { GenerationTooltip } from "#app/enums/generation-tooltip.js";
const battleStatOrder = [ BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.ACC, BattleStat.EVA, BattleStat.SPD ]; const battleStatOrder = [ BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.ACC, BattleStat.EVA, BattleStat.SPD ];
@ -329,7 +330,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
} }
if (!this.player) { if (!this.player) {
if (this.nameText.visible) { // First check is if the generationTooltip is on DURING_CHALLENGE, otherwise show it if it's enabled
const showGenerationTooltip = this.scene instanceof BattleScene &&
(this.scene.generationTooltip === GenerationTooltip.DURING_CHALLENGE ? this.scene.gameMode.isChallenge : this.scene.generationTooltip === GenerationTooltip.ALWAYS);
if (this.nameText.visible && showGenerationTooltip) {
this.nameText.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, i18next.t("battleInfo:generation", { generation: pokemon.species.generation }))); this.nameText.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip(null, i18next.t("battleInfo:generation", { generation: pokemon.species.generation })));
this.nameText.on("pointerout", () => (this.scene as BattleScene).ui.hideTooltip()); this.nameText.on("pointerout", () => (this.scene as BattleScene).ui.hideTooltip());
} }