/// <summary> /// 初始化客人团队 /// </summary> public IEnumerator InitTeamCustomer() { CptUtil.RemoveChildsByActive(objTeamCustomerContainer); GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); UserAchievementBean userAchievement = gameData.GetAchievementData(); if (tvTeamCustomerNumber != null) { tvTeamCustomerNumber.text = TextHandler.Instance.manager.GetTextById(323) + " " + userAchievement.GetNumberForCustomerFoodByType(CustomerTypeEnum.Team) + TextHandler.Instance.manager.GetTextById(82); } //查询所有团队 List <NpcTeamBean> listNpcTeamData = NpcTeamHandler.Instance.manager.GetCustomerTeam(); for (int i = 0; i < listNpcTeamData.Count; i++) { NpcTeamBean itemNpcTeamData = listNpcTeamData[i]; GameObject objItem = Instantiate(objTeamCustomerContainer, objItemCustomerModel); ItemGameStatisticsForCustomerCpt itemCustomer = objItem.GetComponent <ItemGameStatisticsForCustomerCpt>(); long[] teamLeaderIds = itemNpcTeamData.GetTeamLeaderId(); CharacterBean teamLeaderData = NpcInfoHandler.Instance.manager.GetCharacterDataById(teamLeaderIds[0]); UserCustomerBean userCustomerData = userAchievement.GetCustomerData(CustomerTypeEnum.Team, itemNpcTeamData.id + ""); //检测是否解锁该顾客团队 if (userAchievement.CheckHasTeamCustomer(itemNpcTeamData.id + "")) { long number = 0; if (userCustomerData != null) { number = userCustomerData.number; } itemCustomer.SetData(teamLeaderData, true, itemNpcTeamData.name, number, itemNpcTeamData.id + ""); } else { long number = 0; if (userCustomerData != null) { number = userCustomerData.number; } itemCustomer.SetData(teamLeaderData, false, itemNpcTeamData.name, number, itemNpcTeamData.id + ""); } if (i % ProjectConfigInfo.ITEM_REFRESH_NUMBER == 0) { yield return(new WaitForEndOfFrame()); } } }
public List <CharacterBean> GetCharacterDataByInfiniteTowersLayer(long layer) { List <CharacterBean> listData = new List <CharacterBean>(); if (layer % 10 == 0) { //Boss层数 string bossTeamMembers = ""; switch (layer) { case 10: case 20: case 30: GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel1, out bossTeamMembers); //bossTeamMembers = "7400011"; break; case 40: case 50: case 60: GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel2, out bossTeamMembers); break; case 70: case 80: case 90: GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel3, out bossTeamMembers); break; case 100: case 110: case 120: GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel4, out bossTeamMembers); break; default: GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel1, out string level1); GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel2, out string level2); GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel2, out string level3); GameCommonInfo.baseDataController.GetBaseData(BaseDataTypeEnum.InfiniteTowersBossForLevel2, out string level4); bossTeamMembers = level1 + "|" + level2 + "|" + level3 + "|" + level4; break; } string[] randomBossTeam = StringUtil.SplitBySubstringForArrayStr(bossTeamMembers, '|'); string bossTeamStr = RandomUtil.GetRandomDataByArray(randomBossTeam); long bossTeamId = StringUtil.SplitAndRandomForLong(bossTeamStr, ','); NpcTeamBean bossTeamData = NpcTeamHandler.Instance.manager.GetInfiniteTowerBossTeam(bossTeamId); long[] membersIds = bossTeamData.GetTeamMembersId(); long[] bossId = bossTeamData.GetTeamLeaderId(); foreach (long itemMemberId in membersIds) { CharacterBean memberData = NpcInfoHandler.Instance.manager.GetCharacterDataById(itemMemberId); if (memberData != null) { memberData.body.CreateRandomBody(); listData.Add(memberData); } } foreach (long itemBossId in bossId) { CharacterBean bossData = NpcInfoHandler.Instance.manager.GetCharacterDataById(itemBossId); if (bossData != null) { //bossData.body.CreateRandomBody(characterBodyManager); listData.Insert((membersIds.Length / 2), bossData); } } } else { //普通层数 List <CharacterBean> listCharacter = NpcInfoHandler.Instance.manager.GetCharacterDataByType(NpcTypeEnum.GuestTeam); List <CharacterBean> listTempCharacter = new List <CharacterBean>(); if (!CheckUtil.ListIsNull(listCharacter)) { for (int i = 0; i < listCharacter.Count; i++) { CharacterBean itemCharacter = listCharacter[i]; //判断层数 int level = int.Parse(itemCharacter.npcInfoData.remark); int layerLevel = Mathf.FloorToInt(layer / 10f); if (layerLevel <= 15 && level == layerLevel) { listTempCharacter.Add(itemCharacter); } } } CharacterBean baseCharacterData = null; if (listTempCharacter.Count == 0) { baseCharacterData = RandomUtil.GetRandomDataByList(listCharacter); } else { baseCharacterData = RandomUtil.GetRandomDataByList(listTempCharacter); } //随机生成身体数据 CharacterBean characterOne = ClassUtil.DeepCopyByReflect(baseCharacterData); characterOne.body.CreateRandomBody(); listData.Add(characterOne); CharacterBean characterTwo = ClassUtil.DeepCopyByReflect(baseCharacterData); characterTwo.body.CreateRandomBody(); listData.Add(characterTwo); CharacterBean characterThree = ClassUtil.DeepCopyByReflect(baseCharacterData); characterThree.body.CreateRandomBody(); listData.Add(characterThree); } return(listData); }