private void SetPetItems(PetFormationUnit pfu, int indexFormation) { List <PetInfo> pets = RoleShowUIViewModel.Instance.GetPets(indexFormation); if (pets == null || pets.get_Count() == 0) { for (int i = 0; i < 3; i++) { pfu.pets.get_Item(i).SetItem(null, null, false); } } else { for (int j = 0; j < 3; j++) { if (j < pets.get_Count()) { PetInfo petInfo = pets.get_Item(j); Pet dataPet = DataReader <Pet> .Get(petInfo.petId); pfu.pets.get_Item(j).SetItem(petInfo, dataPet, false); } else { pfu.pets.get_Item(j).SetItem(null, null, false); } } } }
private void SetPetItems(PetFormationUnit pfu, int formationID) { PetFormation petFormation = PetManager.Instance.Formation.Find((PetFormation a) => a.formationId == formationID); if (petFormation == null || petFormation.petFormationArr == null || petFormation.petFormationArr.Int64Array == null) { for (int i = 0; i < 3; i++) { pfu.pets.get_Item(i).SetItem(null, null, false); } } else { for (int j = 0; j < petFormation.petFormationArr.Int64Array.get_Count(); j++) { Int64IndexValue int64IndexValue = petFormation.petFormationArr.Int64Array.get_Item(j); PetInfo petInfo = PetManager.Instance.GetPetInfo(int64IndexValue.value); Pet dataPet = DataReader <Pet> .Get(petInfo.petId); pfu.pets.get_Item(int64IndexValue.index).SetItem(petInfo, dataPet, PetManager.Instance.IsFormationFromInstance && PetManagerBase.IsPetLimit(dataPet)); } for (int k = 0; k < 3; k++) { if (k >= petFormation.petFormationArr.Int64Array.get_Count()) { pfu.pets.get_Item(k).SetItem(null, null, false); } } } }
protected override void InitUI() { base.InitUI(); this.m_petFormation.Clear(); for (int i = 1; i <= 3; i++) { PetFormationUnit component = base.FindTransform("Formation" + i).GetComponent <PetFormationUnit>(); component.SetAction(new Action <int>(this.OnClickFormation), new Action <int>(this.OnClickFormation), i - 1); this.m_petFormation.Add(component); } }
private void Awake() { base.AwakeBase(BindingContext.BindingContextMode.MonoBinding, false); this.m_petFormation.Clear(); for (int i = 1; i <= 3; i++) { PetFormationUnit component = base.FindTransform("Formation" + i).GetComponent <PetFormationUnit>(); component.SetAction(new Action <int>(this.OnClickFormation), new Action <int>(this.OnClickBtnChange), i - 1); this.m_petFormation.Add(component); } this.HaveLinkPet = base.FindTransform("HaveLinkPet"); this.NoLinkPet = base.FindTransform("NoLinkPet"); this.Property1 = base.FindTransform("Property1"); this.Property2 = base.FindTransform("Property2"); this.Property3 = base.FindTransform("Property3"); this.linkedPet1 = base.FindTransform("linkedPet1"); this.linkedPet2 = base.FindTransform("linkedPet2"); this.linkedPet3 = base.FindTransform("linkedPet3"); }