/// <summary> /// 刷新消耗金币和获得经验信息 /// </summary> private void FreshCostAndExpInfo() { int updateCostMoney = 0; int updateExp = 0; foreach (UserCardItem card in cardList) { for (int i = 0; i < selectIdList.Count; i++) { if (card.cardID == selectIdList[i]) { Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(card.skillStudyId); if (tabStydyskill != null) { updateExp += tabStydyskill.SkillExperience; } break; } } } Tab_Studyskill mainCardSkill = TableManager.GetStudyskillByID(Obj_MyselfPlayer.GetMe().updateMainHeroItem.skillStudyId); if (mainCardSkill != null) { updateCostMoney = mainCardSkill.CostMoney * selectIdList.Count; } costMoney.text = updateCostMoney.ToString(); exp.text = updateExp.ToString(); }
/// <summary> /// 确认学习 /// </summary> private void ConfirmFirst() { Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(learnMainHeroItem.skillStudyId); Tab_Studyskill tabStydyskillchild = TableManager.GetStudyskillByID(learnChildHeroItem.skillStudyId); if (tabStydyskill != null) { if (tabStydyskillchild.LeaderNum > tabStydyskill.LeaderNum) { BoxManager.showMessageByID((int)MessageIdEnum.Msg244, (tabStydyskillchild.LeaderNum - tabStydyskill.LeaderNum).ToString()); UIEventListener.Get(BoxManager.getYesButton()).onClick += ConfirmLearn; } else { ConfirmLearn(gameObject); } } else { if (tabStydyskillchild.LeaderNum > 0) { BoxManager.showMessageByID((int)MessageIdEnum.Msg244, tabStydyskillchild.LeaderNum.ToString()); UIEventListener.Get(BoxManager.getYesButton()).onClick += ConfirmLearn; } else { ConfirmLearn(gameObject); } } }
/// <summary> /// 获取总领导力 /// </summary> /// <returns></returns> public int GetLeaderShip() { Tab_Studyskill studySkill = TableManager.GetStudyskillByID(skillStudyId); if (studySkill != null) { return(GetLeaderShipBase() + studySkill.LeaderNum); } else { return(GetLeaderShipBase()); } }
/// <summary> /// 确认学习 /// </summary> private void ConfirmLearn(GameObject go) { Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(learnMainHeroItem.skillStudyId); if (tabStydyskill != null) { BoxManager.showMessageByID((int)MessageIdEnum.Msg201); UIEventListener.Get(BoxManager.getYesButton()).onClick += Confirm; } else { if (costMoneyValue > Obj_MyselfPlayer.GetMe().money) { NetworkSender.Instance().buyGold(BuyGoldFinish, 1); return; } NetworkSender.Instance().RequestLearnSkill(LearnSkillDone); } }
/// <summary> /// 确认升级 /// </summary> private void Confirm() { Tab_Studyskill mainCardSkill = TableManager.GetStudyskillByID(updateMainHeroItem.skillStudyId); if (mainCardSkill.SkillHighLevel == updateMainHeroItem.skillStudyLev) { BoxManager.showMessageByID((int)MessageIdEnum.Msg213); return; } if (afterLeaderNum > mainCardSkill.LeaderNum) { BoxManager.showMessageByID((int)MessageIdEnum.Msg245, (afterLeaderNum - mainCardSkill.LeaderNum).ToString()); UIEventListener.Get(BoxManager.getYesButton()).onClick += ConfirmUpdate; } else { ConfirmUpdate(gameObject); } }
//zbz修改(以后显示的计算都放在这里) 如果Card != null 则用card, 否用templateid private void CalculateCardInfoAndShow(UserCardItem card, int nTemplateid) { int templateid = 0; if (card != null) { templateid = card.templateID; } else if (nTemplateid > 0) { templateid = nTemplateid; } else { return; } Tab_Card tabCard = TableManager.GetCardByID(templateid); if (tabCard != null) { Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance); if (tabAppearance != null) { cardName.text = LanguageManger.GetWords(tabAppearance.Name); if (tabAppearance.DropDescripe == -1) { level_src.text = "获得途径:无"; } else { level_src.text = LanguageManger.GetWords(tabAppearance.DropDescripe); } } if (largeCardObj != null) { largeCardObj.GetComponent <CardLarge>().SetCardTemplateID(templateid); } if (card != null) { if (Obj_MyselfPlayer.GetMe().IsCardInBagByID(card.cardID)) { HP.text = (card.GetHpBase() + card.GetFengShuiHp() + card.GetStudySkillHp()).ToString(); attack.text = (card.GetAttackBase() + card.GetFengShuiAttc()).ToString(); } else { HP.text = card.GetHpBase().ToString(); attack.text = card.GetAttackBase().ToString(); } if (card.GetHpAdd() > 0) //有加成 { HP_add.text = "+" + card.GetHpAdd().ToString(); } else { HP_add.text = ""; } if (card.GetAttackAdd() > 0) { attack_add.text = "+" + card.GetAttackAdd().ToString(); } else { attack_add.text = ""; } level.text = card.level + "/" + tabCard.MaxLevel.ToString(); //学习技能 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId); if (studySkill != null) { string color = ""; switch (studySkill.SkillQuality) { case 0: color = "[2d8560]"; break; case 1: color = "[2368ad]"; break; case 2: color = "[852bed]"; break; default: break; } studySkillName.text = color + studySkill.SkillName; studySkillName.text += "[9d2f07] " + card.skillStudyLev + "/" + studySkill.SkillHighLevel; sdudySkillDes.text = ConvertAttType(studySkill.SkillDes, templateid); } else { studySkillName.text = "[a65a04]无"; sdudySkillDes.text = ""; } leadership.text = card.GetLeaderShip().ToString(); } else { int hp = tabCard.HpBase; int nLevBase = tabCard.LevelBase; hp += tabCard.HpGrow * (tabCard.GambleLevel - nLevBase); HP.text = hp.ToString(); int att = tabCard.AttackBase; att += tabCard.AttackGrow * (tabCard.GambleLevel - nLevBase); attack.text = att.ToString(); attack_add.text = ""; HP_add.text = ""; level.text = tabCard.GambleLevel.ToString() + "/" + tabCard.MaxLevel.ToString(); //学习技能 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(tabCard.SkillStudy); if (studySkill != null) { string color = ""; switch (studySkill.SkillQuality) { case 0: color = "[2d8560]"; break; case 1: color = "[2368ad]"; break; case 2: color = "[852bed]"; break; default: break; } studySkillName.text = color + studySkill.SkillName; studySkillName.text += "[9d2f07] " + tabCard.SkillStudylv + "/" + studySkill.SkillHighLevel; sdudySkillDes.text = ConvertAttType(studySkill.SkillDes, templateid); //领导力 leadership.text = (tabCard.LeaderBase + studySkill.LeaderNum).ToString(); } else { studySkillName.text = "[a65a04]无"; sdudySkillDes.text = ""; //领导力 leadership.text = tabCard.LeaderBase.ToString(); } } Tab_Skill skill = null; Tab_SkillDisplay skillDisplay = null; skill = TableManager.GetSkillByID(tabCard.SkillComm); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); N_name.text = LanguageManger.GetWords(skillDisplay.Name); N_des.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid); } skill = TableManager.GetSkillByID(tabCard.SkillVol); cardLevelMax.text = ""; if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); Z_name.text = LanguageManger.GetWords(skillDisplay.Name); Z_des.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid); //当实现的卡牌是存在的卡牌时(就是除了进化后预览效果这样的卡牌) if (card != null) { Z_name.text += "[9d2f07]" + card.skillLevel + "/" + skill.SkillMaxlevel; Debug.Log("card skill level : " + card.skillLevel); } else { Z_name.text += "[9d2f07]" + 1 + "/" + skill.SkillMaxlevel; Debug.Log("card skill level : not find card"); } //2013-8-9 Jack Wen cardLevelMax.gameObject.SetActive(false); ShowRoundNum(skill.FirstRelease); } else { ShowRoundNum(2); } Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tabCard.SkillLeader);//.GetSkillByID(tabCard.SkillLeader); if (leaderSkill != null) { L_name.text = LanguageManger.GetWords(leaderSkill.Name); Debug.Log("L_name.text=" + L_name.text); L_des.text = ConvertAttType(LanguageManger.GetWords(leaderSkill.Note), templateid); } else { L_name.text = "无"; L_des.text = ""; } skill = TableManager.GetSkillByID(tabCard.SkillComb); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); H_name.text = LanguageManger.GetWords(skillDisplay.Name); H_des.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid); } cardCanEvl.spriteName = tabCard.NextCard == -1 ? "cannotEvl" : "canEvl"; int maxStar = tabCard.HighStarDisplay; // level; for (int i = 0; i < startManager.Length; i++) { if (i < tabCard.Star) { UISprite starIcon = startManager[i].GetComponent <UISprite>(); starIcon.spriteName = "xingxing"; starIcon.MakePixelPerfect(); starIcon.gameObject.SetActive(true); } else { UISprite starIcon = startManager[i].GetComponent <UISprite>(); if (i < maxStar) { starIcon.spriteName = "haoyou_xingxing_beijing"; starIcon.MakePixelPerfect(); starIcon.gameObject.SetActive(true); } else { starIcon.gameObject.SetActive(false); } } } } }
/// <summary> /// 刷新界面 /// </summary> private void FreshUI() { cardList = Obj_MyselfPlayer.GetMe().cardBagList; learnMainHeroItem = Obj_MyselfPlayer.GetMe().learnMainHeroItem; learnChildHeroItem = Obj_MyselfPlayer.GetMe().learnChildHeroItem; costMoney.text = costMoneyValue.ToString(); CardExist(); if (learnMainHeroItem == null) { mainCard.SetActive(false); childCard.SetActive(false); childCardBG.GetComponent <UIButtonMessage>().enabled = false; beforeLearn.SetActive(false); afterLearn.SetActive(false); confirmBtn.isEnabled = false; tips.SetActive(false); addTip.SetActive(false); selectTip.SetActive(true); } else { mainCard.GetComponent <CardLarge>().SetCardTemplateID(learnMainHeroItem.templateID); mainCard.SetActive(true); childCardBG.GetComponent <UIButtonMessage>().enabled = true; beforeLearn.SetActive(true); selectTip.SetActive(false); Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(learnMainHeroItem.skillStudyId); if (tabStydyskill != null) { if (finishLearn) { beforeSkill.spriteName = tabStydyskill.SkillName; finishLearn = false; } else { beforeSkill.spriteName = tabStydyskill.SkillName + "_原技能"; } beforeSkillDes.text = tabStydyskill.SkillDes; } else { beforeSkill.spriteName = "wu"; beforeSkillDes.text = ""; } beforeSkillLev.text = learnMainHeroItem.skillStudyLev.ToString(); if (learnChildHeroItem == null) { childCard.SetActive(false); afterLearn.SetActive(false); confirmBtn.isEnabled = false; tips.SetActive(false); addTip.SetActive(true); } else { childCard.GetComponent <CardIcon>().SetCardTemplateID(learnChildHeroItem.templateID); childCard.SetActive(true); afterLearn.SetActive(true); confirmBtn.isEnabled = true; Tab_Studyskill tabStydyskillchild = TableManager.GetStudyskillByID(learnChildHeroItem.skillStudyId); if (tabStydyskillchild != null) { afterSkill.spriteName = tabStydyskillchild.SkillName; afterSkillDes.text = tabStydyskillchild.SkillDes; afterSkillLev.text = learnChildHeroItem.skillStudyLev.ToString(); } tips.SetActive(true); addTip.SetActive(false); } } }
public UILabel cardAttack; //攻击 /// <summary> /// 初始化Item /// </summary> /// <param name="card"></param> /// <param name="isUpdateChild"></param> public void InitItem(UserCardItem card, bool isUpdateChild) { transform.localPosition = new Vector3(0, 0, -1); transform.localScale = new Vector3(1, 1, 1); transform.name = card.cardID.ToString(); cardHp.text = card.GetHp().ToString(); cardAttack.text = card.GetAttack().ToString(); cardLev.text = card.level.ToString(); Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(card.skillStudyId); if (tabStydyskill != null) { string color = ""; switch (tabStydyskill.SkillQuality) { case 0: color = "[2d8560]"; break; case 1: color = "[2368ad]"; break; case 2: color = "[852bed]"; break; default: break; } skillName.text = color + tabStydyskill.SkillName; if (isUpdateChild) { skillInfo.text = tabStydyskill.SkillExperience.ToString(); } else { skillInfo.text = card.skillStudyLev.ToString(); } } else { skillName.text = ""; skillInfo.text = "0"; } if (isUpdateChild) { skillInfoIcon.spriteName = "zhujiemian_zi_13"; skillInfoIcon.transform.localScale = new Vector3(45, 24, 1); } else { skillInfoIcon.spriteName = "haoyou_dengji"; skillInfoIcon.MakePixelPerfect(); } Tab_Card tabCard = TableManager.GetCardByID(card.templateID); if (tabCard != null) { Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance); if (tabAppearance != null) { cardName.text = LanguageManger.GetWords(tabAppearance.Name); string atlasname = tabAppearance.HeadIcon; AtlasManager.Instance.setHeadName(cardIconSpriteIcon, atlasname); } cardIconSpriteFrame.spriteName = UserCardItem.littleCardFrameName[tabCard.Star]; cardIconSpriteBG.spriteName = UserCardItem.littleCardBorderName[tabCard.Star]; cardProperty.spriteName = UserCardItem.elementTypeName[tabCard.Element]; } chexkBox.isChecked = false; backGround.alpha = 1; }
/// <summary> /// 刷新界面 /// </summary> private void FreshUI() { cardList = Obj_MyselfPlayer.GetMe().cardBagList; updateMainHeroItem = Obj_MyselfPlayer.GetMe().updateMainHeroItem; updateChildHeroItems = Obj_MyselfPlayer.GetMe().updateChildHeroItems; CardExist(); if (updateMainHeroItem == null) { mainCard.SetActive(false); for (int i = 0; i < 5; i++) { childCards[i].SetActive(false); childCardsBG[i].GetComponent <UIButtonMessage>().enabled = false; } beforeUpdate.SetActive(false); afterUpdate.SetActive(false); confirmBtn.isEnabled = false; tips.SetActive(false); expBarAfter.gameObject.SetActive(false); expBarForeground.SetActive(true); for (int i = 0; i < addTips.Length; i++) { addTips[i].SetActive(false); } selectTip.SetActive(true); } else { beforeLev.text = "等级" + updateMainHeroItem.skillStudyLev; mainCard.GetComponent <CardLarge>().SetCardTemplateID(updateMainHeroItem.templateID); mainCard.SetActive(true); selectTip.SetActive(false); for (int i = 0; i < 5; i++) { childCardsBG[i].GetComponent <UIButtonMessage>().enabled = true; } beforeUpdate.SetActive(true); int index = 0; for (int i = 0; i < updateChildHeroItems.Count; i++) { childCards[i].GetComponent <CardIcon>().SetCardTemplateID(updateChildHeroItems[i].templateID); childCards[i].SetActive(true); afterUpdate.SetActive(true); index++; } for (int i = index; i < 5; i++) { childCards[i].SetActive(false); } Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(updateMainHeroItem.skillStudyId); if (tabStydyskill != null) { maxLev.text = "(最高等级" + tabStydyskill.SkillHighLevel + ")"; skillDes.text = tabStydyskill.SkillDes; if (tabStydyskill.SkillNextLevel != -1) { expBar.sliderValue = (float)updateMainHeroItem.skillStudyExp / (float)tabStydyskill.Experience; expValue.text = updateMainHeroItem.skillStudyExp + "/" + tabStydyskill.Experience; } else { expBar.sliderValue = 1; expValue.text = tabStydyskill.Experience + "/" + tabStydyskill.Experience; } skillName.spriteName = tabStydyskill.SkillName; } if (index > 0) { confirmBtn.isEnabled = true; tips.SetActive(true); CalUpdateData(); expBarAfter.gameObject.SetActive(true); expBarForeground.SetActive(false); } else { tips.SetActive(false); confirmBtn.isEnabled = false; afterUpdate.SetActive(false); expBarAfter.gameObject.SetActive(false); expBarForeground.SetActive(true); } for (int i = 0; i < addTips.Length; i++) { if (i < index) { addTips[i].SetActive(false); } else { addTips[i].SetActive(true); } } } }
/// <summary> /// 计算升级数据 /// </summary> private void CalUpdateData() { int exp = 0; //总共经验金钱 for (int i = 0; i < updateChildHeroItems.Count; i++) { Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(updateChildHeroItems[i].skillStudyId); if (tabStydyskill != null) { exp += tabStydyskill.SkillExperience; } } int nowLev = updateMainHeroItem.skillStudyLev; Tab_Studyskill mainCardSkill = TableManager.GetStudyskillByID(updateMainHeroItem.skillStudyId); costMoneyValue = mainCardSkill.CostMoney * updateChildHeroItems.Count; //bool isUpdate = false; int nowExp = updateMainHeroItem.skillStudyExp; while (exp + nowExp >= mainCardSkill.Experience) { if (mainCardSkill.SkillNextLevel != -1) { //isUpdate = true; //升级 nowLev++; exp = exp + nowExp - mainCardSkill.Experience; nowExp = 0; mainCardSkill = TableManager.GetStudyskillByID(mainCardSkill.SkillNextLevel); } else { //满级 exp = mainCardSkill.Experience; break; } } if (mainCardSkill.SkillNextLevel != -1) { expValue.text = (exp + nowExp) + "/" + mainCardSkill.Experience; expBarAfter.sliderValue = (float)(exp + nowExp) / (float)mainCardSkill.Experience; } else { expValue.text = mainCardSkill.Experience + "/" + mainCardSkill.Experience; expBarAfter.sliderValue = 1; } afterLeaderNum = mainCardSkill.LeaderNum; //if (isUpdate) //{ // //升级 // expBarAfter.sliderValue = 1; // //afterSkillDes.text = mainCardSkill.SkillDes; // //afterSkillDes.gameObject.SetActive(true); //} //else //{ // //没升级 // expBarAfter.sliderValue = (float)(exp + updateMainHeroItem.skillStudyExp) / (float)mainCardSkill.Experience; // //afterSkillDes.gameObject.SetActive(false); //} afterLev.text = "等级" + nowLev; costMoney.text = costMoneyValue.ToString(); }
public void FreshCardInfo(long cardID) { Obj_MyselfPlayer.GetMe().bShowCardInfo = true; List <UserCardItem> cardList = Obj_MyselfPlayer.GetMe().cardBagList; foreach (UserCardItem card in cardList) { if (card.cardID == cardID) { if (largeCardObj != null) { largeCardObj.GetComponent <CardLarge>().SetCardTemplateID(card.templateID); } Tab_Card tab_card = TableManager.GetCardByID(card.templateID); if (tab_card != null) { Tab_Appearance tab_Appearance = TableManager.GetAppearanceByID(tab_card.Appearance); if (tab_Appearance != null) { cardName.text = LanguageManger.GetWords(tab_Appearance.Name); otherInfo.text = LanguageManger.GetWords(tab_Appearance.DropDescripe); } cardLevel.text = card.level + "/" + tab_card.MaxLevel.ToString(); if (card.GetHpAdd() > 0) //有加成 { cardHPAdd.text = "+" + card.GetHpAdd().ToString(); } else { cardHPAdd.text = ""; } if (card.GetAttackAdd() > 0) { cardAttackAdd.text = "+" + card.GetAttackAdd().ToString(); } else { cardAttackAdd.text = ""; } cardHP.text = (card.GetHpBase() + card.GetFengShuiHp() + card.GetStudySkillHp()).ToString(); cardAttack.text = (card.GetAttackBase() + card.GetFengShuiAttc()).ToString(); cardLeaderShip.text = card.GetLeaderShip().ToString(); Transform transformStars = starManage.transform; int maxStar = tab_card.HighStarDisplay; for (int j = 1; j <= 7; j++) { if (j <= card.quality) { UISprite starIcon = transformStars.FindChild("Star_" + j).GetComponent <UISprite>(); starIcon.spriteName = "xingxing"; starIcon.MakePixelPerfect(); starIcon.gameObject.SetActive(true); } else { UISprite starIcon = transformStars.FindChild("Star_" + j).GetComponent <UISprite>(); if (j <= maxStar) { starIcon.spriteName = "haoyou_xingxing_beijing"; starIcon.MakePixelPerfect(); starIcon.gameObject.SetActive(true); } else { starIcon.gameObject.SetActive(false); } } } Tab_Skill skill = null; Tab_SkillDisplay skillDisplay = null; //普通技能 skill = TableManager.GetSkillByID(tab_card.SkillComm); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); skillNormalName.text = LanguageManger.GetWords(skillDisplay.Name); skillNormal.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), card.templateID); } //主动技能 skill = TableManager.GetSkillByID(tab_card.SkillVol); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); skillActiveName.text = LanguageManger.GetWords(skillDisplay.Name); skillActive.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), card.templateID); skillActiveName.text += "[9d2f07]" + card.skillLevel + "/" + skill.SkillMaxlevel; //显示进恩释放回合数 ShowRoundNum(skill.FirstRelease); } else { //没有绝技,不显示 ShowRoundNum(2); } //队长技能 Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tab_card.SkillLeader); if (leaderSkill != null) { skillLeaderName.text = LanguageManger.GetWords(leaderSkill.Name); skillLeader.text = ConvertAttType(LanguageManger.GetWords(leaderSkill.Note), card.templateID); } else { skillLeaderName.text = "无"; skillLeader.text = ""; } skill = TableManager.GetSkillByID(tab_card.SkillComb); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); skillMixName.text = LanguageManger.GetWords(skillDisplay.Name); skillMix.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), card.templateID); } else { skillMixName.text = "无"; skillMix.text = ""; } cardCanEvl.spriteName = tab_card.NextCard == -1 ? "cannotEvl" : "canEvl"; isProtected.spriteName = card.isProtected ? "renwuxinxi_quxiaobaohu" : "renwuxinxi_baohu"; isProtected.MakePixelPerfect(); //学习技能 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId); if (studySkill != null) { string color = ""; switch (studySkill.SkillQuality) { case 0: color = "[2d8560]"; break; case 1: color = "[2368ad]"; break; case 2: color = "[852bed]"; break; default: break; } studySkillName.text = color + studySkill.SkillName; studySkillName.text += "[9d2f07] " + card.skillStudyLev + "/" + studySkill.SkillHighLevel; sdudySkillDes.text = ConvertAttType(studySkill.SkillDes, card.templateID); } else { studySkillName.text = "[a65a04]无"; sdudySkillDes.text = ""; } } break; } } }
/// <summary> /// 筛选卡牌 /// </summary> /// <returns></returns> private List <UserCardItem> CalculateShowItems() { cardListSort.Clear(); switch (skillHeroType) { case SkillHeroType.LEARN_MAIN: List <UserCardItem> cardInFigthArray = new List <UserCardItem>(); foreach (UserCardItem card in cardList) { if (Obj_MyselfPlayer.GetMe().learnMainHeroItem != null) { //跳过已选择主英雄 if (Obj_MyselfPlayer.GetMe().learnMainHeroItem.cardID == card.cardID) { continue; } else { bool isFind = false; for (int i = 0; i < Obj_MyselfPlayer.GetMe().teamMemberArray.Length; i++) { if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[i]) { cardInFigthArray.Add(card); isFind = true; break; } } if (!isFind) { cardListSort.Add(card); } } } else { bool isFind = false; for (int i = 0; i < Obj_MyselfPlayer.GetMe().teamMemberArray.Length; i++) { if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[i]) { cardInFigthArray.Add(card); isFind = true; break; } } if (!isFind) { cardListSort.Add(card); } } } cardListSort.Sort(CompareTo); if (cardListSort.Count > 0) { cardListSort.InsertRange(0, cardInFigthArray); } else { cardListSort.AddRange(cardInFigthArray); } //把选择的主英雄放在前面 if (Obj_MyselfPlayer.GetMe().learnMainHeroItem != null) { PutFirst(Obj_MyselfPlayer.GetMe().learnMainHeroItem.cardID); } break; case SkillHeroType.LEARN_CHILD: foreach (UserCardItem card in cardList) { //跳过主英雄 if (Obj_MyselfPlayer.GetMe().learnMainHeroItem.cardID == card.cardID) { continue; } //跳过在出阵侠士中的英雄 bool inTeam = IsInTeam(card); if (inTeam) { continue; } //跳过没有技能的英雄 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId); if (studySkill == null) { continue; } //跳过被保护英雄 if (card.isProtected) { continue; } if (Obj_MyselfPlayer.GetMe().learnChildHeroItem != null) { //跳过已选择子英雄 if (Obj_MyselfPlayer.GetMe().learnChildHeroItem.cardID == card.cardID) { continue; } else { cardListSort.Add(card); } } else { cardListSort.Add(card); } } cardListSort.Sort(SkillLevCompareTo); //把选择的子英雄放在前面 if (Obj_MyselfPlayer.GetMe().learnChildHeroItem != null) { PutFirst(Obj_MyselfPlayer.GetMe().learnChildHeroItem.cardID); } break; case SkillHeroType.UPDATE_MAIN: List <UserCardItem> cardInFigthArrayUpdate = new List <UserCardItem>(); foreach (UserCardItem card in cardList) { //跳过没有技能的英雄 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId); if (studySkill == null) { continue; } if (Obj_MyselfPlayer.GetMe().updateMainHeroItem != null) { //跳过已选择主英雄 if (Obj_MyselfPlayer.GetMe().updateMainHeroItem.cardID == card.cardID) { continue; } else { bool isFind = false; for (int i = 0; i < Obj_MyselfPlayer.GetMe().teamMemberArray.Length; i++) { if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[i]) { cardInFigthArrayUpdate.Add(card); isFind = true; break; } } if (!isFind) { cardListSort.Add(card); } } } else { bool isFind = false; for (int i = 0; i < Obj_MyselfPlayer.GetMe().teamMemberArray.Length; i++) { if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[i]) { cardInFigthArrayUpdate.Add(card); isFind = true; break; } } if (!isFind) { cardListSort.Add(card); } } } cardListSort.Sort(SkillLevCompareTo); if (cardListSort.Count > 0) { cardListSort.InsertRange(0, cardInFigthArrayUpdate); } else { cardListSort.AddRange(cardInFigthArrayUpdate); } //把选择的主英雄放在前面 if (Obj_MyselfPlayer.GetMe().updateMainHeroItem != null) { PutFirst(Obj_MyselfPlayer.GetMe().updateMainHeroItem.cardID); } break; case SkillHeroType.UPDATE_CHILD: foreach (UserCardItem card in cardList) { //跳过主英雄 if (Obj_MyselfPlayer.GetMe().updateMainHeroItem.cardID == card.cardID) { continue; } //跳过在出阵侠士中的英雄 bool inTeam = IsInTeam(card); if (inTeam) { continue; } //跳过没有技能的英雄和不是同技能组的英雄 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId); if (studySkill == null || studySkill.Skillgroup != TableManager.GetStudyskillByID(Obj_MyselfPlayer.GetMe().updateMainHeroItem.skillStudyId).Skillgroup) { continue; } //跳过被保护英雄 if (card.isProtected) { continue; } //跳过已选择吞噬英雄 if (Obj_MyselfPlayer.GetMe().updateChildHeroItems.Count > 0) { bool isFind = false; foreach (UserCardItem childCard in Obj_MyselfPlayer.GetMe().updateChildHeroItems) { if (childCard.cardID == card.cardID) { isFind = true; break; } } if (isFind) { continue; } } cardListSort.Add(card); } cardListSort.Sort(SkillExpCompareTo); //把已选择吞噬卡牌放在前面 List <UserCardItem> cardInSelectArray = new List <UserCardItem>(); for (int i = 0; i < Obj_MyselfPlayer.GetMe().updateChildHeroItems.Count; i++) { foreach (var card in cardList) { if (card.cardID == Obj_MyselfPlayer.GetMe().updateChildHeroItems[i].cardID) { cardInSelectArray.Add(card); break; } } } if (cardInSelectArray.Count > 0) { if (cardListSort.Count > 0) { cardListSort.InsertRange(0, cardInSelectArray); } else { cardListSort.AddRange(cardInSelectArray); } } break; default: break; } return(cardListSort); }