public SubClass(ParseBlock Block) : this() { Dictionary <string, object> D = Block.BreakToDictionary <object>(); foreach (var KV in D) { _DefinedAttributes.Add(KV.Key); switch (KV.Key) { default: Add(KV.Key, KV.Value); break; } } }
public void ReadBlock(ParseBlock Block) { Block.AddParser <Color>("color", i => ClassLibrary.Instance.ParseColor(i.String), false); Block.AddParser <List <Color> >("color[]", i => ClassLibrary.Instance.ParseColors(i.String), false); Block.AddParser <Dictionary <string, Color> >("color<>", i => i.BreakToDictionary <Color>(), false); Block.AddParser <Vector2f>("vector2f", i => ClassLibrary.Instance.ParseVector2f(i.String), false); Block.AddParser <Vector2f[]>("vector2f[]", i => ClassLibrary.Instance.ParseVector2fs(i.String), false); Block.AddParser <Font>("font", i => ClassLibrary.Instance.ParseFont(i.String)); Block.AddParser <Sound>("sound", i => ClassLibrary.Instance.ParseSound(i.String)); Block.AddParser <Texture>("texture", i => ClassLibrary.Instance.ParseTexture(i.String)); Block.AddParser <Class>("class", i => new Class(i)); Block.AddParser <SubClass>("mode", i => new SubClass(i)); _Classes = (Dictionary <string, Class>)Block.BreakToDictionary <object>(true)["classes"]; }
public Class(ParseBlock Block) : this() { _Name = Block.Name; Dictionary <string, object> D = Block.BreakToDictionary <object>(); if (D.ContainsKey("parent")) { Inherit((Class)D["parent"]); D.Remove("parent"); } if (D.ContainsKey("default")) { SubClass newDefault = ((SubClass)D["default"]).Combine(_SubClasses[(int)Mode.None]); for (int i = 0; i < _SubClasses.Length; ++i) { _SubClasses[i] = ((SubClass)D["default"]).Combine(_SubClasses[i]); } D.Remove("default"); } if (D.ContainsKey("fade")) { _IncrementedAttributes = (List <string>)D["fade"]; D.Remove("fade"); } foreach (var KV in D) { SubClass newClass = ((SubClass)KV.Value).Combine(_SubClasses[(int)Mode.None]); switch (KV.Key) { case "hover": _SubClasses[(int)Mode.Hover] = newClass; break; case "focus": _SubClasses[(int)Mode.Focus] = newClass; break; case "selected": _SubClasses[(int)Mode.Selected] = newClass; break; case "disabled": _SubClasses[(int)Mode.Disabled] = newClass; break; case "selected-hover": _SubClasses[(int)Mode.SelectedHover] = newClass; break; case "selected-disabled": _SubClasses[(int)Mode.SelectedDisabled] = newClass; break; } } }