EndGameScreen.ts
1 import m from 'mithril' 2 import { App } from '../App' 3 import { state } from '../State' 4 import { EndGame } from '../EndGame' 5 6 export class EndGameScreen { 7 private endGame: EndGame 8 9 public view(): Array<m.Vnode> { 10 return [ 11 m('div', { 'id': 'topbar' }, [ 12 m('div', { 'class': 'topbar-gamename' }, 'Bobby'), 13 m('div', { 'class': 'topbar-menu' }, [ 14 m(m.route.Link, { 'href': '/', 'class': 'topbar-button' }, 'Aller à l\'écran d\'accueil'), 15 ]), 16 ]), 17 18 m('div', { 'id': 'app-wrapper', 'role': 'main' }, [ 19 m('canvas', { 'id': 'game' }), 20 m('div', { 'id': 'end-game' }, [ 21 m('p', { 'class': 'center' }, 'Félicitations, vous avez fini le jeu. 🎉'), 22 m('p', { 'class': 'center' }, '🥳 Merci d\'avoir joué !'), 23 ]), 24 ]), 25 ] 26 } 27 28 public oncreate(_vnode: m.Vnode): void { 29 if (!state.getStorage().areAllLevelsSucceeded()) { 30 m.route.set('/choose-level') 31 } 32 33 App.resize() 34 35 this.endGame = new EndGame() 36 } 37 38 public onremove(_vnode: m.Vnode): void { 39 this.endGame.stop() 40 this.endGame.unlisten() 41 } 42 }