/// <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); }
/// <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); }
public DDZPokerItem Create(int index, Component parent) { DDZPokerItem item = ComponentFactory.CreateWithParent <DDZPokerItem>(parent); item.index = index; item.AddComponent <DDZPokerItemUIComponent>(); return(item); }
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); }
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); }
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); }
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); }
/// <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); }
/// <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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); } }
public void AddCommonState <T>() where T : BaseState { T t = ComponentFactory.CreateWithParent <T>(this); this.commonStates.Add(t); }
public void Start() { ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _accountInput); ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _passwordInput); ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _captchaInput); }
public void Start() { ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, accoutIF); ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, passIF); ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, repeatIF); }
public void Start() { ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _oldPwdInput); ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _newPwdInput); ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _confirmPwdInput); }
public void Start() { ComponentFactory.CreateWithParent <MobileInputFieldAdaptionCpt, InputField>(this, _changeNameInput); }