1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| using System;
| using System.Collections.Generic;
| using UnityEngine;
|
|
| namespace Poco
| {
| public class AbstractNode
| {
| private List<string> requiredAttrs = new List<string> {
| "name",
| "type",
| "visible",
| "pos",
| "size",
| "scale",
| "anchorPoint",
| "zOrders"
| };
|
| public virtual AbstractNode getParent ()
| {
| return null;
| }
|
| public virtual List<AbstractNode> getChildren ()
| {
| return null;
| }
|
| public virtual object getAttr (string attrName)
| {
| Dictionary<string, object> defaultAttrs = new Dictionary<string, object> () {
| { "name", "<Root>" },
| { "type", "Root" },
| { "visible", true },
| { "pos", new List<float> (){ 0.0f, 0.0f } },
| { "size", new List<float> (){ 0.0f, 0.0f } },
| { "scale", new List<float> (){ 1.0f, 1.0f } },
| { "anchorPoint", new List<float> (){ 0.5f, 0.5f } },
| { "zOrders", new Dictionary<string, object> (){ { "local", 0 }, { "global", 0 } } }
| };
| return defaultAttrs.ContainsKey (attrName) ? defaultAttrs [attrName] : null;
| }
|
| public virtual void setAttr (string attrName, object val)
| {
|
| }
|
| public virtual Dictionary<string, object> enumerateAttrs ()
| {
| Dictionary<string, object> ret = new Dictionary<string, object> ();
| foreach (string attr in requiredAttrs) {
| ret.Add (attr, getAttr (attr));
| }
| return ret;
| }
| }
| }
|
|