[Enhancement] update initial filter setting when not in challenge mode (#3506)

* update initial filter setting when not in challenge mode

* Modify the code with more consideration for future scalability.

* update initial setting in challenge mode also. no conditional setting!
This commit is contained in:
Leo Kim 2024-08-12 15:19:20 +09:00 committed by GitHub
parent d2c6aa5df8
commit d3d376dca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -973,13 +973,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
* Set the selections for all filters to their default starting value
*/
resetFilters() : void {
const genDropDown: DropDown = this.filterBar.getFilter(DropDownColumn.GEN);
const caughtDropDown: DropDown = this.filterBar.getFilter(DropDownColumn.CAUGHT);
this.filterBar.setValsToDefault();
if (!this.scene.gameMode.isChallenge) {
// if not in a challenge, in Gen hybrid filter hovering mode, set the cursor to the Gen1
genDropDown.setCursor(1);
// initial setting, in caught filter, select the options excluding the uncaught option
for (let i = 0; i < caughtDropDown.options.length; i++) {
// if the option is not "ALL" or "UNCAUGHT", toggle it
if (caughtDropDown.options[i].val !== "ALL" && caughtDropDown.options[i].val !== "UNCAUGHT") {
caughtDropDown.toggleOptionState(i);
}
}
}