private void SetDetail(int linkedId) { ChongWuJiBan chongWuJiBan = DataReader <ChongWuJiBan> .Get(linkedId); Transform transform = base.get_transform().FindChild("east"); Text component = transform.FindChild("texDetail").GetComponent <Text>(); component.set_text(GameDataUtils.GetChineseContent(chongWuJiBan.desc, false)); List <string> attrTexts = PetEvoGlobal.GetAttrTexts(chongWuJiBan.linkedAttrId); Debug.LogError("linkedId=" + linkedId); Debug.LogError("chongWuJiBanRow.linkedAttrId=" + chongWuJiBan.linkedAttrId); Debug.LogError("SetDetail=" + attrTexts.get_Count()); Text[] array = new Text[3]; Text[] array2 = new Text[3]; for (int i = 0; i < 3; i++) { array[i] = transform.FindChild("attrKey" + (i + 1)).GetComponent <Text>(); array2[i] = transform.FindChild("attrVal" + (i + 1)).GetComponent <Text>(); array[i].set_text(string.Empty); array2[i].set_text(string.Empty); } for (int j = 0; j < attrTexts.get_Count(); j++) { string[] array3 = attrTexts.get_Item(j).Split(new char[] { ' ' }); array[j].set_text(array3[0]); array2[j].set_text(array3[1]); } }
private void SetScroll() { for (int i = 0; i < this.scrollLayout.get_transform().get_childCount(); i++) { Transform child = this.scrollLayout.get_transform().GetChild(i); Object.Destroy(child.get_gameObject()); } List <ChongWuJiBan> dataList = DataReader <ChongWuJiBan> .DataList; List <PetFetterUI.SortNode> list = new List <PetFetterUI.SortNode>(); using (List <ChongWuJiBan> .Enumerator enumerator = dataList.GetEnumerator()) { while (enumerator.MoveNext()) { ChongWuJiBan current = enumerator.get_Current(); List <int> linkedPetId = DataReader <ChongWuJiBan> .Get(current.linkedId).linkedPetId; int num = 0; for (int j = 0; j < linkedPetId.get_Count(); j++) { if (this.havingPets.ContainsKey(linkedPetId.get_Item(j))) { num++; } } list.Add(new PetFetterUI.SortNode { id = current.linkedId, weight = num }); } } list.Sort(new Comparison <PetFetterUI.SortNode>(this.CompareNodes)); for (int k = 0; k < list.get_Count(); k++) { ChongWuJiBan chongWuJiBan = DataReader <ChongWuJiBan> .Get(list.get_Item(k).id); GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab(WidgetName.PetFetterScrollCell); instantiate2Prefab.get_transform().SetParent(this.scrollLayout.get_transform(), false); instantiate2Prefab.set_name(chongWuJiBan.linkedId.ToString()); instantiate2Prefab.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickScrollCell); instantiate2Prefab.get_gameObject().SetActive(true); this.SetImgPets(instantiate2Prefab, chongWuJiBan.linkedId); this.SetName(instantiate2Prefab, chongWuJiBan.linkedId); if (k == 0) { this.lastClickCell = instantiate2Prefab; this.SetDetail(int.Parse(instantiate2Prefab.get_name())); this.SetScrollCellHightlight(instantiate2Prefab, true); } } }
private void RefreshRight(int formationID) { int num = 0; int num2 = 0; int num3 = 0; PetFormation petFormation = PetManager.Instance.Formation.Find((PetFormation a) => a.formationId == formationID); if (petFormation != null && petFormation.petFormationArr != null && petFormation.petFormationArr.Int64Array != null) { PetManager.Instance.GetFormationAddAttrValue(petFormation, out num, out num2, out num3); List <int> list = new List <int>(); for (int i = 0; i < petFormation.petFormationArr.Int64Array.get_Count(); i++) { Int64IndexValue int64IndexValue = petFormation.petFormationArr.Int64Array.get_Item(i); PetInfo petInfo = PetManager.Instance.GetPetInfo(int64IndexValue.value); list.Add(petInfo.petId); } List <ChongWuJiBan> list2 = new List <ChongWuJiBan>(); for (int j = 0; j < DataReader <ChongWuJiBan> .DataList.get_Count(); j++) { bool flag = true; ChongWuJiBan chongWuJiBan = DataReader <ChongWuJiBan> .DataList.get_Item(j); for (int k = 0; k < chongWuJiBan.linkedPetId.get_Count(); k++) { int num4 = chongWuJiBan.linkedPetId.get_Item(k); if (!list.Contains(num4)) { flag = false; break; } } if (flag) { list2.Add(chongWuJiBan); } } if (list2.get_Count() > 0) { for (int l = 0; l < list2.get_Count(); l++) { ChongWuJiBan chongWuJiBan2 = list2.get_Item(l); Transform transform = null; if (l == 0) { transform = this.linkedPet1; } if (l == 2) { transform = this.linkedPet2; } if (l == 3) { transform = this.linkedPet3; } transform.FindChild("Title").GetComponent <Text>().set_text(GameDataUtils.GetChineseContent(chongWuJiBan2.name, false)); string text = string.Empty; Attrs attrs = DataReader <Attrs> .Get(chongWuJiBan2.linkedAttrId); for (int m = 0; m < attrs.attrs.get_Count(); m++) { text += AttrUtility.GetStandardAddDesc(attrs.attrs.get_Item(m), attrs.values.get_Item(m)); } transform.FindChild("Content").GetComponent <Text>().set_text(text); } if (list2.get_Count() == 1) { this.linkedPet1.get_gameObject().SetActive(true); this.linkedPet2.get_gameObject().SetActive(false); this.linkedPet3.get_gameObject().SetActive(false); } else if (list2.get_Count() == 2) { this.linkedPet1.get_gameObject().SetActive(true); this.linkedPet2.get_gameObject().SetActive(true); this.linkedPet3.get_gameObject().SetActive(false); } else if (list2.get_Count() == 3) { this.linkedPet1.get_gameObject().SetActive(true); this.linkedPet2.get_gameObject().SetActive(true); this.linkedPet3.get_gameObject().SetActive(true); } } } this.Property1.FindChild("Content").GetComponent <Text>().set_text(AttrUtility.GetAttrName(GameData.AttrType.Atk) + ":"); this.Property2.FindChild("Content").GetComponent <Text>().set_text(AttrUtility.GetAttrName(GameData.AttrType.Defence) + ":"); this.Property3.FindChild("Content").GetComponent <Text>().set_text(AttrUtility.GetAttrName(GameData.AttrType.HpLmt) + ":"); this.Property1.FindChild("Value").GetComponent <Text>().set_text(num.ToString()); this.Property2.FindChild("Value").GetComponent <Text>().set_text(num2.ToString()); this.Property3.FindChild("Value").GetComponent <Text>().set_text(num3.ToString()); }