2024-04-01 23:56:46 +00:00
|
|
|
import { GachaType } from "./data/egg";
|
|
|
|
import { trainerConfigs } from "./data/trainer-config";
|
|
|
|
import { getBiomeHasProps } from "./field/arena";
|
2024-04-14 19:47:00 +00:00
|
|
|
import CacheBustedLoaderPlugin from "./plugins/cache-busted-loader-plugin";
|
2024-04-01 23:56:46 +00:00
|
|
|
import { SceneBase } from "./scene-base";
|
|
|
|
import { WindowVariant, getWindowVariantSuffix } from "./ui/ui-theme";
|
2024-04-16 14:59:15 +00:00
|
|
|
import { isMobile } from "./touch-controls";
|
2024-04-01 23:56:46 +00:00
|
|
|
import * as Utils from "./utils";
|
2024-04-19 18:55:01 +00:00
|
|
|
import { initI18n } from "./plugins/i18n";
|
2024-05-24 17:46:30 +00:00
|
|
|
import {initPokemonPrevolutions} from "#app/data/pokemon-evolutions";
|
|
|
|
import {initBiomes} from "#app/data/biomes";
|
|
|
|
import {initEggMoves} from "#app/data/egg-moves";
|
|
|
|
import {initPokemonForms} from "#app/data/pokemon-forms";
|
|
|
|
import {initSpecies} from "#app/data/pokemon-species";
|
|
|
|
import {initMoves} from "#app/data/move";
|
|
|
|
import {initAbilities} from "#app/data/ability";
|
2024-06-07 22:33:45 +00:00
|
|
|
import {initAchievements} from "#app/system/achv";
|
2024-05-24 20:08:18 +00:00
|
|
|
import {initTrainerTypeDialogue} from "#app/data/dialogue";
|
2024-06-08 05:07:23 +00:00
|
|
|
import { initChallenges } from "./data/challenge";
|
2024-05-27 08:39:18 +00:00
|
|
|
import i18next from "i18next";
|
2024-05-27 17:47:15 +00:00
|
|
|
import { initStatsKeys } from "./ui/game-stats-ui-handler";
|
2024-06-08 03:50:07 +00:00
|
|
|
import { initVouchers } from "./system/voucher";
|
2024-06-13 22:44:23 +00:00
|
|
|
import { Biome } from "#enums/biome";
|
|
|
|
import { TrainerType } from "#enums/trainer-type";
|
2024-04-01 23:56:46 +00:00
|
|
|
|
|
|
|
export class LoadingScene extends SceneBase {
|
|
|
|
constructor() {
|
2024-05-23 15:03:10 +00:00
|
|
|
super("loading");
|
2024-04-14 19:47:00 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
Phaser.Plugins.PluginCache.register("Loader", CacheBustedLoaderPlugin, "load");
|
2024-04-19 18:55:01 +00:00
|
|
|
initI18n();
|
2024-04-01 23:56:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
preload() {
|
2024-06-06 01:24:47 +00:00
|
|
|
Utils.localPing();
|
2024-05-23 15:03:10 +00:00
|
|
|
this.load["manifest"] = this.game["manifest"];
|
2024-04-01 23:56:46 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
if (!isMobile()) {
|
|
|
|
this.load.video("intro_dark", "images/intro_dark.mp4", true);
|
|
|
|
}
|
2024-04-15 17:10:09 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage("loading_bg", "arenas");
|
|
|
|
this.loadImage("logo", "");
|
2024-04-01 23:56:46 +00:00
|
|
|
|
|
|
|
// Load menu images
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas("bg", "ui");
|
|
|
|
this.loadImage("command_fight_labels", "ui");
|
|
|
|
this.loadAtlas("prompt", "ui");
|
|
|
|
this.loadImage("candy", "ui");
|
|
|
|
this.loadImage("candy_overlay", "ui");
|
|
|
|
this.loadImage("cursor", "ui");
|
|
|
|
this.loadImage("cursor_reverse", "ui");
|
|
|
|
for (const wv of Utils.getEnumValues(WindowVariant)) {
|
|
|
|
for (let w = 1; w <= 5; w++) {
|
|
|
|
this.loadImage(`window_${w}${getWindowVariantSuffix(wv)}`, "ui/windows");
|
|
|
|
}
|
2024-04-01 23:56:46 +00:00
|
|
|
}
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas("namebox", "ui");
|
|
|
|
this.loadImage("pbinfo_player", "ui");
|
|
|
|
this.loadImage("pbinfo_player_stats", "ui");
|
|
|
|
this.loadImage("pbinfo_player_mini", "ui");
|
|
|
|
this.loadImage("pbinfo_player_mini_stats", "ui");
|
|
|
|
this.loadAtlas("pbinfo_player_type", "ui");
|
|
|
|
this.loadAtlas("pbinfo_player_type1", "ui");
|
|
|
|
this.loadAtlas("pbinfo_player_type2", "ui");
|
|
|
|
this.loadImage("pbinfo_enemy_mini", "ui");
|
|
|
|
this.loadImage("pbinfo_enemy_mini_stats", "ui");
|
|
|
|
this.loadImage("pbinfo_enemy_boss", "ui");
|
|
|
|
this.loadImage("pbinfo_enemy_boss_stats", "ui");
|
|
|
|
this.loadAtlas("pbinfo_enemy_type", "ui");
|
|
|
|
this.loadAtlas("pbinfo_enemy_type1", "ui");
|
|
|
|
this.loadAtlas("pbinfo_enemy_type2", "ui");
|
|
|
|
this.loadAtlas("pbinfo_stat", "ui");
|
|
|
|
this.loadAtlas("pbinfo_stat_numbers", "ui");
|
|
|
|
this.loadImage("overlay_lv", "ui");
|
|
|
|
this.loadAtlas("numbers", "ui");
|
|
|
|
this.loadAtlas("numbers_red", "ui");
|
|
|
|
this.loadAtlas("overlay_hp", "ui");
|
|
|
|
this.loadAtlas("overlay_hp_boss", "ui");
|
|
|
|
this.loadImage("overlay_exp", "ui");
|
|
|
|
this.loadImage("icon_owned", "ui");
|
|
|
|
this.loadImage("ability_bar_left", "ui");
|
|
|
|
this.loadImage("party_exp_bar", "ui");
|
|
|
|
this.loadImage("achv_bar", "ui");
|
|
|
|
this.loadImage("achv_bar_2", "ui");
|
|
|
|
this.loadImage("achv_bar_3", "ui");
|
|
|
|
this.loadImage("achv_bar_4", "ui");
|
|
|
|
this.loadImage("achv_bar_5", "ui");
|
|
|
|
this.loadImage("shiny_star", "ui", "shiny.png");
|
|
|
|
this.loadImage("shiny_star_1", "ui", "shiny_1.png");
|
|
|
|
this.loadImage("shiny_star_2", "ui", "shiny_2.png");
|
|
|
|
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("ha_capsule", "ui", "ha_capsule.png");
|
|
|
|
this.loadImage("champion_ribbon", "ui", "champion_ribbon.png");
|
|
|
|
this.loadImage("icon_spliced", "ui");
|
|
|
|
this.loadImage("icon_tera", "ui");
|
|
|
|
this.loadImage("type_tera", "ui");
|
|
|
|
this.loadAtlas("type_bgs", "ui");
|
|
|
|
|
2024-06-06 03:57:55 +00:00
|
|
|
this.loadImage("dawn_icon_fg", "ui");
|
|
|
|
this.loadImage("dawn_icon_mg", "ui");
|
|
|
|
this.loadImage("dawn_icon_bg", "ui");
|
|
|
|
this.loadImage("day_icon_fg", "ui");
|
|
|
|
this.loadImage("day_icon_mg", "ui");
|
|
|
|
this.loadImage("day_icon_bg", "ui");
|
|
|
|
this.loadImage("dusk_icon_fg", "ui");
|
|
|
|
this.loadImage("dusk_icon_mg", "ui");
|
|
|
|
this.loadImage("dusk_icon_bg", "ui");
|
|
|
|
this.loadImage("night_icon_fg", "ui");
|
|
|
|
this.loadImage("night_icon_mg", "ui");
|
|
|
|
this.loadImage("night_icon_bg", "ui");
|
2024-06-04 02:18:09 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage("pb_tray_overlay_player", "ui");
|
|
|
|
this.loadImage("pb_tray_overlay_enemy", "ui");
|
|
|
|
this.loadAtlas("pb_tray_ball", "ui");
|
|
|
|
|
|
|
|
this.loadImage("party_bg", "ui");
|
|
|
|
this.loadImage("party_bg_double", "ui");
|
|
|
|
this.loadAtlas("party_slot_main", "ui");
|
|
|
|
this.loadAtlas("party_slot", "ui");
|
|
|
|
this.loadImage("party_slot_overlay_lv", "ui");
|
|
|
|
this.loadImage("party_slot_hp_bar", "ui");
|
|
|
|
this.loadAtlas("party_slot_hp_overlay", "ui");
|
|
|
|
this.loadAtlas("party_pb", "ui");
|
|
|
|
this.loadAtlas("party_cancel", "ui");
|
|
|
|
|
|
|
|
this.loadImage("summary_bg", "ui");
|
|
|
|
this.loadImage("summary_overlay_shiny", "ui");
|
|
|
|
this.loadImage("summary_profile", "ui");
|
|
|
|
this.loadImage("summary_profile_prompt_z", "ui"); // The pixel Z button prompt
|
|
|
|
this.loadImage("summary_profile_prompt_a", "ui"); // The pixel A button prompt
|
|
|
|
this.loadImage("summary_profile_ability", "ui"); // Pixel text 'ABILITY'
|
|
|
|
this.loadImage("summary_profile_passive", "ui"); // Pixel text 'PASSIVE'
|
|
|
|
this.loadImage("summary_status", "ui");
|
|
|
|
this.loadImage("summary_stats", "ui");
|
|
|
|
this.loadImage("summary_stats_overlay_exp", "ui");
|
|
|
|
this.loadImage("summary_moves", "ui");
|
|
|
|
this.loadImage("summary_moves_effect", "ui");
|
|
|
|
this.loadImage("summary_moves_overlay_row", "ui");
|
|
|
|
this.loadImage("summary_moves_overlay_pp", "ui");
|
|
|
|
this.loadAtlas("summary_moves_cursor", "ui");
|
|
|
|
for (let t = 1; t <= 3; t++) {
|
|
|
|
this.loadImage(`summary_tabs_${t}`, "ui");
|
|
|
|
}
|
|
|
|
|
|
|
|
this.loadImage("starter_select_bg", "ui");
|
|
|
|
this.loadImage("select_cursor", "ui");
|
|
|
|
this.loadImage("select_cursor_highlight", "ui");
|
|
|
|
this.loadImage("select_cursor_highlight_thick", "ui");
|
|
|
|
this.loadImage("select_cursor_pokerus", "ui");
|
|
|
|
this.loadImage("select_gen_cursor", "ui");
|
|
|
|
this.loadImage("select_gen_cursor_highlight", "ui");
|
|
|
|
|
|
|
|
this.loadImage("saving_icon", "ui");
|
|
|
|
|
|
|
|
this.loadImage("default_bg", "arenas");
|
2024-04-01 23:56:46 +00:00
|
|
|
// Load arena images
|
|
|
|
Utils.getEnumValues(Biome).map(bt => {
|
|
|
|
const btKey = Biome[bt].toLowerCase();
|
2024-05-23 15:03:10 +00:00
|
|
|
const isBaseAnimated = btKey === "end";
|
2024-04-01 23:56:46 +00:00
|
|
|
const baseAKey = `${btKey}_a`;
|
|
|
|
const baseBKey = `${btKey}_b`;
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage(`${btKey}_bg`, "arenas");
|
|
|
|
if (!isBaseAnimated) {
|
|
|
|
this.loadImage(baseAKey, "arenas");
|
|
|
|
} else {
|
|
|
|
this.loadAtlas(baseAKey, "arenas");
|
|
|
|
}
|
|
|
|
if (!isBaseAnimated) {
|
|
|
|
this.loadImage(baseBKey, "arenas");
|
|
|
|
} else {
|
|
|
|
this.loadAtlas(baseBKey, "arenas");
|
|
|
|
}
|
2024-04-01 23:56:46 +00:00
|
|
|
if (getBiomeHasProps(bt)) {
|
|
|
|
for (let p = 1; p <= 3; p++) {
|
2024-05-23 15:03:10 +00:00
|
|
|
const isPropAnimated = p === 3 && [ "power_plant", "end" ].find(b => b === btKey);
|
2024-04-01 23:56:46 +00:00
|
|
|
const propKey = `${btKey}_b_${p}`;
|
2024-05-23 15:03:10 +00:00
|
|
|
if (!isPropAnimated) {
|
|
|
|
this.loadImage(propKey, "arenas");
|
|
|
|
} else {
|
|
|
|
this.loadAtlas(propKey, "arenas");
|
|
|
|
}
|
2024-04-01 23:56:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-04-09 17:59:46 +00:00
|
|
|
// Load bitmap fonts
|
2024-05-23 15:03:10 +00:00
|
|
|
this.load.bitmapFont("item-count", "fonts/item-count.png", "fonts/item-count.xml");
|
2024-04-09 17:59:46 +00:00
|
|
|
|
2024-04-01 23:56:46 +00:00
|
|
|
// Load trainer images
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas("trainer_m_back", "trainer");
|
|
|
|
this.loadAtlas("trainer_m_back_pb", "trainer");
|
|
|
|
this.loadAtlas("trainer_f_back", "trainer");
|
|
|
|
this.loadAtlas("trainer_f_back_pb", "trainer");
|
2024-04-01 23:56:46 +00:00
|
|
|
|
|
|
|
Utils.getEnumValues(TrainerType).map(tt => {
|
|
|
|
const config = trainerConfigs[tt];
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas(config.getSpriteKey(), "trainer");
|
|
|
|
if (config.doubleOnly || config.hasDouble) {
|
|
|
|
this.loadAtlas(config.getSpriteKey(true), "trainer");
|
|
|
|
}
|
2024-04-01 23:56:46 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Load character sprites
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas("c_rival_m", "character", "rival_m");
|
|
|
|
this.loadAtlas("c_rival_f", "character", "rival_f");
|
2024-04-01 23:56:46 +00:00
|
|
|
|
|
|
|
// Load pokemon-related images
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage("pkmn__back__sub", "pokemon/back", "sub.png");
|
|
|
|
this.loadImage("pkmn__sub", "pokemon", "sub.png");
|
|
|
|
this.loadAtlas("battle_stats", "effects");
|
|
|
|
this.loadAtlas("shiny", "effects");
|
|
|
|
this.loadAtlas("shiny_2", "effects");
|
|
|
|
this.loadAtlas("shiny_3", "effects");
|
|
|
|
this.loadImage("tera", "effects");
|
|
|
|
this.loadAtlas("pb_particles", "effects");
|
|
|
|
this.loadImage("evo_sparkle", "effects");
|
|
|
|
this.loadAtlas("tera_sparkle", "effects");
|
|
|
|
this.load.video("evo_bg", "images/effects/evo_bg.mp4", true);
|
|
|
|
|
|
|
|
this.loadAtlas("pb", "");
|
|
|
|
this.loadAtlas("items", "");
|
|
|
|
this.loadAtlas("types", "");
|
2024-05-27 08:39:18 +00:00
|
|
|
|
2024-05-27 15:12:29 +00:00
|
|
|
// Get current lang and load the types atlas for it. English will only load types while all other languages will load types and types_<lang>
|
2024-06-04 20:11:02 +00:00
|
|
|
const lang = i18next.resolvedLanguage;
|
2024-05-27 15:12:29 +00:00
|
|
|
if (lang !== "en") {
|
2024-05-27 08:39:18 +00:00
|
|
|
if (Utils.verifyLang(lang)) {
|
|
|
|
this.loadAtlas(`types_${lang}`, "");
|
2024-05-27 15:12:29 +00:00
|
|
|
} else {
|
|
|
|
// Fallback to English
|
|
|
|
this.loadAtlas("types", "");
|
2024-05-27 08:39:18 +00:00
|
|
|
}
|
2024-05-27 15:12:29 +00:00
|
|
|
} else {
|
|
|
|
this.loadAtlas("types", "");
|
|
|
|
}
|
|
|
|
|
2024-05-27 08:39:18 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas("statuses", "");
|
|
|
|
this.loadAtlas("categories", "");
|
2024-05-23 23:45:04 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas("egg", "egg");
|
|
|
|
this.loadAtlas("egg_crack", "egg");
|
|
|
|
this.loadAtlas("egg_icons", "egg");
|
|
|
|
this.loadAtlas("egg_shard", "egg");
|
|
|
|
this.loadAtlas("egg_lightrays", "egg");
|
2024-04-01 23:56:46 +00:00
|
|
|
Utils.getEnumKeys(GachaType).forEach(gt => {
|
|
|
|
const key = gt.toLowerCase();
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage(`gacha_${key}`, "egg");
|
|
|
|
this.loadAtlas(`gacha_underlay_${key}`, "egg");
|
2024-04-01 23:56:46 +00:00
|
|
|
});
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage("gacha_glass", "egg");
|
|
|
|
this.loadImage("gacha_eggs", "egg");
|
|
|
|
this.loadAtlas("gacha_hatch", "egg");
|
|
|
|
this.loadImage("gacha_knob", "egg");
|
2024-04-01 23:56:46 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage("egg_list_bg", "ui");
|
2024-04-01 23:56:46 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadImage("end_m", "cg");
|
|
|
|
this.loadImage("end_f", "cg");
|
2024-05-17 01:41:38 +00:00
|
|
|
|
2024-04-19 02:52:26 +00:00
|
|
|
for (let i = 0; i < 10; i++) {
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadAtlas(`pokemon_icons_${i}`, "");
|
|
|
|
if (i) {
|
|
|
|
this.loadAtlas(`pokemon_icons_${i}v`, "");
|
|
|
|
}
|
2024-04-19 02:52:26 +00:00
|
|
|
}
|
2024-04-01 23:56:46 +00:00
|
|
|
|
2024-06-01 12:56:32 +00:00
|
|
|
this.loadAtlas("dualshock", "inputs");
|
|
|
|
this.loadAtlas("xbox", "inputs");
|
|
|
|
this.loadAtlas("keyboard", "inputs");
|
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.loadSe("select");
|
|
|
|
this.loadSe("menu_open");
|
|
|
|
this.loadSe("hit");
|
|
|
|
this.loadSe("hit_strong");
|
|
|
|
this.loadSe("hit_weak");
|
|
|
|
this.loadSe("stat_up");
|
|
|
|
this.loadSe("stat_down");
|
|
|
|
this.loadSe("faint");
|
|
|
|
this.loadSe("flee");
|
|
|
|
this.loadSe("low_hp");
|
|
|
|
this.loadSe("exp");
|
|
|
|
this.loadSe("level_up");
|
|
|
|
this.loadSe("sparkle");
|
|
|
|
this.loadSe("restore");
|
|
|
|
this.loadSe("shine");
|
|
|
|
this.loadSe("shing");
|
|
|
|
this.loadSe("charge");
|
|
|
|
this.loadSe("beam");
|
|
|
|
this.loadSe("upgrade");
|
|
|
|
this.loadSe("buy");
|
|
|
|
this.loadSe("achv");
|
|
|
|
this.loadSe("error");
|
|
|
|
|
|
|
|
this.loadSe("pb_rel");
|
|
|
|
this.loadSe("pb_throw");
|
|
|
|
this.loadSe("pb_bounce_1");
|
|
|
|
this.loadSe("pb_bounce_2");
|
|
|
|
this.loadSe("pb_move");
|
|
|
|
this.loadSe("pb_catch");
|
|
|
|
this.loadSe("pb_lock");
|
|
|
|
|
|
|
|
this.loadSe("pb_tray_enter");
|
|
|
|
this.loadSe("pb_tray_ball");
|
|
|
|
this.loadSe("pb_tray_empty");
|
|
|
|
|
|
|
|
this.loadSe("egg_crack");
|
|
|
|
this.loadSe("egg_hatch");
|
|
|
|
this.loadSe("gacha_dial");
|
|
|
|
this.loadSe("gacha_running");
|
|
|
|
this.loadSe("gacha_dispense");
|
|
|
|
|
|
|
|
this.loadSe("PRSFX- Transform", "battle_anims");
|
|
|
|
|
|
|
|
this.loadBgm("menu");
|
|
|
|
|
|
|
|
this.loadBgm("level_up_fanfare", "bw/level_up_fanfare.mp3");
|
|
|
|
this.loadBgm("item_fanfare", "bw/item_fanfare.mp3");
|
|
|
|
this.loadBgm("minor_fanfare", "bw/minor_fanfare.mp3");
|
|
|
|
this.loadBgm("heal", "bw/heal.mp3");
|
|
|
|
this.loadBgm("victory_trainer", "bw/victory_trainer.mp3");
|
|
|
|
this.loadBgm("victory_gym", "bw/victory_gym.mp3");
|
|
|
|
this.loadBgm("victory_champion", "bw/victory_champion.mp3");
|
|
|
|
this.loadBgm("evolution", "bw/evolution.mp3");
|
|
|
|
this.loadBgm("evolution_fanfare", "bw/evolution_fanfare.mp3");
|
|
|
|
|
|
|
|
this.load.plugin("rextexteditplugin", "https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexteditplugin.min.js", true);
|
2024-04-01 23:56:46 +00:00
|
|
|
|
|
|
|
this.loadLoadingScreen();
|
2024-05-24 17:46:30 +00:00
|
|
|
|
2024-06-08 03:50:07 +00:00
|
|
|
initVouchers();
|
2024-06-07 22:33:45 +00:00
|
|
|
initAchievements();
|
2024-05-27 17:47:15 +00:00
|
|
|
initStatsKeys();
|
2024-05-24 17:46:30 +00:00
|
|
|
initPokemonPrevolutions();
|
|
|
|
initBiomes();
|
|
|
|
initEggMoves();
|
|
|
|
initPokemonForms();
|
2024-05-24 20:08:18 +00:00
|
|
|
initTrainerTypeDialogue();
|
2024-05-24 17:46:30 +00:00
|
|
|
initSpecies();
|
|
|
|
initMoves();
|
|
|
|
initAbilities();
|
2024-06-08 05:07:23 +00:00
|
|
|
initChallenges();
|
2024-04-01 23:56:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
loadLoadingScreen() {
|
2024-04-19 12:45:21 +00:00
|
|
|
const mobile = isMobile();
|
|
|
|
|
2024-04-15 17:10:09 +00:00
|
|
|
const loadingGraphics: any[] = [];
|
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
const bg = this.add.image(0, 0, "");
|
2024-04-01 23:56:46 +00:00
|
|
|
bg.setOrigin(0, 0);
|
|
|
|
bg.setScale(6);
|
|
|
|
bg.setVisible(false);
|
|
|
|
|
|
|
|
const graphics = this.add.graphics();
|
|
|
|
|
|
|
|
graphics.lineStyle(4, 0xff00ff, 1).setDepth(10);
|
|
|
|
|
|
|
|
const progressBar = this.add.graphics();
|
|
|
|
const progressBox = this.add.graphics();
|
|
|
|
progressBox.lineStyle(5, 0xff00ff, 1.0);
|
|
|
|
progressBox.fillStyle(0x222222, 0.8);
|
|
|
|
|
|
|
|
const width = this.cameras.main.width;
|
|
|
|
const height = this.cameras.main.height;
|
|
|
|
|
2024-06-05 01:41:36 +00:00
|
|
|
const midWidth = width / 2;
|
|
|
|
const midHeight = height / 2;
|
|
|
|
|
|
|
|
const logo = this.add.image(midWidth, 240, "");
|
2024-04-01 23:56:46 +00:00
|
|
|
logo.setVisible(false);
|
|
|
|
logo.setOrigin(0.5, 0.5);
|
|
|
|
logo.setScale(4);
|
|
|
|
|
|
|
|
const percentText = this.make.text({
|
2024-06-05 01:41:36 +00:00
|
|
|
x: midWidth,
|
|
|
|
y: midHeight - 24,
|
2024-05-23 15:03:10 +00:00
|
|
|
text: "0%",
|
2024-04-01 23:56:46 +00:00
|
|
|
style: {
|
|
|
|
font: "72px emerald",
|
|
|
|
color: "#ffffff",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
percentText.setOrigin(0.5, 0.5);
|
|
|
|
|
|
|
|
const assetText = this.make.text({
|
2024-06-05 01:41:36 +00:00
|
|
|
x: midWidth,
|
|
|
|
y: midHeight + 48,
|
2024-04-01 23:56:46 +00:00
|
|
|
text: "",
|
|
|
|
style: {
|
|
|
|
font: "48px emerald",
|
|
|
|
color: "#ffffff",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
assetText.setOrigin(0.5, 0.5);
|
|
|
|
|
2024-06-05 01:41:36 +00:00
|
|
|
const disclaimerText = this.make.text({
|
|
|
|
x: midWidth,
|
|
|
|
y: assetText.y + 152,
|
|
|
|
text: i18next.t("menu:disclaimer"),
|
|
|
|
style: {
|
|
|
|
font: "72px emerald",
|
|
|
|
color: "#DA3838",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
disclaimerText.setOrigin(0.5, 0.5);
|
|
|
|
|
|
|
|
const disclaimerDescriptionText = this.make.text({
|
|
|
|
x: midWidth,
|
|
|
|
y: disclaimerText.y + 120,
|
|
|
|
text: i18next.t("menu:disclaimerDescription"),
|
|
|
|
style: {
|
|
|
|
font: "48px emerald",
|
|
|
|
color: "#ffffff",
|
|
|
|
align: "center"
|
|
|
|
},
|
|
|
|
});
|
|
|
|
disclaimerDescriptionText.setOrigin(0.5, 0.5);
|
|
|
|
|
|
|
|
disclaimerText.setVisible(false);
|
|
|
|
disclaimerDescriptionText.setVisible(false);
|
|
|
|
|
2024-04-15 17:10:09 +00:00
|
|
|
const intro = this.add.video(0, 0);
|
|
|
|
intro.setOrigin(0, 0);
|
|
|
|
intro.setScale(3);
|
|
|
|
|
2024-04-01 23:56:46 +00:00
|
|
|
this.load.on("progress", (value: string) => {
|
|
|
|
const parsedValue = parseFloat(value);
|
|
|
|
percentText.setText(`${Math.floor(parsedValue * 100)}%`);
|
|
|
|
progressBar.clear();
|
|
|
|
progressBar.fillStyle(0xffffff, 0.8);
|
2024-06-05 01:41:36 +00:00
|
|
|
progressBar.fillRect(midWidth - 320, 360, 640 * parsedValue, 64);
|
2024-04-01 23:56:46 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
this.load.on("fileprogress", file => {
|
2024-06-08 18:34:05 +00:00
|
|
|
assetText.setText(i18next.t("menu:loadingAsset", { assetName: file.key }));
|
2024-04-01 23:56:46 +00:00
|
|
|
});
|
2024-05-23 23:45:04 +00:00
|
|
|
|
2024-04-15 17:10:09 +00:00
|
|
|
loadingGraphics.push(bg, graphics, progressBar, progressBox, logo, percentText, assetText);
|
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
if (!mobile) {
|
2024-04-19 12:45:21 +00:00
|
|
|
loadingGraphics.map(g => g.setVisible(false));
|
2024-05-23 15:03:10 +00:00
|
|
|
}
|
2024-04-15 17:10:09 +00:00
|
|
|
|
|
|
|
const destroyLoadingAssets = () => {
|
|
|
|
intro.destroy();
|
|
|
|
bg.destroy();
|
|
|
|
logo.destroy();
|
|
|
|
progressBar.destroy();
|
|
|
|
progressBox.destroy();
|
|
|
|
percentText.destroy();
|
|
|
|
assetText.destroy();
|
|
|
|
};
|
2024-04-01 23:56:46 +00:00
|
|
|
|
2024-05-23 15:03:10 +00:00
|
|
|
this.load.on("filecomplete", key => {
|
2024-04-01 23:56:46 +00:00
|
|
|
switch (key) {
|
2024-05-23 15:03:10 +00:00
|
|
|
case "intro_dark":
|
|
|
|
intro.load("intro_dark");
|
|
|
|
intro.on("complete", () => {
|
|
|
|
this.tweens.add({
|
|
|
|
targets: intro,
|
|
|
|
duration: 500,
|
|
|
|
alpha: 0,
|
|
|
|
ease: "Sine.easeIn"
|
2024-04-15 17:10:09 +00:00
|
|
|
});
|
2024-05-23 15:03:10 +00:00
|
|
|
loadingGraphics.map(g => g.setVisible(true));
|
2024-06-05 01:41:36 +00:00
|
|
|
disclaimerText.setVisible(true);
|
|
|
|
disclaimerDescriptionText.setVisible(true);
|
2024-05-23 15:03:10 +00:00
|
|
|
});
|
|
|
|
intro.play();
|
|
|
|
break;
|
|
|
|
case "loading_bg":
|
|
|
|
bg.setTexture("loading_bg");
|
|
|
|
if (mobile) {
|
|
|
|
bg.setVisible(true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "logo":
|
|
|
|
logo.setTexture("logo");
|
|
|
|
if (mobile) {
|
|
|
|
logo.setVisible(true);
|
|
|
|
}
|
|
|
|
break;
|
2024-04-01 23:56:46 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-04-15 17:10:09 +00:00
|
|
|
this.load.on("complete", () => destroyLoadingAssets());
|
2024-04-01 23:56:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get gameHeight() {
|
|
|
|
return this.game.config.height as number;
|
|
|
|
}
|
|
|
|
|
|
|
|
get gameWidth() {
|
|
|
|
return this.game.config.width as number;
|
|
|
|
}
|
|
|
|
|
|
|
|
async create() {
|
|
|
|
this.scene.start("battle");
|
|
|
|
}
|
2024-05-23 15:03:10 +00:00
|
|
|
}
|