Ejemplo n.º 1
0
    void SetNodeValue(object owner, string path, DbgNodeValue value, object refValue = null)
    {
        DbgObjectData data = GetOrAddData(owner);

        DbgNode node = GetNode(data, path);

        if (node == null)
        {
            node = AddNode(data, path);
            data.lookup[path] = node;
        }

        node.value    = value;
        node.refValue = refValue;
    }
Ejemplo n.º 2
0
    void DrawNode(DbgNode node, int indent)
    {
        GUILayout.BeginHorizontal();

        GUILayout.Space(30.0f * (float)indent);

        GUILayout.Label(node.name, GUILayout.Width(200.0f));

        switch (node.value.kind)
        {
        case DbgValueKind.Object:
            GUILayout.Label(node.refValue == null ? "<null>" : node.refValue.ToString());
            break;

        case DbgValueKind.Int:
            GUILayout.Label(node.value.intValue.ToString());
            break;

        case DbgValueKind.Float:
            GUILayout.Label(node.value.floatValue.ToString("0.000"));
            break;

        case DbgValueKind.Bool:
            GUILayout.Toggle(node.value.boolValue, "");
            break;

        case DbgValueKind.Vec2:
            GUILayout.Label(node.value.vec2Value.ToString());
            break;

        case DbgValueKind.Vec3:
            GUILayout.Label(node.value.vec3Value.ToString());
            break;

        case DbgValueKind.Quat:
            Vector3 euler = node.value.quatValue.eulerAngles;
            GUILayout.Label(euler.ToString());
            break;
        }
        GUILayout.EndHorizontal();

        for (int i = 0; i < node.children.Count; i++)
        {
            DbgNode child = node.children[i];
            DrawNode(child, indent + 1);
        }
    }
Ejemplo n.º 3
0
    DbgNode GetOrAdd(string pathComp, List <DbgNode> nodes)
    {
        DbgNode node;

        for (int i = 0; i < nodes.Count; i++)
        {
            node = nodes[i];
            if (node.name == pathComp)
            {
                return(node);
            }
        }

        node = new DbgNode(pathComp);
        nodes.Add(node);
        return(node);
    }
Ejemplo n.º 4
0
    DbgNode AddNode(DbgObjectData data, string path)
    {
        string[] comps = path.Split('.');

        int            compIndex = 0;
        List <DbgNode> nodes     = data.roots;
        DbgNode        node      = null;

        while (compIndex < comps.Length)
        {
            string comp = comps[compIndex];
            node  = GetOrAdd(comp, nodes);
            nodes = node.children;
            ++compIndex;
        }

        return(node);
    }
Ejemplo n.º 5
0
    void ClearNode(object owner, string path)
    {
        DbgObjectData data = GetData(owner);

        if (data == null)
        {
            return;
        }

        DbgNode node = GetNode(data, path);

        if (node == null)
        {
            return;
        }

        node.value    = default(DbgNodeValue);
        node.refValue = null;
        data.lookup.Remove(path);
    }
Ejemplo n.º 6
0
    public void SystemOnGUI()
    {
        foreach (var kvp in nodes)
        {
            object        owner = kvp.Key;
            DbgObjectData data  = kvp.Value;

            var ueOwner = owner as UE.Object;
            if (ueOwner != null)
            {
                GUILayout.Label(GarbageCache.GetName(ueOwner));
            }
            else
            {
                GUILayout.Label(owner.ToString());
            }

            for (int i = 0; i < data.roots.Count; i++)
            {
                DbgNode node = data.roots[i];
                DrawNode(node, indent: 1);
            }
        }
    }