Add proper title screen and logo
parent
7189258095
commit
cf959c6e1b
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -54,7 +54,6 @@ import CharSprite from './ui/char-sprite';
|
||||||
import DamageNumberHandler from './field/damage-number-handler';
|
import DamageNumberHandler from './field/damage-number-handler';
|
||||||
import PokemonInfoContainer from './ui/pokemon-info-container';
|
import PokemonInfoContainer from './ui/pokemon-info-container';
|
||||||
import { biomeDepths } from './data/biomes';
|
import { biomeDepths } from './data/biomes';
|
||||||
import { DailyRunScoreboard } from './ui/daily-run-scoreboard';
|
|
||||||
|
|
||||||
export const bypassLogin = false;
|
export const bypassLogin = false;
|
||||||
|
|
||||||
|
@ -124,8 +123,8 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
public pbTrayEnemy: PokeballTray;
|
public pbTrayEnemy: PokeballTray;
|
||||||
public abilityBar: AbilityBar;
|
public abilityBar: AbilityBar;
|
||||||
public partyExpBar: PartyExpBar;
|
public partyExpBar: PartyExpBar;
|
||||||
public arenaBg: Phaser.GameObjects.Sprite;
|
public arenaBg: Phaser.GameObjects.NineSlice;
|
||||||
public arenaBgTransition: Phaser.GameObjects.Sprite;
|
public arenaBgTransition: Phaser.GameObjects.NineSlice;
|
||||||
public arenaPlayer: ArenaBase;
|
public arenaPlayer: ArenaBase;
|
||||||
public arenaPlayerTransition: ArenaBase;
|
public arenaPlayerTransition: ArenaBase;
|
||||||
public arenaEnemy: ArenaBase;
|
public arenaEnemy: ArenaBase;
|
||||||
|
@ -139,7 +138,6 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
public pokeballCounts: PokeballCounts;
|
public pokeballCounts: PokeballCounts;
|
||||||
public money: integer;
|
public money: integer;
|
||||||
public pokemonInfoContainer: PokemonInfoContainer;
|
public pokemonInfoContainer: PokemonInfoContainer;
|
||||||
public dailyRunScoreboard: DailyRunScoreboard;
|
|
||||||
private party: PlayerPokemon[];
|
private party: PlayerPokemon[];
|
||||||
private waveCountText: Phaser.GameObjects.Text;
|
private waveCountText: Phaser.GameObjects.Text;
|
||||||
private moneyText: Phaser.GameObjects.Text;
|
private moneyText: Phaser.GameObjects.Text;
|
||||||
|
@ -316,6 +314,8 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
|
|
||||||
this.loadImage('default_bg', 'arenas');
|
this.loadImage('default_bg', 'arenas');
|
||||||
|
|
||||||
|
this.loadImage('logo', '');
|
||||||
|
|
||||||
// Load arena images
|
// Load arena images
|
||||||
Utils.getEnumValues(Biome).map(bt => {
|
Utils.getEnumValues(Biome).map(bt => {
|
||||||
const btKey = Biome[bt].toLowerCase();
|
const btKey = Biome[bt].toLowerCase();
|
||||||
|
@ -480,12 +480,14 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
}
|
}
|
||||||
|
|
||||||
launchBattle() {
|
launchBattle() {
|
||||||
this.arenaBg = this.addFieldSprite(0, 0, 'plains_bg', null, 0);
|
this.arenaBg = this.add.nineslice(0, 0, 'plains_bg', null, 320, 180, 0, 0, 132, 0);
|
||||||
this.arenaBgTransition = this.addFieldSprite(0, 0, `plains_bg`, null, 1);
|
this.arenaBgTransition = this.add.nineslice(0, 0, 'plains_bg', null, 320, 180, 0, 0, 132, 0);
|
||||||
|
|
||||||
[ this.arenaBgTransition, this.arenaBg ].forEach(a => {
|
[ this.arenaBgTransition, this.arenaBg ].forEach(a => {
|
||||||
|
a.setPipeline(this.fieldSpritePipeline);
|
||||||
a.setScale(6);
|
a.setScale(6);
|
||||||
a.setOrigin(0);
|
a.setOrigin(0);
|
||||||
|
a.setSize(320, 240);
|
||||||
});
|
});
|
||||||
|
|
||||||
const field = this.add.container(0, 0);
|
const field = this.add.container(0, 0);
|
||||||
|
@ -569,11 +571,6 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
|
|
||||||
this.fieldUI.add(this.pokemonInfoContainer);
|
this.fieldUI.add(this.pokemonInfoContainer);
|
||||||
|
|
||||||
this.dailyRunScoreboard = new DailyRunScoreboard(this, 1, -(this.game.canvas.height / 6) + 1);
|
|
||||||
this.dailyRunScoreboard.setup();
|
|
||||||
|
|
||||||
this.fieldUI.add(this.dailyRunScoreboard);
|
|
||||||
|
|
||||||
this.party = [];
|
this.party = [];
|
||||||
|
|
||||||
let loadPokemonAssets = [];
|
let loadPokemonAssets = [];
|
||||||
|
|
|
@ -43,7 +43,7 @@ import { EggHatchPhase } from "./egg-hatch-phase";
|
||||||
import { Egg } from "./data/egg";
|
import { Egg } from "./data/egg";
|
||||||
import { vouchers } from "./system/voucher";
|
import { vouchers } from "./system/voucher";
|
||||||
import { loggedInUser, updateUserInfo } from "./account";
|
import { loggedInUser, updateUserInfo } from "./account";
|
||||||
import { GameDataType, PlayerGender } from "./system/game-data";
|
import { GameDataType, PlayerGender, SessionSaveData } from "./system/game-data";
|
||||||
import { addPokeballCaptureStars, addPokeballOpenParticles } from "./field/anims";
|
import { addPokeballCaptureStars, addPokeballOpenParticles } from "./field/anims";
|
||||||
import { SpeciesFormChangeActiveTrigger, SpeciesFormChangeManualTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangeMoveUsedTrigger } from "./data/pokemon-forms";
|
import { SpeciesFormChangeActiveTrigger, SpeciesFormChangeManualTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangeMoveUsedTrigger } from "./data/pokemon-forms";
|
||||||
import { battleSpecDialogue, getCharVariantFromDialogue } from "./data/dialogue";
|
import { battleSpecDialogue, getCharVariantFromDialogue } from "./data/dialogue";
|
||||||
|
@ -127,6 +127,7 @@ export class LoginPhase extends Phase {
|
||||||
|
|
||||||
export class TitlePhase extends Phase {
|
export class TitlePhase extends Phase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
|
private lastSessionData: SessionSaveData;
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
@ -142,7 +143,13 @@ export class TitlePhase extends Phase {
|
||||||
|
|
||||||
this.scene.fadeOutBgm(0, false);
|
this.scene.fadeOutBgm(0, false);
|
||||||
|
|
||||||
this.showOptions();
|
this.scene.gameData.getSession(loggedInUser.lastSessionSlot).then(sessionData => {
|
||||||
|
this.lastSessionData = sessionData;
|
||||||
|
const biomeKey = getBiomeKey(sessionData.arena.biome);
|
||||||
|
const bgTexture = `${biomeKey}_bg`;
|
||||||
|
this.scene.arenaBg.setTexture(bgTexture);
|
||||||
|
this.showOptions();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showOptions(): void {
|
showOptions(): void {
|
||||||
|
@ -150,7 +157,7 @@ export class TitlePhase extends Phase {
|
||||||
if (loggedInUser?.lastSessionSlot > -1) {
|
if (loggedInUser?.lastSessionSlot > -1) {
|
||||||
options.push({
|
options.push({
|
||||||
label: 'Continue',
|
label: 'Continue',
|
||||||
handler: () => this.loadSaveSlot(loggedInUser.lastSessionSlot)
|
handler: () => this.loadSaveSlot(-1)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
options.push({
|
options.push({
|
||||||
|
@ -178,18 +185,16 @@ export class TitlePhase extends Phase {
|
||||||
});
|
});
|
||||||
const config: OptionSelectConfig = {
|
const config: OptionSelectConfig = {
|
||||||
options: options,
|
options: options,
|
||||||
noCancel: true
|
noCancel: true,
|
||||||
|
yOffset: 47
|
||||||
};
|
};
|
||||||
this.scene.ui.setMode(Mode.OPTION_SELECT, config);
|
this.scene.ui.setMode(Mode.TITLE, config);
|
||||||
|
|
||||||
this.scene.dailyRunScoreboard.showAndUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSaveSlot(slotId: integer): void {
|
loadSaveSlot(slotId: integer): void {
|
||||||
this.scene.sessionSlotId = slotId;
|
this.scene.sessionSlotId = slotId > -1 ? slotId : loggedInUser.lastSessionSlot;
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.dailyRunScoreboard.hide();
|
this.scene.gameData.loadSession(this.scene, slotId, slotId === -1 ? this.lastSessionData : null).then((success: boolean) => {
|
||||||
this.scene.gameData.loadSession(this.scene, slotId).then((success: boolean) => {
|
|
||||||
if (success) {
|
if (success) {
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
this.scene.ui.showText('Session loaded successfully.', null, () => this.end());
|
this.scene.ui.showText('Session loaded successfully.', null, () => this.end());
|
||||||
|
@ -256,8 +261,6 @@ export class TitlePhase extends Phase {
|
||||||
}
|
}
|
||||||
|
|
||||||
end(): void {
|
end(): void {
|
||||||
this.scene.dailyRunScoreboard.hide();
|
|
||||||
|
|
||||||
if (!this.loaded && !this.scene.gameMode.isDaily) {
|
if (!this.loaded && !this.scene.gameMode.isDaily) {
|
||||||
this.scene.arena.preloadBgm();
|
this.scene.arena.preloadBgm();
|
||||||
this.scene.pushPhase(new SelectStarterPhase(this.scene));
|
this.scene.pushPhase(new SelectStarterPhase(this.scene));
|
||||||
|
|
|
@ -109,7 +109,7 @@ vec3 hsl2rgb(vec3 hsl) {
|
||||||
|
|
||||||
rgb.r = hue2rgb(f1, f2, hsl.x + (1.0/3.0));
|
rgb.r = hue2rgb(f1, f2, hsl.x + (1.0/3.0));
|
||||||
rgb.g = hue2rgb(f1, f2, hsl.x);
|
rgb.g = hue2rgb(f1, f2, hsl.x);
|
||||||
rgb.b= hue2rgb(f1, f2, hsl.x - (1.0/3.0));
|
rgb.b = hue2rgb(f1, f2, hsl.x - (1.0/3.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return rgb;
|
return rgb;
|
||||||
|
|
|
@ -537,10 +537,10 @@ export class GameData {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSession(scene: BattleScene, slotId: integer): Promise<boolean> {
|
loadSession(scene: BattleScene, slotId: integer, sessionData?: SessionSaveData): Promise<boolean> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
this.getSession(slotId).then(async sessionData => {
|
const initSessionFromData = async sessionData => {
|
||||||
console.debug(sessionData);
|
console.debug(sessionData);
|
||||||
|
|
||||||
scene.setSeed(sessionData.seed || scene.game.config.seed[0]);
|
scene.setSeed(sessionData.seed || scene.game.config.seed[0]);
|
||||||
|
@ -614,10 +614,17 @@ export class GameData {
|
||||||
scene.updateModifiers(false);
|
scene.updateModifiers(false);
|
||||||
|
|
||||||
Promise.all(loadPokemonAssets).then(() => resolve(true));
|
Promise.all(loadPokemonAssets).then(() => resolve(true));
|
||||||
}).catch(err => {
|
};
|
||||||
reject(err);
|
if (sessionData)
|
||||||
return;
|
initSessionFromData(sessionData);
|
||||||
});
|
else {
|
||||||
|
this.getSession(slotId)
|
||||||
|
.then(data => initSessionFromData(data))
|
||||||
|
.catch(err => {
|
||||||
|
reject(err);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -40,8 +40,6 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
|
||||||
this.loadingLabel.setVisible(false);
|
this.loadingLabel.setVisible(false);
|
||||||
|
|
||||||
this.add(this.loadingLabel);
|
this.add(this.loadingLabel);
|
||||||
|
|
||||||
this.setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRankings(rankings: RankingEntry[]) {
|
updateRankings(rankings: RankingEntry[]) {
|
||||||
|
@ -72,7 +70,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showAndUpdate() {
|
update() {
|
||||||
this.rankingsContainer.removeAll(true);
|
this.rankingsContainer.removeAll(true);
|
||||||
|
|
||||||
this.loadingLabel.setText('Loading…');
|
this.loadingLabel.setText('Loading…');
|
||||||
|
@ -87,12 +85,6 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
|
||||||
} else
|
} else
|
||||||
this.loadingLabel.setText('No Rankings');
|
this.loadingLabel.setText('No Rankings');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
hide() {
|
|
||||||
this.setVisible(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
||||||
this.hasData = true;
|
this.hasData = true;
|
||||||
await this.setupWithData(sessionData);
|
await this.setupWithData(sessionData);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
import BattleScene from "../battle-scene";
|
||||||
|
import { DailyRunScoreboard } from "./daily-run-scoreboard";
|
||||||
|
import OptionSelectUiHandler from "./option-select-ui-handler";
|
||||||
|
import { Mode } from "./ui";
|
||||||
|
import * as Utils from "../utils";
|
||||||
|
|
||||||
|
export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||||
|
private titleContainer: Phaser.GameObjects.Container;
|
||||||
|
private dailyRunScoreboard: DailyRunScoreboard;
|
||||||
|
|
||||||
|
constructor(scene: BattleScene, mode: Mode = Mode.TITLE) {
|
||||||
|
super(scene, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
super.setup();
|
||||||
|
|
||||||
|
const ui = this.getUi();
|
||||||
|
|
||||||
|
this.titleContainer = this.scene.add.container(0, -(this.scene.game.canvas.height / 6));
|
||||||
|
this.titleContainer.setAlpha(0);
|
||||||
|
ui.add(this.titleContainer);
|
||||||
|
|
||||||
|
const logo = this.scene.add.image((this.scene.game.canvas.width / 6) / 2, 8, 'logo');
|
||||||
|
logo.setOrigin(0.5, 0);
|
||||||
|
this.titleContainer.add(logo);
|
||||||
|
|
||||||
|
this.dailyRunScoreboard = new DailyRunScoreboard(this.scene, 1, 49);
|
||||||
|
this.dailyRunScoreboard.setup();
|
||||||
|
|
||||||
|
this.titleContainer.add(this.dailyRunScoreboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
show(args: any[]): boolean {
|
||||||
|
const ret = super.show(args);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
const ui = this.getUi();
|
||||||
|
|
||||||
|
this.dailyRunScoreboard.update();
|
||||||
|
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: [ this.titleContainer, ui.getMessageHandler().bg ],
|
||||||
|
duration: Utils.fixedInt(325),
|
||||||
|
alpha: (target: any) => target === this.titleContainer ? 1 : 0,
|
||||||
|
ease: 'Sine.easeInOut'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
clear(): void {
|
||||||
|
super.clear();
|
||||||
|
|
||||||
|
const ui = this.getUi();
|
||||||
|
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: [ this.titleContainer, ui.getMessageHandler().bg ],
|
||||||
|
duration: Utils.fixedInt(325),
|
||||||
|
alpha: (target: any) => target === this.titleContainer ? 0 : 1,
|
||||||
|
ease: 'Sine.easeInOut'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,9 +31,11 @@ import * as Utils from "../utils";
|
||||||
import GameStatsUiHandler from './game-stats-ui-handler';
|
import GameStatsUiHandler from './game-stats-ui-handler';
|
||||||
import AwaitableUiHandler from './awaitable-ui-handler';
|
import AwaitableUiHandler from './awaitable-ui-handler';
|
||||||
import SaveSlotSelectUiHandler from './save-slot-select-ui-handler';
|
import SaveSlotSelectUiHandler from './save-slot-select-ui-handler';
|
||||||
|
import TitleUiHandler from './title-ui-handler';
|
||||||
|
|
||||||
export enum Mode {
|
export enum Mode {
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
|
TITLE,
|
||||||
COMMAND,
|
COMMAND,
|
||||||
FIGHT,
|
FIGHT,
|
||||||
BALL,
|
BALL,
|
||||||
|
@ -73,6 +75,7 @@ const transitionModes = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const noTransitionModes = [
|
const noTransitionModes = [
|
||||||
|
Mode.TITLE,
|
||||||
Mode.CONFIRM,
|
Mode.CONFIRM,
|
||||||
Mode.OPTION_SELECT,
|
Mode.OPTION_SELECT,
|
||||||
Mode.MENU,
|
Mode.MENU,
|
||||||
|
@ -107,6 +110,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||||
this.modeChain = [];
|
this.modeChain = [];
|
||||||
this.handlers = [
|
this.handlers = [
|
||||||
new BattleMessageUiHandler(scene),
|
new BattleMessageUiHandler(scene),
|
||||||
|
new TitleUiHandler(scene),
|
||||||
new CommandUiHandler(scene),
|
new CommandUiHandler(scene),
|
||||||
new FightUiHandler(scene),
|
new FightUiHandler(scene),
|
||||||
new BallUiHandler(scene),
|
new BallUiHandler(scene),
|
||||||
|
|
Loading…
Reference in New Issue