/* * Verrückte Turing-Maschinen — A turing complete game * Copyright (C) 2016 Christian Fraß * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ module mod_vtm_manifestation { /** * @author kcf */ export class klasse_speicher_partie extends klasse_manifestation { /** * @author kcf */ public constructor(aufbau : mod_vtm_aufbau.typ_partie) { super(aufbau); } /** * @author kcf * @override */ public einrichten() : void { mod_vtm_aufbau.partie_lauschen ( this.aufbau, "aenderung_aufgabe", (angaben) => { // console.info("aenderung_aufgabe", angaben); let id : string = mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).id_lesen(); let key : string = ("vtm_" + id); if (key in localStorage) { let item : string = localStorage.getItem(key); let welt : mod_vtm_aufbau.typ_welt = mod_vtm_aufbau.welt_importieren(JSON.parse(item)); mod_vtm_aufbau.partie_welt_setzen(this.aufbau, welt, false); } else { mod_vtm_aufbau.partie_welt_leeren(this.aufbau); // nichts tun } } ) ; mod_vtm_aufbau.partie_lauschen ( this.aufbau, "aenderung_welt", (angaben) => { let id : string = mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).id_lesen(); let key : string = ("vtm_" + id); let item : string = JSON.stringify(mod_vtm_aufbau.welt_exportieren(mod_vtm_aufbau.partie_welt_lesen(this.aufbau))); localStorage.setItem(key, item); } ) ; mod_vtm_aufbau.partie_lauschen ( this.aufbau, "aenderung_figur", (angaben) => { // console.info("aenderung_figur", angaben); } ) ; mod_vtm_aufbau.partie_lauschen ( this.aufbau, "aenderung_modus", (angaben) => { // console.info("aenderung_modus", angaben); } ) ; this.darstellen(); this.binden(); } /** * @author kcf * @implementation */ public darstellen() : void { console.warn("empty"); } /** * @author kcf * @implementation */ public binden() : void { console.warn("empty"); } } }