Преглед изворни кода

去掉Entity可视化,没啥作用,项目大了跑起来还很卡

tanghai пре 4 година
родитељ
комит
cfd62e4e07

+ 0 - 6
Unity/Assets/Model/Core/Entity/Scene.cs

@@ -86,12 +86,6 @@
 
                 this.parent = value;
                 this.parent.Children.Add(this.Id, this);
-#if UNITY_EDITOR && VIEWGO
-                if (this.ViewGO != null)
-                {
-                    this.ViewGO.transform.SetParent(this.parent.ViewGO.transform, false);
-                }
-#endif
             }
         }
     }

+ 0 - 11
Unity/Assets/Model/Core/Object/Entity.cs

@@ -1,11 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Runtime.Serialization;
-using MongoDB.Bson;
 using MongoDB.Bson.Serialization.Attributes;
-#if !SERVER
-
-#endif
 
 namespace ET
 {
@@ -196,13 +192,6 @@ namespace ET
         private void AfterSetParent()
         {
             this.Domain = this.parent.domain;
-
-#if UNITY_EDITOR && VIEWGO
-            if (this.ViewGO != null && this.parent.ViewGO != null)
-            {
-                this.ViewGO.transform.SetParent(this.parent.ViewGO.transform, false);
-            }
-#endif
         }
 
         public T GetParent<T>() where T : Entity

+ 0 - 37
Unity/Assets/Model/Core/Object/Object.cs

@@ -1,41 +1,10 @@
 using System;
 using System.ComponentModel;
-using MongoDB.Bson.IO;
-using MongoDB.Bson.Serialization.Attributes;
-using ProtoBuf;
-#if !SERVER
-using UnityEngine;
-
-#endif
 
 namespace ET
 {
     public abstract class Object: ISupportInitialize, IDisposable
     {
-#if UNITY_EDITOR && VIEWGO
-        public static GameObject Global => GameObject.Find("/Global");
-
-        [BsonIgnore]
-        public GameObject ViewGO
-        {
-            get;
-        }
-#endif
-
-        public Object()
-        {
-#if UNITY_EDITOR && VIEWGO
-            if (!this.GetType().IsDefined(typeof (HideInHierarchy), true) && Log.NeedLog)
-            {
-                this.ViewGO = new GameObject();
-                this.ViewGO.name = this.GetType().Name;
-                this.ViewGO.layer = LayerMask.NameToLayer("Hidden");
-                this.ViewGO.transform.SetParent(Global.transform, false);
-                this.ViewGO.AddComponent<ComponentView>().Component = this;
-            }
-#endif
-        }
-
         public virtual void BeginInit()
         {
         }
@@ -46,12 +15,6 @@ namespace ET
 
         public virtual void Dispose()
         {
-#if UNITY_EDITOR && VIEWGO
-            if (this.ViewGO != null)
-            {
-                UnityEngine.Object.Destroy(this.ViewGO);
-            }
-#endif
         }
         
         public override string ToString()

+ 0 - 15
Unity/Assets/Model/Core/Object/ObjectPool.cs

@@ -97,23 +97,8 @@ namespace ET
             if (!this.dictionary.TryGetValue(type, out queue))
             {
                 queue = new ComponentQueue(type.Name);
-
-#if UNITY_EDITOR && VIEWGO
-                if (queue.ViewGO != null)
-                {
-                    queue.ViewGO.transform.SetParent(this.ViewGO.transform);
-                    queue.ViewGO.name = $"{type.Name}s";
-                }
-#endif
                 this.dictionary.Add(type, queue);
             }
-
-#if UNITY_EDITOR && VIEWGO
-            if (obj.ViewGO != null)
-            {
-                obj.ViewGO.transform.SetParent(queue.ViewGO.transform);
-            }
-#endif
             queue.Enqueue(obj);
         }