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;
/**
* Determines when to show the generation tooltip
* - 0 = Never
* - 1 = During Challenges
* - 2 = Always
*/
public generationTooltip: number = 0;
public disableMenu: boolean = false;
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",
"auto": "Auto",
"disabled": "Deaktiviert",
"challengeOnly": "Challenge Only",
"language": "Sprache",
"change": "Ändern",
"uiTheme": "UI Thema",

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 Theme",
@ -60,6 +61,7 @@ export const settings: SimpleTranslationEntries = {
"fusionPaletteSwaps": "Fusion Palette Swaps",
"playerGender": "Player Gender",
"typeHints": "Type Hints",
"generationTooltip": "Generation Tooltip",
"masterVolume": "Master Volume",
"bgmVolume": "BGM Volume",
"seVolume": "SE Volume",

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 Theme",

View File

@ -29,6 +29,7 @@ export const settings: SimpleTranslationEntries = {
"set": "Défini",
"auto": "Auto",
"disabled": "Désactivé",
"challengeOnly": "Challenge Only",
"language": "Langue",
"change": "Changer",
"uiTheme": "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": "UI Theme",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@ import { BattleStat } from "#app/data/battle-stat";
import BattleFlyout from "./battle-flyout";
import { WindowVariant, addWindow } from "./ui-theme";
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 ];
@ -329,7 +330,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
}
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("pointerout", () => (this.scene as BattleScene).ui.hideTooltip());
}