[Enhancement] Add favorite filter in Starter UI (#3431)
* add favorite filter. add favorite starter attribute * add error handling for undefined favorite attribute * add placeholders in each locales * add favorite icon from great art team * update favorite icon to code * update korean translation * align icons * initialize the starter preferences if they don't exist * update requested changes
This commit is contained in:
parent
d2eea96777
commit
14b3907b11
Binary file not shown.
After Width: | Height: | Size: 226 B |
Binary file not shown.
After Width: | Height: | Size: 226 B |
|
@ -93,6 +93,7 @@ export class LoadingScene extends SceneBase {
|
|||
this.loadImage("shiny_star_small", "ui", "shiny_small.png");
|
||||
this.loadImage("shiny_star_small_1", "ui", "shiny_small_1.png");
|
||||
this.loadImage("shiny_star_small_2", "ui", "shiny_small_2.png");
|
||||
this.loadImage("favorite", "ui", "favorite.png");
|
||||
this.loadImage("passive_bg", "ui", "passive_bg.png");
|
||||
this.loadAtlas("shiny_icons", "ui");
|
||||
this.loadImage("ha_capsule", "ui", "ha_capsule.png");
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ribbon - Yes",
|
||||
"hasNotWon": "Ribbon - No",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "Toggle IVs",
|
||||
"manageMoves": "Manage Moves",
|
||||
"manageNature": "Manage Nature",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Use Candies",
|
||||
"selectNature": "Select nature.",
|
||||
"selectMoveSwapOut": "Select a move to swap out.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Band",
|
||||
"hasWon": "Hat Klassik-Modus gewonnen",
|
||||
"hasNotWon": "Hat Klassik-Modus nicht gewonnen",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "DVs anzeigen/verbergen",
|
||||
"manageMoves": "Attacken ändern",
|
||||
"manageNature": "Wesen ändern",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Bonbons verwenden",
|
||||
"selectNature": "Wähle das neue Wesen.",
|
||||
"selectMoveSwapOut": "Wähle die zu ersetzende Attacke.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ribbon - Yes",
|
||||
"hasNotWon": "Ribbon - No",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "Toggle IVs",
|
||||
"manageMoves": "Manage Moves",
|
||||
"manageNature": "Manage Nature",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Use Candies",
|
||||
"selectNature": "Select nature.",
|
||||
"selectMoveSwapOut": "Select a move to swap out.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ya ha ganado",
|
||||
"hasNotWon": "Aún no ha ganado",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "Mostrar IVs",
|
||||
"manageMoves": "Cambiar movs.",
|
||||
"manageNature": "Cambiar natur.",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Usar Caramelos",
|
||||
"selectNature": "Elige Natur.",
|
||||
"selectMoveSwapOut": "Elige el movimiento que sustituir.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Ruban",
|
||||
"hasWon": "Ruban - Oui",
|
||||
"hasNotWon": "Ruban - Non",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "Voir les IV",
|
||||
"manageMoves": "Modifier les Capacités",
|
||||
"manageNature": "Modifier la Nature",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Utiliser des Bonbons",
|
||||
"selectNature": "Sélectionnez une nature.",
|
||||
"selectMoveSwapOut": "Sélectionnez la capacité à échanger.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ribbon - Yes",
|
||||
"hasNotWon": "Ribbon - No",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "Vedi/Nascondi IV",
|
||||
"manageMoves": "Gestisci mosse",
|
||||
"manageNature": "Gestisci natura",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Usa caramelle",
|
||||
"selectNature": "Seleziona natura.",
|
||||
"selectMoveSwapOut": "Seleziona una mossa da scambiare.",
|
||||
|
|
|
@ -3,16 +3,31 @@ import { SimpleTranslationEntries } from "#app/interfaces/locales";
|
|||
export const filterBar: SimpleTranslationEntries = {
|
||||
"genFilter": "Gen",
|
||||
"typeFilter": "Type",
|
||||
"caughtFilter": "Caught",
|
||||
"unlocksFilter": "Unlocks",
|
||||
"winFilter": "Win",
|
||||
"miscFilter": "Misc",
|
||||
"sortFilter": "Sort",
|
||||
"all": "All",
|
||||
"normal": "Normal",
|
||||
"normal": "Not Shiny",
|
||||
"uncaught": "Uncaught",
|
||||
"passive": "Passive",
|
||||
"passiveUnlocked": "Passive Unlocked",
|
||||
"passiveLocked": "Passive Locked",
|
||||
"hasWon": "Yes",
|
||||
"hasNotWon": "No",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ribbon - Yes",
|
||||
"hasNotWon": "Ribbon - No",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "No.",
|
||||
"sortByCost": "Cost",
|
||||
"sortByCandies": "Candy Count",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "個体値を ひょうじ",
|
||||
"manageMoves": "わざを ならびかえ",
|
||||
"manageNature": "せいかくを ならびかえ",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "アメを つかう",
|
||||
"selectNature": "せいかくをえらんでください",
|
||||
"selectMoveSwapOut": "交換する技を選択してください",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "코스트 줄이기",
|
||||
"costReductionUnlocked": "코스트 절감됨",
|
||||
"costReductionLocked": "코스트 절감 없음",
|
||||
"favorite": "즐겨찾기",
|
||||
"isFavorite": "즐겨찾기 등록됨",
|
||||
"notFavorite": "즐겨찾기 제외됨",
|
||||
"ribbon": "클리어 여부",
|
||||
"hasWon": "클리어 완료",
|
||||
"hasNotWon": "클리어 안함",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "개체값 토글",
|
||||
"manageMoves": "기술 관리",
|
||||
"manageNature": "성격 관리",
|
||||
"addToFavorites": "즐겨찾기에 추가",
|
||||
"removeFromFavorites": "즐겨찾기에서 제외",
|
||||
"useCandies": "사탕 사용",
|
||||
"selectNature": "교체할 성격을 선택해주세요.",
|
||||
"selectMoveSwapOut": "교체할 기술을 선택해주세요.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Redução de Custo",
|
||||
"costReductionUnlocked": "Redução de Custo Desbloq.",
|
||||
"costReductionLocked": "Redução de Custo Bloq.",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "Fita",
|
||||
"hasWon": "Fita - Sim",
|
||||
"hasNotWon": "Fita - Não",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "Mostrar IVs",
|
||||
"manageMoves": "Mudar Movimentos",
|
||||
"manageNature": "Mudar Natureza",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "Usar Doces",
|
||||
"selectNature": "Escolha uma natureza.",
|
||||
"selectMoveSwapOut": "Escolha um movimento para substituir.",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "费用降低",
|
||||
"costReductionUnlocked": "已降费",
|
||||
"costReductionLocked": "未降费",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "缎带",
|
||||
"hasWon": "有缎带",
|
||||
"hasNotWon": "无缎带",
|
||||
|
|
|
@ -28,6 +28,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "显示个体",
|
||||
"manageMoves": "管理招式",
|
||||
"manageNature": "管理性格",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "使用糖果",
|
||||
"selectNature": "选择性格",
|
||||
"selectMoveSwapOut": "选择要替换的招式。",
|
||||
|
|
|
@ -16,6 +16,9 @@ export const filterBar: SimpleTranslationEntries = {
|
|||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"favorite": "Favorite",
|
||||
"isFavorite": "Favorite - Yes",
|
||||
"notFavorite": "Favorite - No",
|
||||
"ribbon": "緞帶",
|
||||
"hasWon": "有緞帶",
|
||||
"hasNotWon": "無緞帶",
|
||||
|
|
|
@ -29,6 +29,8 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"toggleIVs": "查看個體值",
|
||||
"manageMoves": "管理技能",
|
||||
"manageNature": "管理性格",
|
||||
"addToFavorites": "Add to Favorites",
|
||||
"removeFromFavorites": "Remove from Favorites",
|
||||
"useCandies": "使用糖果",
|
||||
"selectNature": "選擇性格",
|
||||
"selectMoveSwapOut": "選擇想要替換走的招式",
|
||||
|
|
|
@ -198,6 +198,7 @@ export interface StarterAttributes {
|
|||
form?: integer;
|
||||
female?: boolean;
|
||||
shiny?: boolean;
|
||||
favorite?: boolean;
|
||||
nickname?: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ export class StarterContainer extends Phaser.GameObjects.Container {
|
|||
public label: Phaser.GameObjects.Text;
|
||||
public starterPassiveBgs: Phaser.GameObjects.Image;
|
||||
public hiddenAbilityIcon: Phaser.GameObjects.Image;
|
||||
public favoriteIcon: Phaser.GameObjects.Image;
|
||||
public classicWinIcon: Phaser.GameObjects.Image;
|
||||
public candyUpgradeIcon: Phaser.GameObjects.Image;
|
||||
public candyUpgradeOverlayIcon: Phaser.GameObjects.Image;
|
||||
|
@ -66,8 +67,16 @@ export class StarterContainer extends Phaser.GameObjects.Container {
|
|||
this.add(abilityIcon);
|
||||
this.hiddenAbilityIcon = abilityIcon;
|
||||
|
||||
// favorite icon
|
||||
const favoriteIcon = this.scene.add.image(0, 7, "favorite");
|
||||
favoriteIcon.setOrigin(0, 0);
|
||||
favoriteIcon.setScale(0.5);
|
||||
favoriteIcon.setVisible(false);
|
||||
this.add(favoriteIcon);
|
||||
this.favoriteIcon = favoriteIcon;
|
||||
|
||||
// classic win icon
|
||||
const classicWinIcon = this.scene.add.image(2, 12, "champion_ribbon");
|
||||
const classicWinIcon = this.scene.add.image(0, 12, "champion_ribbon");
|
||||
classicWinIcon.setOrigin(0, 0);
|
||||
classicWinIcon.setScale(0.5);
|
||||
classicWinIcon.setVisible(false);
|
||||
|
|
|
@ -462,6 +462,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.filterBar.addFilter(DropDownColumn.UNLOCKS, i18next.t("filterBar:unlocksFilter"), new DropDown(this.scene, 0, 0, unlocksOptions, this.updateStarters, DropDownType.RADIAL));
|
||||
|
||||
// misc filter
|
||||
const favoriteLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:favorite"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:isFavorite"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:notFavorite"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
const winLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:ribbon"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:hasWon"), undefined, DropDownState.ON),
|
||||
|
@ -477,6 +482,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
new DropDownLabel(i18next.t("filterBar:hasPokerus"), undefined, DropDownState.ON),
|
||||
];
|
||||
const miscOptions = [
|
||||
new DropDownOption(this.scene, "FAVORITE", favoriteLabels),
|
||||
new DropDownOption(this.scene, "WIN", winLabels),
|
||||
new DropDownOption(this.scene, "HIDDEN_ABILITY", hiddenAbilityLabels),
|
||||
new DropDownOption(this.scene, "POKERUS", pokerusLabels),
|
||||
|
@ -929,6 +935,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.allSpecies.forEach((species, s) => {
|
||||
const icon = this.starterContainers[s].icon;
|
||||
const dexEntry = this.scene.gameData.dexData[species.speciesId];
|
||||
this.starterPreferences[species.speciesId] = this.starterPreferences[species.speciesId] ?? {};
|
||||
|
||||
if (dexEntry.caughtAttr) {
|
||||
icon.clearTint();
|
||||
|
@ -1543,6 +1550,29 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
});
|
||||
}
|
||||
}
|
||||
// if container.favorite is false, show the favorite option
|
||||
const isFavorite = starterAttributes?.favorite ?? false;
|
||||
if (!isFavorite) {
|
||||
options.push({
|
||||
label: i18next.t("starterSelectUiHandler:addToFavorites"),
|
||||
handler: () => {
|
||||
starterAttributes.favorite = true;
|
||||
starterContainer.favoriteIcon.setVisible(starterAttributes.favorite);
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
options.push({
|
||||
label: i18next.t("starterSelectUiHandler:removeFromFavorites"),
|
||||
handler: () => {
|
||||
starterAttributes.favorite = false;
|
||||
starterContainer.favoriteIcon.setVisible(starterAttributes.favorite);
|
||||
ui.setMode(Mode.STARTER_SELECT);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
options.push({
|
||||
label: i18next.t("menu:rename"),
|
||||
handler: () => {
|
||||
|
@ -2258,6 +2288,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
const isUncaught = !isCaught && !isVariantCaught && !isVariant2Caught && !isVariant3Caught;
|
||||
const isPassiveUnlocked = this.scene.gameData.starterData[container.species.speciesId].passiveAttr > 0;
|
||||
const isCostReduced = this.scene.gameData.starterData[container.species.speciesId].valueReduction > 0;
|
||||
const isFavorite = this.starterPreferences[container.species.speciesId]?.favorite ?? false;
|
||||
|
||||
const isWin = this.scene.gameData.starterData[container.species.speciesId].classicWinCount > 0;
|
||||
const isNotWin = this.scene.gameData.starterData[container.species.speciesId].classicWinCount === 0;
|
||||
const isUndefined = this.scene.gameData.starterData[container.species.speciesId].classicWinCount === undefined;
|
||||
|
@ -2301,6 +2333,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
}
|
||||
});
|
||||
|
||||
const fitsFavorite = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (misc.val === "FAVORITE" && misc.state === DropDownState.ON) {
|
||||
return isFavorite;
|
||||
}
|
||||
if (misc.val === "FAVORITE" && misc.state === DropDownState.EXCLUDE) {
|
||||
return !isFavorite;
|
||||
}
|
||||
if (misc.val === "FAVORITE" && misc.state === DropDownState.OFF) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
const fitsWin = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (container.species.speciesId < 10) {
|
||||
}
|
||||
|
@ -2333,7 +2377,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
}
|
||||
});
|
||||
|
||||
if (fitsGen && fitsType && fitsCaught && fitsPassive && fitsCostReduction && fitsWin && fitsHA && fitsPokerus) {
|
||||
if (fitsGen && fitsType && fitsCaught && fitsPassive && fitsCostReduction && fitsFavorite && fitsWin && fitsHA && fitsPokerus) {
|
||||
this.filteredStarterContainers.push(container);
|
||||
}
|
||||
});
|
||||
|
@ -2426,6 +2470,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
container.starterPassiveBgs.setVisible(!!this.scene.gameData.starterData[speciesId].passiveAttr);
|
||||
container.hiddenAbilityIcon.setVisible(!!this.scene.gameData.dexData[speciesId].caughtAttr && !!(this.scene.gameData.starterData[speciesId].abilityAttr & 4));
|
||||
container.classicWinIcon.setVisible(this.scene.gameData.starterData[speciesId].classicWinCount > 0);
|
||||
container.favoriteIcon.setVisible(this.starterPreferences[speciesId]?.favorite ?? false);
|
||||
|
||||
// 'Candy Icon' mode
|
||||
if (this.scene.candyUpgradeDisplay === 0) {
|
||||
|
|
Loading…
Reference in New Issue