예제 #1
0
        /// <summary>
        /// 创建战绩Item
        /// </summary>
        /// <param name="info"></param>
        private void CreateRecordListsItem(Record info, int index)
        {
            var view = ComponentFactory.CreateWithParent <UIRecordItem>(this);

            view.InitData();
            view.SetRecordItemData(_Content.transform, info, index);
            _RecordLists.Add(view);
        }
예제 #2
0
        /// <summary>
        /// 请求排行榜
        /// </summary>
        private void CreateRrankListsItem(UserInfo info, int type)
        {
            var view = ComponentFactory.CreateWithParent <UIRankListsItem>(this);

            view.InitData();
            view.SetRankItemData(_rankContent, RankingList.Count + 1, info, type);
            RankingList.Add(view);
        }
예제 #3
0
        public DDZPokerItem Create(int index, Component parent)
        {
            DDZPokerItem item = ComponentFactory.CreateWithParent <DDZPokerItem>(parent);

            item.index = index;

            item.AddComponent <DDZPokerItemUIComponent>();

            return(item);
        }
예제 #4
0
        public DDZGamer Create(long userId, int seatId, Component parent)
        {
            DDZGamer gamer = ComponentFactory.CreateWithParent <DDZGamer>(parent);

            gamer.UserID = userId;

            gamer.SeatID = seatId;

            gamer.AddComponent <DDZGamerUIComponent>();

            return(gamer);
        }
예제 #5
0
        public static SubGame Create(long GameID, int Index, Component parent)
        {
            SubGame subGame = ComponentFactory.CreateWithParent <SubGame>(parent);

            subGame.GameID = GameID;

            subGame.Index = Index;

            subGame.AddComponent <SubGameComponent>();

            return(subGame);
        }
예제 #6
0
파일: Entity.cs 프로젝트: yhr28/ET
        public virtual Component AddComponent(Type type)
        {
            if (this.componentDict.ContainsKey(type))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {type.Name}");
            }

            Component component = ComponentFactory.CreateWithParent(type, this, this.IsFromPool);

            this.componentDict.Add(type, component);
            return(component);
        }
예제 #7
0
파일: Entity.cs 프로젝트: yhr28/ET
        public virtual K AddComponent <K, P1>(P1 p1) where K : Component, new()
        {
            Type type = typeof(K);

            if (this.componentDict.ContainsKey(type))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {typeof(K).Name}");
            }

            K component = ComponentFactory.CreateWithParent <K, P1>(this, p1, this.IsFromPool);

            this.componentDict.Add(type, component);
            return(component);
        }
예제 #8
0
        /// <summary>
        /// 在动态状态池中获取某个状态,如果不存在,就在末尾添加一个
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public T Get <T>() where T : BaseState
        {
            for (int i = 0; i < dynamicStates.Count; i++)
            {
                if (this.dynamicStates[i] is T)
                {
                    return(this.dynamicStates[i] as T);
                }
            }

            T t = ComponentFactory.CreateWithParent <T>(this);

            this.dynamicStates.Add(t);
            return(t);
        }
예제 #9
0
        /// <summary>
        /// 创建Item  type=1 公告,type=2 邮件
        /// </summary>
        /// <param name="info"></param>
        private void CreateRecordListsItem(AnnounceInfo info, MailInfo mail, int type)
        {
            var view = ComponentFactory.CreateWithParent <UINoticeListItem>(this);

            view.InitData();
            if (type == 1)
            {
                view.SetRecordItemData(Content.transform, info, null, this);
            }
            else
            {
                view.SetRecordItemData(Content.transform, null, mail, this);
            }
            _RecordLists.Add(view);
        }
예제 #10
0
        public Component AddComponent(Type type)
        {
            Component component = ComponentFactory.CreateWithParent(type, this);

            if (this.componentDict.ContainsKey(component.GetType()))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {type.Name}");
            }

            if (component is ISerializeToEntity)
            {
                this.components.Add(component);
            }
            this.componentDict.Add(component.GetType(), component);
            return(component);
        }
