58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
function Automaton(async, dom, messaging, screen, session, ui) {
|
|
var menus = {
|
|
start: {
|
|
entries: [
|
|
{label: 'New Game', action: newGame},
|
|
{label: 'Settings', action: function() { console.log("Not implemented yet"); }}
|
|
],
|
|
cancel: intro
|
|
},
|
|
name: {
|
|
},
|
|
skin: {
|
|
}
|
|
};
|
|
var game = session.getGame();
|
|
if(game != undefined) {
|
|
menus.start.entries.unshift(
|
|
{label: 'Continue', action: function() { messaging.send({tag: 'Resume', game: game}); }}
|
|
);
|
|
}
|
|
|
|
return {
|
|
run: run
|
|
}
|
|
|
|
//messaging.addEventListener(['Init'], function(game) {
|
|
// console.log(game);
|
|
//});
|
|
|
|
function run() {
|
|
intro();
|
|
}
|
|
|
|
function intro() {
|
|
var title = dom.make('p', {textContent: "P O K E M O N", class: 'title'});
|
|
var subtitle = dom.make('p', {textContent: "< press start >", class: 'subtitle'});
|
|
ui.frame('Intro');
|
|
async.run(
|
|
ui.cinematic([
|
|
{action: function() {}, delay: 500},
|
|
{action: function() { screen.show(title); }, delay: 1000},
|
|
{action: function() { screen.show(subtitle); }, delay: null}
|
|
], {
|
|
'B': intro,
|
|
'Start': function() { ui.frame('StartMenu'); ui.menu(menus.start); }
|
|
})
|
|
);
|
|
}
|
|
|
|
function newGame() {
|
|
ui.frame('GameInit');
|
|
async.run(
|
|
ui.text("Bonjour ! Bienvenue dans le monde merveilleux des pokémons !"),
|
|
ui.text("Pour certains, les pokemons sont des amis. Pour d'autres, ils sont une ressource. Pour ma part, hé bien l'étude des pokémons est ma passion et mon métier."),
|
|
);
|
|
}
|
|
}
|