2018-03-20 20:48:46 +01:00
|
|
|
/*
|
|
|
|
|
* Verrückte Turing-Maschinen — A turing complete game
|
|
|
|
|
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
|
|
|
|
|
*
|
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
module mod_vtm_manifestation
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
export class klasse_speicher_partie
|
2018-03-20 22:39:00 +01:00
|
|
|
extends klasse_manifestation<mod_vtm_aufbau.typ_partie, void>
|
2018-03-20 20:48:46 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2018-03-20 22:39:00 +01:00
|
|
|
public constructor(aufbau : mod_vtm_aufbau.typ_partie)
|
2018-03-20 20:48:46 +01:00
|
|
|
{
|
|
|
|
|
super(aufbau);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
* @override
|
|
|
|
|
*/
|
|
|
|
|
public einrichten() : void
|
|
|
|
|
{
|
2018-03-20 22:39:00 +01:00
|
|
|
mod_vtm_aufbau.partie_lauschen
|
2018-03-20 20:48:46 +01:00
|
|
|
(
|
2018-03-20 22:39:00 +01:00
|
|
|
this.aufbau,
|
2018-03-20 20:48:46 +01:00
|
|
|
"aenderung_aufgabe",
|
|
|
|
|
(angaben) =>
|
|
|
|
|
{
|
|
|
|
|
// console.info("aenderung_aufgabe", angaben);
|
2018-03-20 22:39:00 +01:00
|
|
|
let id : string = mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).id_lesen();
|
2018-03-20 20:48:46 +01:00
|
|
|
let key : string = ("vtm_" + id);
|
|
|
|
|
if (key in localStorage)
|
|
|
|
|
{
|
|
|
|
|
let item : string = localStorage.getItem(key);
|
2018-03-20 22:39:00 +01:00
|
|
|
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);
|
2018-03-20 20:48:46 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-20 22:39:00 +01:00
|
|
|
mod_vtm_aufbau.partie_welt_leeren(this.aufbau);
|
2018-03-20 20:48:46 +01:00
|
|
|
// nichts tun
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
2018-03-20 22:39:00 +01:00
|
|
|
mod_vtm_aufbau.partie_lauschen
|
2018-03-20 20:48:46 +01:00
|
|
|
(
|
2018-03-20 22:39:00 +01:00
|
|
|
this.aufbau,
|
2018-03-20 20:48:46 +01:00
|
|
|
"aenderung_welt",
|
|
|
|
|
(angaben) =>
|
|
|
|
|
{
|
2018-03-20 22:39:00 +01:00
|
|
|
let id : string = mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).id_lesen();
|
2018-03-20 20:48:46 +01:00
|
|
|
let key : string = ("vtm_" + id);
|
2018-03-20 22:39:00 +01:00
|
|
|
let item : string = JSON.stringify(mod_vtm_aufbau.welt_exportieren(mod_vtm_aufbau.partie_welt_lesen(this.aufbau)));
|
2018-03-20 20:48:46 +01:00
|
|
|
localStorage.setItem(key, item);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
2018-03-20 22:39:00 +01:00
|
|
|
mod_vtm_aufbau.partie_lauschen
|
2018-03-20 20:48:46 +01:00
|
|
|
(
|
2018-03-20 22:39:00 +01:00
|
|
|
this.aufbau,
|
2018-03-20 20:48:46 +01:00
|
|
|
"aenderung_figur",
|
|
|
|
|
(angaben) =>
|
|
|
|
|
{
|
|
|
|
|
// console.info("aenderung_figur", angaben);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
2018-03-20 22:39:00 +01:00
|
|
|
mod_vtm_aufbau.partie_lauschen
|
2018-03-20 20:48:46 +01:00
|
|
|
(
|
2018-03-20 22:39:00 +01:00
|
|
|
this.aufbau,
|
2018-03-20 20:48:46 +01:00
|
|
|
"aenderung_modus",
|
|
|
|
|
(angaben) =>
|
|
|
|
|
{
|
|
|
|
|
// console.info("aenderung_modus", angaben);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
this.darstellen();
|
|
|
|
|
this.binden();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
* @implementation
|
|
|
|
|
*/
|
|
|
|
|
public darstellen() : void
|
|
|
|
|
{
|
|
|
|
|
console.warn("empty");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
* @implementation
|
|
|
|
|
*/
|
|
|
|
|
public binden() : void
|
|
|
|
|
{
|
|
|
|
|
console.warn("empty");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|