webclient/js/Main.js

26 lines
602 B
JavaScript

import I18n;
import * as Screen from GUI.Screen;
import * as Login from GUI.Screen.Login;
import * as Hall from GUI.Screen.Hall;
import * as Game from GUI.Screen.Game;
import Save;
var gamePath = window.location.pathname.match(/\/game\/(?<id>[0-9A-Fa-f]+)/);
if(gamePath) {
var gameState = Save.get('games.state.Game#' + gamePath.groups.id);
if(gameState != undefined) {
Game.init(gameState);
} else {
Screen.dialog({
text: I18n.get('gameNotFound'),
answers: [
{label: 'backToMain', action: function() {window.location = '..';}}
]
});
}
} else {
Login.init();
Hall.init();
}