예제 #11
0
파일: Entity.cs 프로젝트: spadd/ET_Tank
        public Component AddComponent <P1, P2, P3>(Type type, P1 p1, P2 p2, P3 p3)
        {
            if (this.componentDict.ContainsKey(type))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {type.Name}");
            }

            Component component = ComponentFactory.CreateWithParent(type, this, p1, p2, p3);

            if (component is ISerializeToEntity)
            {
                this.components.Add(component);
            }
            this.componentDict.Add(type, component);
            return(component);
        }
예제 #12
0
        public K AddComponent <K, P1>(P1 p1) where K : Component, new()
        {
            K component = ComponentFactory.CreateWithParent <K, P1>(this, p1);

            if (this.componentDict.ContainsKey(component.GetType()))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {typeof(K).Name}");
            }

            if (component is ISerializeToEntity)
            {
                this.components.Add(component);
            }
            this.componentDict.Add(component.GetType(), component);
            return(component);
        }
예제 #13
0
        public K AddComponent <K>() where K : Component, new()
        {
            Type type = typeof(K);

            if (this.componentDict.ContainsKey(type))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {typeof(K).Name}");
            }

            K component = ComponentFactory.CreateWithParent <K>(this);

            if (component is ISerializeToEntity)
            {
                this.components.Add(component);
            }
            this.componentDict.Add(type, component);
            return(component);
        }
예제 #14
0
        public virtual K AddComponent <K, P1, P2, P3>(P1 p1, P2 p2, P3 p3) where K : Component, new()
        {
            Type type = typeof(K);

            if (this.componentDict.ContainsKey(type))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {typeof(K).Name}");
            }

            K component = ComponentFactory.CreateWithParent <K, P1, P2, P3>(this, p1, p2, p3, this.IsFromPool);

            this.componentDict.Add(type, component);

            if (component is ISerializeToEntity)
            {
                this.components.Add(component);
            }

            return(component);
        }
예제 #15
0
        public virtual Component AddComponent(Type type)
        {
            if (this.componentDict.ContainsKey(type))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {type.Name}");
            }

            //创建组件 并且设置父物体为该实体
            //CreateWithParent 内部就调用了Awake方法
            Component component = ComponentFactory.CreateWithParent(type, this, this.IsFromPool);

            //缓存到字典中
            this.componentDict.Add(type, component);

            //如果是可以序列化的 缓存到哈希表中
            if (component is ISerializeToEntity)
            {
                this.components.Add(component);
            }

            return(component);
        }
예제 #16
0
파일: UIHelper.cs 프로젝트: 517752548/EXET
 public static UIBase Create <T>(string UIName, GameObject uiGameObject, params object[] objs) where T : UIBaseComponent, new()
 {
     try
     {
         GameObject gameObject = UnityEngine.Object.Instantiate(uiGameObject);
         UIBase     ui         = ComponentFactory.CreateWithParent <UIBase, string, GameObject>(Game.Scene.GetComponent <UIManagerComponent>(), UIName, gameObject);
         ui.paras  = objs;
         ui.UIGuid = System.Guid.NewGuid().ToString();
         RectTransform uirecttransform = ui.GameObject.GetComponent <RectTransform>();
         uirecttransform.anchorMax          = Vector2.one;
         uirecttransform.pivot              = Vector2.one * 0.5f;
         ui.GameObject.transform.localScale = Vector3.one;
         uirecttransform.offsetMax          = Vector2.zero;
         uirecttransform.offsetMin          = Vector2.zero;
         ui.AddComponent <T>().Init(gameObject);
         return(ui);
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(null);
     }
 }
예제 #17
0
        public void AddCommonState <T>() where T : BaseState
        {
            T t = ComponentFactory.CreateWithParent <T>(this);

            this.commonStates.Add(t);
        }
예제 #18
0
 public void Start()
 {
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _accountInput);
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _passwordInput);
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _captchaInput);
 }
예제 #19
0
 public void Start()
 {
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, accoutIF);
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, passIF);
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, repeatIF);
 }
예제 #20
0
 public void Start()
 {
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _oldPwdInput);
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _newPwdInput);
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _confirmPwdInput);
 }
예제 #21
0
 public void Start()
 {
     ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _changeNameInput);
 }