private void buttonClick(ButtonScript obj, object args, int param1, int param2) { babyName = obj.name; MainBabyListCell lCell = obj.GetComponent <MainBabyListCell>(); if (curCell != null) { curCell.backSp.spriteName = "zd_chongwukuang"; } int[] ids = { GamePlayer.Instance.babies_list_[param1].InstId, GamePlayer.Instance.babies_list_[param1].GetIprop(PropertyType.PT_AssetId) }; CrtSelectIdx = param1; curCell = lCell; lCell.backSp.spriteName = "zd_chongwukuangxuanz"; if (asssid != ids[1]) { if (asssid != 0 && babyObj != null) { DestroyBaby((ENTITY_ID)asssid, true, babyObj); } } if (MainbabyState.babyInfo != null) { MainbabyState.babyInfo(ids); } MainbabyProperty.idss = ids; int uId = ids[0]; int asseId = ids[1]; asssid = asseId; GameManager.Instance.GetActorClone((ENTITY_ID)asseId, (ENTITY_ID)0, EntityType.ET_Baby, AssetLoadCallBack, new ParamData(uId, asseId), "UI"); HeadIconLoader.Instance.LoadIcon(BabyData.GetData(GamePlayer.Instance.GetBabyInst(ids[0]).GetIprop(PropertyType.PT_TableId))._RaceIcon, modelRace_); raceLabel.text = LanguageManager.instance.GetValue(BabyData.GetData(GamePlayer.Instance.GetBabyInst(ids[0]).GetIprop(PropertyType.PT_TableId))._RaceType.ToString()); if (!_icons.Contains(BabyData.GetData(GamePlayer.Instance.GetBabyInst(ids[0]).GetIprop(PropertyType.PT_TableId))._RaceIcon)) { _icons.Add(BabyData.GetData(GamePlayer.Instance.GetBabyInst(ids[0]).GetIprop(PropertyType.PT_TableId))._RaceIcon); } if (MainbabyProperty.BabyProperty != null) { MainbabyProperty.BabyProperty(uId); } if (MainbabyReductionUI.RefreshGrowingUpOk != null) { MainbabyReductionUI.RefreshGrowingUpOk(ids[0]); } if (Mainbabystrengthen.RefreshstrengthenOk != null) { Mainbabystrengthen.RefreshstrengthenOk(ids[0]); } if (MainbabyListUI.UpdateBabyMarkOnOk != null) { MainbabyListUI.UpdateBabyMarkOnOk(uId); } }
void NewBabyMakeOn() { for (int i = 0; i < itemsList.Count; i++) { MainBabyListCell mbCell = itemsList[i].GetComponent <MainBabyListCell>(); if (mbCell.BabyMainData.InstId == GamePlayer.newBabyId) { itemsList[i].GetComponent <UISprite>().MarkOn(UISprite.MarkAnthor.MA_RightTop, -10, -10); } } GamePlayer.newBabyId = 0; }
public void AddItems(List <Baby> Entitylist) { if (Entitylist == null) { return; } for (int i = 0; i < Entitylist.Count; i++) { GameObject o = GameObject.Instantiate(item) as GameObject; o.SetActive(true); o.name = Entitylist[i].InstName; o.transform.parent = grid.transform; o.transform.localPosition = Vector3.zero; MainBabyListCell mbCell = o.GetComponent <MainBabyListCell>(); mbCell.BabyMainData = Entitylist[i]; listCells.Add(mbCell); o.transform.localScale = new Vector3(1, 1, 1); UIManager.SetButtonEventHandler(o, EnumButtonEvent.OnClick, buttonClick, i, 0); //grid.repositionNow = true; itemsList.Add(o); } GlobalInstanceFunction.Instance.Invoke(() => { grid.Reposition(); }, 1); if (itemsList != null && itemsList.Count > 0) { int[] ids = { Entitylist[0].InstId, Entitylist[0].GetIprop(PropertyType.PT_AssetId) }; GameManager.Instance.GetActorClone((ENTITY_ID)Entitylist[0].Properties[(int)PropertyType.PT_AssetId], (ENTITY_ID)0, Entitylist[0].type_, AssetLoadCallBack, new ParamData(Entitylist[0].InstId, Entitylist[0].GetIprop(PropertyType.PT_AssetId)), "UI"); MainbabyProperty.idss = ids; //modelName_.text = GamePlayer.Instance.GetBabyInst(Entitylist[0].InstId).InstName; //modelRace_.spriteName = BabyData.GetData(GamePlayer.Instance.GetBabyInst(Entitylist[0].InstId).GetIprop(PropertyType.PT_TableId)).RaceIcon_; HeadIconLoader.Instance.LoadIcon(BabyData.GetData(GamePlayer.Instance.GetBabyInst(Entitylist[0].InstId).GetIprop(PropertyType.PT_TableId))._RaceIcon, modelRace_); if (!_icons.Contains(BabyData.GetData(GamePlayer.Instance.GetBabyInst(Entitylist[0].InstId).GetIprop(PropertyType.PT_TableId))._RaceIcon)) { _icons.Add(BabyData.GetData(GamePlayer.Instance.GetBabyInst(Entitylist[0].InstId).GetIprop(PropertyType.PT_TableId))._RaceIcon); } raceLabel.text = LanguageManager.instance.GetValue(BabyData.GetData(GamePlayer.Instance.GetBabyInst(Entitylist[0].InstId).GetIprop(PropertyType.PT_TableId))._RaceType.ToString()); if (MainbabyState.babyInfo != null) { MainbabyState.babyInfo(ids); } } NewBabyMakeOn(); }
void addItem(List <Baby> babys) { Refresh(); for (int i = 0; i < babys.Count; i++) { GameObject o = GameObject.Instantiate(item) as GameObject; o.SetActive(true); o.name = o.name + i; o.transform.parent = grid.transform; MainBabyListCell mbCell = o.GetComponent <MainBabyListCell>(); Baby inst = GamePlayer.Instance.GetBabyInst(babys[i].InstId); mbCell.BabyMainData = babys[i]; BabyData bab = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId)); string ReformItem = bab._ReformItem; // if(MainbabyReformUI.isMainbabyReformUI) // { // if(babys[i].isForBattle_) // { // mbCell.chuzhanButton.gameObject.SetActive(true); // mbCell.chuzhanButton.isEnabled = false; // mbCell.daimingButton.gameObject.SetActive(false); // }else // { // mbCell.chuzhanButton.gameObject.SetActive(false); // mbCell.daimingButton.gameObject.SetActive(true); // mbCell.daimingButton.isEnabled = false; // } // } // if(ReformItem == "") // { // mbCell.ban.gameObject.SetActive(true); // // // }else // if(inst.GetIprop(PropertyType.PT_Level)>1) // { // mbCell.ban.gameObject.SetActive(true); // // }else // { // mbCell.ban.gameObject.SetActive(false); // } o.transform.localScale = new Vector3(1, 1, 1); UIManager.SetButtonEventHandler(o, EnumButtonEvent.OnClick, buttonClick, babys[i].InstId, babys[i].GetIprop(PropertyType.PT_AssetId)); grid.repositionNow = true; } }
void RefreshBabyUIOk(COM_BabyInst binst) { Baby ba = new Baby(); ba.SetBaby(binst); for (int i = 0; i < itemsList.Count; i++) { MainBabyListCell mbcell = itemsList[i].GetComponent <MainBabyListCell>(); if (mbcell.BabyMainData.InstId == binst.instId_) { mbcell.BabyMainData = ba; return; } } }
void BabyListLockUIOk(int inid, bool slock) { for (int i = 0; i < listCells.Count; i++) { MainBabyListCell blc = listCells[i].GetComponent <MainBabyListCell>(); if (inid == blc.BabyMainData.InstId) { if (slock) { blc.suodingSp.gameObject.SetActive(true); } else { blc.suodingSp.gameObject.SetActive(false); } } } }
void UpdateBabyListUI(int binsId) { Baby ba = GamePlayer.Instance.GetBabyInst(binsId); if (ba == null) { return; } for (int i = 0; i < itemsList.Count; i++) { MainBabyListCell mbcell = itemsList[i].GetComponent <MainBabyListCell>(); if (mbcell.BabyMainData.InstId == binsId) { mbcell.BabyMainData = ba; return; } } // GlobalInstanceFunction.Instance.Invoke(()=>{ // grid.Reposition(); // },1); }
void ShowBaby(int babyid, bool isshow) { for (int i = 0; i < listCells.Count; i++) { if (listCells[i] == null) { continue; } MainBabyListCell blc = listCells[i].GetComponent <MainBabyListCell>(); if (blc == null) { continue; } if (babyid == blc.BabyMainData.InstId) { if (isshow) { blc.gensuiSp.gameObject.SetActive(true); } else { blc.gensuiSp.gameObject.SetActive(false); } } else { if (blc.BabyMainData.isShow_) { blc.gensuiSp.gameObject.SetActive(true); } else { blc.gensuiSp.gameObject.SetActive(false); } } } }