vtm/quelldatein/manifestation/svg/partie.ts

127 lines
3.7 KiB
TypeScript
Raw Normal View History

2017-11-09 18:42:09 +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_svg_partie
extends klasse_manifestation<mod_vtm_aufbau.klasse_partie, mod_vtm_helfer.schnittstelle_xmlknoten>
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor(aufbau : mod_vtm_aufbau.klasse_partie)
{
super(aufbau);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public darstellen() : mod_vtm_helfer.schnittstelle_xmlknoten
{
let kinder_partie : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
// Welt
{
let kinder_welt : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
// Felder
{
let kinder_felder : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
this.aufbau.welt_lesen().felder_lesen().forEach
(
({"stelle": stelle, "aktor": aktor}) =>
{
let manifestation_feld : klasse_manifestation<mod_vtm_aufbau.schnittstelle_aktor, mod_vtm_helfer.schnittstelle_xmlknoten> = new klasse_svg_aktor(aktor, stelle);
let knoten_feld : mod_vtm_helfer.schnittstelle_xmlknoten = manifestation_feld.darstellen();
kinder_felder.push(knoten_feld);
}
)
;
let knoten_felder : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal
(
"g",
{
"class": "felder",
},
kinder_felder
)
);
kinder_welt.push(knoten_felder);
}
// Figur
{
let figur_ : schnittstelle_fehlermonade<mod_vtm_aufbau.klasse_figur> = this.aufbau.figur_lesen();
if (figur_.ist_schlicht())
{
let figur : mod_vtm_aufbau.klasse_figur = figur_.lesen();
let manifestation_figur : klasse_manifestation<mod_vtm_aufbau.klasse_figur, mod_vtm_helfer.schnittstelle_xmlknoten> = (new klasse_svg_figur(figur));
let knoten_figur : mod_vtm_helfer.schnittstelle_xmlknoten = manifestation_figur.darstellen();
kinder_welt.push(knoten_figur);
}
else
{
// nichts tun
}
}
let knoten_welt : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal
(
"g",
{
"class": "welt",
},
kinder_welt
)
);
kinder_partie.push(knoten_welt);
}
let knoten_partie : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal
(
"g",
{
"class": "partie",
},
kinder_partie
)
);
return knoten_partie;
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public binden() : void
{
}
}
}