using DTLib.Dtsod; using DTLib.Filesystem; using System.Collections.Generic; using static DTLib.PublicLog; namespace DTLib.ConsoleGUI { public class Container : List, IDrawable { public (ushort x, ushort y) AnchorPoint { get; set; } public ushort Width { get; set; } public ushort Height { get; set; } public char[] Textmap { get; private set; } public char[] Colormap { get; private set; } public string Name { get; private set; } public Container(string name, string layout_file) { Name=name; ParseLayoutFile(layout_file); } void ParseLayoutFile(string layout_file) { DtsodV23 layout = new(File.ReadAllText(layout_file)); AnchorPoint=(layout[Name]["anchor"][0], layout[Name]["anchor"][1]); Width=layout[Name]["width"]; Height=layout[Name]["height"]; foreach(string element_name in layout[Name]["children"].Keys) { switch(layout[Name]["children"][element_name]["type"]) { case "label": Add(new Label(element_name, layout[Name]["children"][element_name]["resdir"]+$"\\{element_name}.textmap", layout[Name]["children"][element_name]["resdir"]+$"\\{element_name}.colormap") { AnchorPoint=(layout[Name]["children"][element_name]["anchor"][0], layout[Name]["children"][element_name]["anchor"][1]) }); break; } } } public void GenTextmap() { Textmap=new char[Width*Height]; for(int i = 0; i