Example #1
0
        public ObjectPool()
        {
#if !SERVER
            this.ViewGO       = new GameObject();
            this.ViewGO.name  = this.GetType().Name;
            this.ViewGO.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
            this.ViewGO.transform.SetParent(Global.transform, false);
            this.ViewGO.AddComponent <ComponentView>().Component = this;
#endif
        }
Example #2
0
        public ComponentQueue(string typeName)
        {
            this.Id       = IdGenerater.GenerateId();
            this.TypeName = typeName;
#if !SERVER
            this.ViewGO       = new GameObject();
            this.ViewGO.name  = this.GetType().Name;
            this.ViewGO.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
            this.ViewGO.transform.SetParent(Global.transform, false);
            this.ViewGO.AddComponent <ComponentView>().Component = this;
#endif
        }
Example #3
0
        protected Component()
        {
            this.InstanceId = IdGenerater.GenerateId();
#if !SERVER
            if (!this.GetType().IsDefined(typeof(HideInHierarchy), true))
            {
                this.GameObject       = new GameObject();
                this.GameObject.name  = this.GetType().Name;
                this.GameObject.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
                this.GameObject.AddComponent <ComponentView>().Component = this;
            }
#endif
        }
Example #4
0
        protected Entity()
        {
            this.InstanceId = IdGenerater.GenerateId();

#if !SERVER
            if (!this.GetType().IsDefined(typeof(HideInHierarchy), true))
            {
                this.ViewGO       = new GameObject();
                this.ViewGO.name  = this.GetType().Name;
                this.ViewGO.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
                this.ViewGO.transform.SetParent(Global.transform, false);
                this.ViewGO.AddComponent <ComponentView>().Component = this;
            }
#endif
        }
        //构造函数
        protected Component()
        {
            this.InstanceId = IdGenerater.GenerateInstanceId();
#if !SERVER
            //如果不是标记了隐藏的特性,那么不在Hierarchy面板中隐藏,并且要求是继承的对象
            if (!this.GetType().IsDefined(typeof(HideInHierarchy), true))
            {
                this.GameObject      = new GameObject();
                this.GameObject.name = this.GetType().Name;
                //层级设置为隐藏的"Hidden"
                this.GameObject.layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
                this.GameObject.transform.SetParent(Global.transform, false);
                //组件视图?
                this.GameObject.AddComponent <ComponentView>().Component = this;
            }
#endif
        }
Example #6
0
        /// <summary>
        /// 创建UI层级
        /// </summary>
        private void GenerateLayers()
        {
            layers[HierarchyNames.HIDDEN] = new GameObject(HierarchyNames.HIDDEN);
            layers[HierarchyNames.HIDDEN].transform.SetParent(GameObject.transform);
            layers[HierarchyNames.HIDDEN].layer = LayerNames.GetLayerInt(LayerNames.HIDDEN);
            layers[HierarchyNames.HIDDEN].SetActive(false);

            layers[HierarchyNames.BOTTOM] = new GameObject(HierarchyNames.BOTTOM);
            layers[HierarchyNames.BOTTOM].transform.SetParent(GameObject.transform);
            layers[HierarchyNames.BOTTOM].layer = LayerNames.GetLayerInt(LayerNames.UI);

            layers[HierarchyNames.MEDIUM] = new GameObject(HierarchyNames.MEDIUM);
            layers[HierarchyNames.MEDIUM].transform.SetParent(GameObject.transform);
            layers[HierarchyNames.MEDIUM].layer = LayerNames.GetLayerInt(LayerNames.UI);

            layers[HierarchyNames.TOP] = new GameObject(HierarchyNames.TOP);
            layers[HierarchyNames.TOP].transform.SetParent(GameObject.transform);
            layers[HierarchyNames.TOP].layer = LayerNames.GetLayerInt(LayerNames.UI);

            layers[HierarchyNames.TOPMOST] = new GameObject(HierarchyNames.TOPMOST);
            layers[HierarchyNames.TOPMOST].transform.SetParent(GameObject.transform);
            layers[HierarchyNames.TOPMOST].layer = LayerNames.GetLayerInt(LayerNames.UI);
        }