using System; using System.Collections.Generic; using UnityEngine; namespace Poco { public class AbstractNode { private List requiredAttrs = new List { "name", "type", "visible", "pos", "size", "scale", "anchorPoint", "zOrders" }; public virtual AbstractNode getParent () { return null; } public virtual List getChildren () { return null; } public virtual object getAttr (string attrName) { Dictionary defaultAttrs = new Dictionary () { { "name", "" }, { "type", "Root" }, { "visible", true }, { "pos", new List (){ 0.0f, 0.0f } }, { "size", new List (){ 0.0f, 0.0f } }, { "scale", new List (){ 1.0f, 1.0f } }, { "anchorPoint", new List (){ 0.5f, 0.5f } }, { "zOrders", new Dictionary (){ { "local", 0 }, { "global", 0 } } } }; return defaultAttrs.ContainsKey (attrName) ? defaultAttrs [attrName] : null; } public virtual void setAttr (string attrName, object val) { } public virtual Dictionary enumerateAttrs () { Dictionary ret = new Dictionary (); foreach (string attr in requiredAttrs) { ret.Add (attr, getAttr (attr)); } return ret; } } }