[P1 Bug][UI/UX] Address shop cursor target feedbacks (#4009)

* address shop cursor target feedbacks

* make rewards left-most

* fix tests breaking

* Update src/test/items/dire_hit.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/items/temp_stat_stage_booster.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/locales/ja/settings.json

Co-authored-by: Chapybara-jp <charlie.beer@hotmail.com>

* update default value

* stylistic change

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Chapybara-jp <charlie.beer@hotmail.com>
This commit is contained in:
Adrian T. 2024-09-04 09:07:56 +08:00 committed by GitHub
parent f63492d545
commit 200deef0ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 69 additions and 43 deletions

View File

@ -130,7 +130,7 @@ export default class BattleScene extends SceneBase {
public gameSpeed: integer = 1;
public damageNumbersMode: integer = 0;
public reroll: boolean = false;
public shopCursorTarget: number = ShopCursorTarget.CHECK_TEAM;
public shopCursorTarget: number = ShopCursorTarget.REWARDS;
public showMovesetFlyout: boolean = true;
public showArenaFlyout: boolean = true;
public showTimeOfDayWidget: boolean = true;

View File

@ -1,13 +1,13 @@
/**
* Determines the cursor target when entering the shop phase.
* Determines the row cursor target when entering the shop phase.
*/
export enum ShopCursorTarget {
/** Cursor points to Reroll */
/** Cursor points to Reroll row */
REROLL,
/** Cursor points to Items */
ITEMS,
/** Cursor points to Shop */
/** Cursor points to Rewards row */
REWARDS,
/** Cursor points to Shop row */
SHOP,
/** Cursor points to Check Team */
/** Cursor points to Check Team row */
CHECK_TEAM
}

View File

@ -100,7 +100,7 @@
"moveTouchControls": "Bewegung Touch Steuerung",
"shopOverlayOpacity": "Shop Overlay Deckkraft",
"shopCursorTarget": "Shop-Cursor Ziel",
"items": "Items",
"rewards": "Items",
"reroll": "Neu rollen",
"shop": "Shop",
"checkTeam": "Team überprüfen"

View File

@ -100,7 +100,7 @@
"moveTouchControls": "Move Touch Controls",
"shopOverlayOpacity": "Shop Overlay Opacity",
"shopCursorTarget": "Shop Cursor Target",
"items": "Items",
"rewards": "Rewards",
"reroll": "Reroll",
"shop": "Shop",
"checkTeam": "Check Team"

View File

@ -100,7 +100,7 @@
"moveTouchControls": "Controles táctiles",
"shopOverlayOpacity": "Opacidad de la fase de compra",
"shopCursorTarget": "Cursor de la tienda",
"items": "Objetos",
"rewards": "Objetos",
"reroll": "Actualizar",
"shop": "Tienda",
"checkTeam": "Ver equipo"

View File

@ -100,7 +100,7 @@
"moveTouchControls": "Déplacer les contrôles tactiles",
"shopOverlayOpacity": "Opacité boutique",
"shopCursorTarget": "Choix après relance",
"items": "Obj. gratuits",
"rewards": "Obj. gratuits",
"reroll": "Relance",
"shop": "Boutique",
"checkTeam": "Équipe"

View File

@ -8,7 +8,7 @@
"moveTouchControls": "Move Touch Controls",
"shopOverlayOpacity": "Opacità Finestra Negozio",
"shopCursorTarget": "Target Cursore Negozio",
"items": "Oggetti",
"rewards": "Oggetti",
"reroll": "Rerolla",
"shop": "Negozio",
"checkTeam": "Squadra"

View File

@ -100,7 +100,7 @@
"moveTouchControls": "タッチ移動操作",
"shopOverlayOpacity": "ショップオーバレイ不透明度",
"shopCursorTarget": "ショップカーソル初位置",
"items": "アイテム",
"rewards": "ご褒美",
"reroll": "選択肢変更",
"shop": "ショップ",
"checkTeam": "手持ちを確認"

View File

@ -100,7 +100,7 @@
"moveTouchControls": "터치 컨트롤 이동",
"shopOverlayOpacity": "상점 오버레이 투명도",
"shopCursorTarget": "상점 커서 위치",
"items": "아이템",
"rewards": "아이템",
"reroll": "갱신",
"shop": "상점",
"checkTeam": "파티 확인"

View File

@ -100,7 +100,7 @@
"moveTouchControls": "Mover Controles de Toque",
"shopOverlayOpacity": "Opacidade da Loja",
"shopCursorTarget": "Alvo do Cursor da Loja",
"items": "Itens",
"rewards": "Itens",
"reroll": "Atualizar",
"shop": "Loja",
"checkTeam": "Checar Time"

View File

@ -99,7 +99,7 @@
"moveTouchControls": "移动触摸控制",
"shopOverlayOpacity": "商店显示不透明度",
"shopCursorTarget": "商店指针位置",
"items": "道具",
"rewards": "道具",
"reroll": "刷新",
"shop": "购买",
"checkTeam": "检查队伍"

View File

@ -25,6 +25,7 @@ const VOLUME_OPTIONS: SettingOption[] = new Array(11).fill(null).map((_, i) => i
value: "Mute",
label: getTranslation("settings:mute")
});
const SHOP_OVERLAY_OPACITY_OPTIONS: SettingOption[] = new Array(9).fill(null).map((_, i) => {
const value = ((i + 1) * 10).toString();
return {
@ -32,6 +33,7 @@ const SHOP_OVERLAY_OPACITY_OPTIONS: SettingOption[] = new Array(9).fill(null).ma
label: value,
};
});
const OFF_ON: SettingOption[] = [
{
value: "Off",
@ -53,6 +55,40 @@ const AUTO_DISABLED: SettingOption[] = [
}
];
const SHOP_CURSOR_TARGET_OPTIONS: SettingOption[] = [
{
value: "Rewards",
label: i18next.t("settings:rewards")
},
{
value: "Shop",
label: i18next.t("settings:shop")
},
{
value: "Reroll",
label: i18next.t("settings:reroll")
},
{
value: "Check Team",
label: i18next.t("settings:checkTeam")
}
];
const shopCursorTargetIndexMap = SHOP_CURSOR_TARGET_OPTIONS.map(option => {
switch (option.value) {
case "Rewards":
return ShopCursorTarget.REWARDS;
case "Shop":
return ShopCursorTarget.SHOP;
case "Reroll":
return ShopCursorTarget.REROLL;
case "Check Team":
return ShopCursorTarget.CHECK_TEAM;
default:
throw new Error(`Unknown value: ${option.value}`);
}
});
/**
* Types for helping separate settings to different menus
*/
@ -103,7 +139,7 @@ export const SettingKeys = {
Damage_Numbers: "DAMAGE_NUMBERS",
Move_Animations: "MOVE_ANIMATIONS",
Show_Stats_on_Level_Up: "SHOW_LEVEL_UP_STATS",
Reroll_Target: "REROLL_TARGET",
Shop_Cursor_Target: "SHOP_CURSOR_TARGET",
Candy_Upgrade_Notification: "CANDY_UPGRADE_NOTIFICATION",
Candy_Upgrade_Display: "CANDY_UPGRADE_DISPLAY",
Move_Info: "MOVE_INFO",
@ -596,27 +632,10 @@ export const Setting: Array<Setting> = [
isHidden: () => !hasTouchscreen()
},
{
key: SettingKeys.Reroll_Target,
key: SettingKeys.Shop_Cursor_Target,
label: i18next.t("settings:shopCursorTarget"),
options: [
{
value:"Reroll",
label: i18next.t("settings:reroll")
},
{
value:"Items",
label: i18next.t("settings:items")
},
{
value:"Shop",
label: i18next.t("settings:shop")
},
{
value:"Check Team",
label: i18next.t("settings:checkTeam")
}
],
default: ShopCursorTarget.CHECK_TEAM,
options: SHOP_CURSOR_TARGET_OPTIONS,
default: 0,
type: SettingType.DISPLAY
},
{
@ -758,8 +777,10 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
case SettingKeys.Show_Stats_on_Level_Up:
scene.showLevelUpStats = Setting[index].options[value].value === "On";
break;
case SettingKeys.Reroll_Target:
scene.shopCursorTarget = value;
case SettingKeys.Shop_Cursor_Target:
const selectedValue = shopCursorTargetIndexMap[value];
scene.shopCursorTarget = selectedValue;
break;
case SettingKeys.EXP_Gains_Speed:
scene.expGainsSpeed = value;
break;

View File

@ -13,6 +13,7 @@ import { Button } from "#app/enums/buttons";
import { CommandPhase } from "#app/phases/command-phase";
import { NewBattlePhase } from "#app/phases/new-battle-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { ShopCursorTarget } from "#app/enums/shop-cursor-target";
describe("Items - Dire Hit", () => {
let phaserGame: Phaser.Game;
@ -77,8 +78,8 @@ describe("Items - Dire Hit", () => {
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler;
// Traverse to first modifier slot
handler.processInput(Button.LEFT);
handler.processInput(Button.UP);
handler.setCursor(0);
handler.setRowCursor(ShopCursorTarget.REWARDS);
handler.processInput(Button.ACTION);
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(NewBattlePhase), true);

View File

@ -16,6 +16,7 @@ import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { ShopCursorTarget } from "#app/enums/shop-cursor-target";
describe("Items - Temporary Stat Stage Boosters", () => {
@ -154,8 +155,8 @@ describe("Items - Temporary Stat Stage Boosters", () => {
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
const handler = game.scene.ui.getHandler() as ModifierSelectUiHandler;
// Traverse to first modifier slot
handler.processInput(Button.LEFT);
handler.processInput(Button.UP);
handler.setCursor(0);
handler.setRowCursor(ShopCursorTarget.REWARDS);
handler.processInput(Button.ACTION);
}, () => game.isCurrentPhase(CommandPhase) || game.isCurrentPhase(NewBattlePhase), true);

View File

@ -257,6 +257,9 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
if (this.scene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) {
this.setRowCursor(0);
this.setCursor(2);
} else if ((this.scene.shopCursorTarget === ShopCursorTarget.SHOP) && this.scene.gameMode.hasNoShop) {
this.setRowCursor(ShopCursorTarget.REWARDS);
this.setCursor(0);
} else {
this.setRowCursor(this.scene.shopCursorTarget);
this.setCursor(0);