Beispiel #1
0
 public Node(T data, rdtGuiTree <T> .Node parent)
 {
     this.Enabled  = true;
     this.Parent   = parent;
     this.Data     = data;
     this.Children = new List <rdtGuiTree <T> .Node>();
 }
 private void OnTreeSelectionChanged(rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node prevSelection, rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node newSelection)
 {
     this.m_clearFocus = true;
     if (this.m_client != null)
     {
         rdtTcpMessageGetComponents message = new rdtTcpMessageGetComponents();
         message.m_instanceId = 0;
         this.m_client.EnqueueMessage(message);
     }
     this.m_selected = null;
     if (newSelection != null)
     {
         this.m_selected = new rdtTcpMessageGameObjects.Gob?(newSelection.Data);
     }
     if (!this.m_selected.HasValue)
     {
         this.m_pendingExpandComponent = null;
         this.m_components             = null;
     }
     else if (this.m_client != null)
     {
         rdtTcpMessageGetComponents components2 = new rdtTcpMessageGetComponents();
         components2.m_instanceId = this.m_selected.Value.m_instanceId;
         this.m_client.EnqueueMessage(components2);
     }
     base.Repaint();
 }
Beispiel #3
0
            public rdtGuiTree <T> .Node AddNode(T data, [Optional, DefaultParameterValue(true)] bool enabled)
            {
                rdtGuiTree <T> .Node item = new rdtGuiTree <T> .Node(data, (rdtGuiTree <T> .Node) this);

                item.Enabled = enabled;
                this.Children.Add(item);
                return(item);
            }
 public ConnectionWindow()
 {
     base.minSize = new Vector2(400f, 100f);
     this.m_split = new rdtGuiSplit(200f, 100f, this);
     this.m_tree  = new rdtGuiTree <rdtTcpMessageGameObjects.Gob>();
     this.m_tree.SelectionChanged          += new Action <rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node, rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node>(this.OnTreeSelectionChanged);
     this.m_serversMenu                     = new rdtServersMenu(new Action <rdtServerAddress>(this.OnServerSelected));
     EditorApplication.playmodeStateChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.playmodeStateChanged, new EditorApplication.CallbackFunction(this.OnPlaymodeStateChanged));
 }
 private void AddChildren(rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node parentNode, List <rdtTcpMessageGameObjects.Gob> nonRoots)
 {
     for (int i = 0; i < nonRoots.Count; i++)
     {
         rdtTcpMessageGameObjects.Gob data = nonRoots[i];
         if (data.m_parentInstanceId == parentNode.Data.m_instanceId)
         {
             rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node node = parentNode.AddNode(data, data.m_enabled);
             this.AddChildren(node, nonRoots);
         }
     }
 }
        private void BuildTree()
        {
            List <rdtTcpMessageGameObjects.Gob> list = Enumerable.ToList <rdtTcpMessageGameObjects.Gob>(Enumerable.Where <rdtTcpMessageGameObjects.Gob>(this.m_gameObjects, delegate(rdtTcpMessageGameObjects.Gob x) {
                return(!x.m_hasParent);
            }));
            List <rdtTcpMessageGameObjects.Gob> nonRoots = Enumerable.ToList <rdtTcpMessageGameObjects.Gob>(Enumerable.Where <rdtTcpMessageGameObjects.Gob>(this.m_gameObjects, delegate(rdtTcpMessageGameObjects.Gob x) {
                return(x.m_hasParent);
            }));

            for (int i = 0; i < list.Count; i++)
            {
                rdtTcpMessageGameObjects.Gob data = list[i];
                rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node parentNode = this.m_tree.AddNode(data, data.m_enabled);
                this.AddChildren(parentNode, nonRoots);
            }
        }
        private void DrawGameObjectTitle()
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            bool flag = EditorGUILayout.ToggleLeft("Enabled", this.m_components.Value.m_enabled, new GUILayoutOption[0]);

            if (flag != this.m_components.Value.m_enabled)
            {
                rdtTcpMessageComponents components = this.m_components.Value;
                components.m_enabled = flag;
                this.m_components    = new rdtTcpMessageComponents?(components);
                rdtGuiTree <rdtTcpMessageGameObjects.Gob> .Node node = this.m_tree.FindNode(this.m_selected.Value);
                if (node != null)
                {
                    node.Enabled = flag;
                }
                this.OnGameObjectChanged();
            }
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.LabelField("Tag", new GUILayoutOption[] { GUILayout.Width(30f) });
            string str = EditorGUILayout.TagField(GUIContent.none, this.m_components.Value.m_tag, new GUILayoutOption[] { GUILayout.MinWidth(50f) });

            if (str != this.m_components.Value.m_tag)
            {
                rdtTcpMessageComponents components2 = this.m_components.Value;
                components2.m_tag = str;
                this.m_components = new rdtTcpMessageComponents?(components2);
                this.OnGameObjectChanged();
            }
            EditorGUILayout.LabelField("Layer", new GUILayoutOption[] { GUILayout.Width(40f) });
            int num = EditorGUILayout.LayerField(GUIContent.none, this.m_components.Value.m_layer, new GUILayoutOption[] { GUILayout.MinWidth(50f) });

            if (num != this.m_components.Value.m_layer)
            {
                rdtTcpMessageComponents components3 = this.m_components.Value;
                components3.m_layer = num;
                this.m_components   = new rdtTcpMessageComponents?(components3);
                this.OnGameObjectChanged();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }