少年修仙传客户端基础资源
dabaoji
2025-06-04 34d28a982a741d63f183884881b0bea73f8c8b47
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
61
62
63
64
65
66
67
68
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
 
namespace Poco
{
    public class AbstractDumper : IDumper
    {
        public virtual AbstractNode getRoot()
        {
            return null;
        }
 
        public Dictionary<string, object> dumpHierarchy()
        {
            return dumpHierarchyImpl(getRoot(), true);
        }
        public Dictionary<string, object> dumpHierarchy(bool onlyVisibleNode)
        {
            return dumpHierarchyImpl(getRoot(), onlyVisibleNode);
        }
 
        private Dictionary<string, object> dumpHierarchyImpl(AbstractNode node, bool onlyVisibleNode)
        {
            if (node == null)
            {
                return null;
            }
 
            Dictionary<string, object> payload = node.enumerateAttrs();
            Dictionary<string, object> result = new Dictionary<string, object>();
            string name = (string)node.getAttr("name");
            result.Add("name", name);
            result.Add("payload", payload);
 
            List<object> children = new List<object>();
            foreach (AbstractNode child in node.getChildren())
            {
                if (!onlyVisibleNode || (bool)child.getAttr("visible"))
                {
                    children.Add(dumpHierarchyImpl(child, onlyVisibleNode));
                }
            }
            if (children.Count > 0)
            {
                result.Add("children", children);
            }
            return result;
        }
 
        public virtual List<float> getPortSize()
        {
            return null;
        }
    }
 
    public interface IDumper
    {
        AbstractNode getRoot();
 
        Dictionary<string, object> dumpHierarchy();
        Dictionary<string, object> dumpHierarchy(bool onlyVisibleNode);
 
        List<float> getPortSize();
    }
}