Querystring Argument
This commit is contained in:
parent
3942b0b89e
commit
b4113d50d1
|
|
@ -1,6 +1,8 @@
|
|||
import * as Phaser from 'phaser';
|
||||
import { GAME_HEIGHT, GAME_WIDTH, COLORS } from '../config.js';
|
||||
import { auth } from '../services/auth.js';
|
||||
import { getGame } from '../data/gamesRegistry.js';
|
||||
import { stopMenuMusic } from '../ui/MenuMusic.js';
|
||||
|
||||
export default class PreloadScene extends Phaser.Scene {
|
||||
constructor() { super('Preload'); }
|
||||
|
|
@ -177,6 +179,20 @@ export default class PreloadScene extends Phaser.Scene {
|
|||
this.scene.start('PeggleEditor');
|
||||
return;
|
||||
}
|
||||
|
||||
// Deep link: index.html?game=<slug> jumps straight to the same place a
|
||||
// main-menu click would (GameMenuScene.openGame's branching logic).
|
||||
const deepLinkGame = getGame(params.get('game'));
|
||||
if (deepLinkGame) {
|
||||
if (deepLinkGame.maxOpponents === 0) {
|
||||
stopMenuMusic();
|
||||
this.scene.start('GameRoom', { game: deepLinkGame, opponents: [] });
|
||||
} else {
|
||||
this.scene.start('OpponentSelect', { game: deepLinkGame });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.scene.start('Landing');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue