private static int SortCompare(OOPetChooseUnit AF1, OOPetChooseUnit AF2) { int result = 0; if (AF1.PetUpgradeLevel > AF2.PetUpgradeLevel) { result = -1; } else if (AF1.PetUpgradeLevel < AF2.PetUpgradeLevel) { result = 1; } else if (AF1.BattleFighting > AF2.BattleFighting) { result = -1; } else if (AF1.BattleFighting < AF2.BattleFighting) { result = 1; } else if (AF1.PetId < AF2.PetId) { result = -1; } else if (AF1.PetId > AF2.PetId) { result = 1; } return(result); }
public void RefreshActivatedPets(List <OOPetChooseUnit> ooPets) { for (int i = 0; i < ooPets.get_Count(); i++) { PetInfo petInfoById = PetManager.Instance.GetPetInfoById(ooPets.get_Item(i).PetId); if (petInfoById != null) { OOPetChooseUnit dataUnit = ooPets.get_Item(i); this.RefreshActivatedPet(petInfoById, dataUnit); } } }
private int GetIndexByID(int petId) { for (int i = 0; i < this.PetChooses.Count; i++) { OOPetChooseUnit item = this.PetChooses.GetItem(i); if (item != null && item.PetId == petId) { return(i); } } return(0); }
private void SetSelectedByIndex(int selectedIndex) { for (int i = 0; i < this.PetChooses.Count; i++) { OOPetChooseUnit item = this.PetChooses.GetItem(i); if (item != null && i == selectedIndex) { PetBasicUIViewModel.Instance.ShowSelectedPetInfo(item.PetUID, item.PetId); this.PetSelectedIndex = i; } } }
public void RefreshNotActivatedPets(List <OOPetChooseUnit> ooPets) { for (int i = 0; i < ooPets.get_Count(); i++) { if (PetManager.Instance.GetPetInfoById(ooPets.get_Item(i).PetId) == null) { OOPetChooseUnit oOPetChooseUnit = ooPets.get_Item(i); this.RefreshNotActivatedPet(oOPetChooseUnit.PetId, oOPetChooseUnit); } } if (PetBasicUIViewModel.Instance != null) { PetBasicUIViewModel.Instance.SubFormationBadge = PetManager.Instance.CheckAllCanFormation(); } }
public void RefreshActivatedPet(PetInfo petInfo, OOPetChooseUnit dataUnit) { if (dataUnit == null) { return; } Pet pet = DataReader <Pet> .Get(petInfo.petId); if (pet == null) { return; } dataUnit.PetUID = petInfo.id; dataUnit.PetId = petInfo.petId; dataUnit.BadgeTip = PetManager.Instance.CheckPetBadge(petInfo); dataUnit.PetUpgradeLevel = petInfo.star; dataUnit.PetIconHSV = 0; dataUnit.BattleFighting = petInfo.publicBaseInfo.simpleInfo.Fighting; dataUnit.Level = "Lv" + petInfo.lv; dataUnit.PetName = PetManager.GetPetName(pet, false); dataUnit.InFormation = PetManager.Instance.IsInFormation(petInfo.id); if (pet != null && pet.needFragment.get_Count() > 0) { int num = petInfo.star + 1; if (num <= pet.needFragment.get_Count()) { long num2 = BackpackManager.Instance.OnGetGoodCount(pet.fragmentId); dataUnit.MatNum = num2 + "/" + pet.needFragment.get_Item(num - 1); if (num2 >= (long)pet.needFragment.get_Item(num - 1)) { dataUnit.PetStatus = OOPetChooseUnit.Status.HaveActivation_StarEnough; } else { dataUnit.PetStatus = OOPetChooseUnit.Status.HaveActivation_StarNoEnough; } } else { dataUnit.PetStatus = OOPetChooseUnit.Status.HaveActivation_StarTop; } } }
private void RefreshPets(bool reSort) { if (reSort) { this.uniqueIds.Clear(); this.tempPetChooses.Clear(); using (Dictionary <long, PetInfo> .ValueCollection.Enumerator enumerator = PetManager.Instance.MaplistPet.get_Values().GetEnumerator()) { while (enumerator.MoveNext()) { PetInfo current = enumerator.get_Current(); OOPetChooseUnit oOPetChooseUnit = new OOPetChooseUnit { PetUID = current.id, PetId = current.petId }; this.tempPetChooses.Add(oOPetChooseUnit); this.uniqueIds.Add(current.petId); } } List <Pet> levelPassPets = PetManager.Instance.GetLevelPassPets(); for (int i = 0; i < levelPassPets.get_Count(); i++) { int id = (int)levelPassPets.get_Item(i).id; if (!this.uniqueIds.Contains(id)) { OOPetChooseUnit oOPetChooseUnit2 = new OOPetChooseUnit { PetId = id }; this.tempPetChooses.Add(oOPetChooseUnit2); this.uniqueIds.Add(id); } } this.RefreshActivatedPets(this.tempPetChooses); this.RefreshNotActivatedPets(this.tempPetChooses); this.SortPetChooses(this.tempPetChooses); } this.RefreshActivatedPets(this.PetChooses.OClist); this.RefreshNotActivatedPets(this.PetChooses.OClist); this.SetListView(); }
private void RefreshNotActivatedPet(int petId, OOPetChooseUnit dataUnit) { if (dataUnit == null) { return; } Pet pet = DataReader <Pet> .Get(petId); if (pet != null && pet.needFragment.get_Count() > 0) { dataUnit.PetUID = 0L; dataUnit.PetId = petId; dataUnit.BadgeTip = false; dataUnit.PetUpgradeLevel = pet.initStar; dataUnit.Level = string.Empty; dataUnit.PetName = PetManager.GetPetName(pet, false); dataUnit.InFormation = false; dataUnit.BattleFighting = 0L; dataUnit.PetIconHSV = 6; dataUnit.PetStatus = OOPetChooseUnit.Status.NoActivation; dataUnit.MatNum = GameDataUtils.GetChineseContent(pet.getTip, false); } }