Пример #1
0
 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();
 }
Пример #2
0
        private void Update()
        {
            if ((EditorApplication.isCompiling && (this.m_client != null)) && this.m_client.IsConnected)
            {
                this.Disconnect(false);
            }
            if (!this.m_running)
            {
                this.OnUnityReloadedAssemblies();
            }
            double timeSinceStartup = EditorApplication.timeSinceStartup;
            double delta            = timeSinceStartup - this.m_lastTime;

            this.m_lastTime = timeSinceStartup;
            this.UpdateServers(delta);
            if (this.m_serverEnum.Stopped)
            {
                this.m_serverEnum = new rdtClientEnumerateServers();
            }
            this.m_tree.Update();
            if (this.m_client != null)
            {
                bool isConnected  = this.m_client.IsConnected;
                bool isConnecting = this.m_client.IsConnecting;
                this.m_client.Update(delta);
                if ((this.m_client.IsConnected != isConnected) || ((!this.m_client.IsConnected && !this.m_client.IsConnecting) && isConnecting))
                {
                    this.OnConnectionStatusChanged();
                }
                this.m_gameObjectRefreshTimer -= delta;
                if (this.m_gameObjectRefreshTimer <= 0.0)
                {
                    this.m_client.EnqueueMessage(new rdtTcpMessageGetGameObjects());
                    this.m_gameObjectRefreshTimer = rdtSettings.GAMEOBJECT_UPDATE_TIME;
                }
                if (this.m_selected.HasValue)
                {
                    this.m_componentRefreshTimer -= delta;
                    if (this.m_componentRefreshTimer <= 0.0)
                    {
                        rdtTcpMessageGetComponents message = new rdtTcpMessageGetComponents();
                        message.m_instanceId = this.m_selected.Value.m_instanceId;
                        this.m_client.EnqueueMessage(message);
                        this.m_componentRefreshTimer = rdtSettings.COMPONENT_UPDATE_TIME;
                    }
                }
            }
        }
Пример #3
0
        private void OnRequestGameObjectComponents(rdtTcpMessage message)
        {
            rdtTcpMessageGetComponents components = (rdtTcpMessageGetComponents)message;

            if (components.m_instanceId != 0)
            {
                GameObject obj2 = this.FindGameObject(components.m_instanceId);
                if (obj2 != null)
                {
                    rdtTcpMessageComponents components2 = new rdtTcpMessageComponents();
                    components2.m_instanceId = components.m_instanceId;
                    components2.m_components = new List <rdtTcpMessageComponents.Component>();
                    components2.m_layer      = obj2.layer;
                    components2.m_tag        = obj2.tag;
                    components2.m_enabled    = obj2.activeSelf;
                    this.m_components.Clear();
                    obj2.GetComponents <UnityEngine.Component>(this.m_unityComponents);
                    if (this.m_unityComponents.Count > this.m_components.Capacity)
                    {
                        this.m_components.Capacity = this.m_unityComponents.Count;
                    }
                    for (int i = 0; i < this.m_unityComponents.Count; i++)
                    {
                        UnityEngine.Component owner = this.m_unityComponents[i];
                        if (owner == null)
                        {
                            rdtDebug.Debug(this, "Component is null, skipping", new object[0]);
                        }
                        else
                        {
                            List <rdtTcpMessageComponents.Property> list = this.m_server.SerializerRegistry.ReadAllFields(owner);
                            if (list == null)
                            {
                                rdtDebug.Debug(this, "Properties are null, skipping", new object[0]);
                            }
                            else
                            {
                                rdtTcpMessageComponents.Component item = new rdtTcpMessageComponents.Component();
                                if (owner is Behaviour)
                                {
                                    item.m_canBeDisabled = true;
                                    item.m_enabled       = ((Behaviour)owner).enabled;
                                }
                                else if (owner is Renderer)
                                {
                                    item.m_canBeDisabled = true;
                                    item.m_enabled       = ((Renderer)owner).enabled;
                                }
                                else if (owner is Collider)
                                {
                                    item.m_canBeDisabled = true;
                                    item.m_enabled       = ((Collider)owner).enabled;
                                }
                                else
                                {
                                    item.m_canBeDisabled = false;
                                    item.m_enabled       = true;
                                }
                                System.Type type = owner.GetType();
                                item.m_name         = type.Name;
                                item.m_assemblyName = type.AssemblyQualifiedName;
                                item.m_instanceId   = owner.GetInstanceID();
                                item.m_properties   = list;
                                this.m_components.Add(item);
                            }
                        }
                    }
                    components2.m_components = this.m_components;
                    this.m_unityComponents.Clear();
                    this.m_server.EnqueueMessage(components2);
                }
            }
        }