//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); } } } } }
void RefreshUI(bool bFirstShow) { Calculate(); if (heroCardItem != null) { heroObject.gameObject.SetActive(true); addIcon.SetActive(false); heroLevel.gameObject.SetActive(true); hpStrengthenValue.gameObject.SetActive(true); hpCurValue.gameObject.SetActive(true); hpCostMoney.gameObject.SetActive(true); hpConfirm.isEnabled = true; attSthValue.gameObject.SetActive(true); attCurValue.gameObject.SetActive(true); attCostMoney.gameObject.SetActive(true); attConfirm.isEnabled = true; heroObject.GetComponent <CardLarge>().SetCardTemplateID(heroCardItem.templateID); heroLevel.text = heroCardItem.level + "/" + TableManager.GetCardByID(heroCardItem.templateID).MaxLevel; //hpStrengthInfo.SetActive(true); //AttStrengthInfo.SetActive(true); if (bFirstShow) { attTimeValue.gameObject.SetActive(false); attTimeValue.transform.GetComponent <TweenAlpha>().enabled = false; attTimeValue.transform.GetComponent <TweenAlpha>().Reset(); attTimeValue.transform.GetComponent <TweenAlpha>().from = 0; attTimeValue.transform.GetComponent <TweenAlpha>().to = 1; attAddValue.gameObject.SetActive(true); attAddValue.transform.GetComponent <TweenAlpha>().enabled = true; attAddValue.transform.GetComponent <TweenAlpha>().Reset(); attAddValue.transform.GetComponent <TweenAlpha>().from = 0; attAddValue.transform.GetComponent <TweenAlpha>().to = 1; hpTimeValue.gameObject.SetActive(false); hpTimeValue.transform.GetComponent <TweenAlpha>().enabled = false; hpTimeValue.transform.GetComponent <TweenAlpha>().Reset(); hpTimeValue.transform.GetComponent <TweenAlpha>().from = 0; hpTimeValue.transform.GetComponent <TweenAlpha>().to = 1; hpAddValue.gameObject.SetActive(true); hpAddValue.transform.GetComponent <TweenAlpha>().enabled = true; hpAddValue.transform.GetComponent <TweenAlpha>().Reset(); hpAddValue.transform.GetComponent <TweenAlpha>().from = 0; hpAddValue.transform.GetComponent <TweenAlpha>().to = 1; } //生命强化-- //hpCurValue.text = heroCardItem.GetHp().ToString(); hpCurValue.text = (heroCardItem.GetHpBase() + heroCardItem.GetFengShuiHp() + heroCardItem.GetStudySkillHp()).ToString(); hpAddValue.text = "+" + heroCardItem.GetHpAdd().ToString(); hpCostMoney.text = ((heroCardItem.addQualityHp + 1) * 6000).ToString(); this.FreshStrenthLeftTime(); //hpCostItem.text = "1/" + hpItemCount.ToString(); if (isCanHpSth && heroCardItem.addQualityHp < 99 && Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP) > 0) { hpConfirm.isEnabled = true; } else { hpConfirm.isEnabled = false; } attCurValue.text = (heroCardItem.GetAttackBase() + heroCardItem.GetFengShuiAttc()).ToString(); attAddValue.text = "+" + heroCardItem.GetAttackAdd().ToString(); attCostMoney.text = ((heroCardItem.addQualityAtt + 1) * 6000).ToString(); //attCostItem.text = "1/" + attItemCount.ToString(); if (isCanAttSth && heroCardItem.addQualityAtt < 99 && Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK) > 0) { attConfirm.isEnabled = true; } else { attConfirm.isEnabled = false; } //当强化到最高99次时不可强化 /* * if () * { * attConfirm.isEnabled = false; * //attConfirmBtnLabel.text = "强化已达上限"; * // attConfirmBtnLabel.color = Color.grey; * //attSthValue.color = Color.white; * //attSthValue.gameObject.SetActive(false); * } * else if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK) > 0) * { * attConfirm.isEnabled = true; * // attConfirmBtnLabel.text = "大力丸"; * // attConfirmBtnLabel.color = Color.white; * // attSthValue.color = Color.white; * // attSthValue.gameObject.SetActive(true); * } * else * { * attConfirm.isEnabled = false; * // attConfirmBtnLabel.text = "大力丸"; * // attConfirmBtnLabel.color = Color.white; * //attSthValue.color = Color.red; * attSthValue.gameObject.SetActive(true); * } * * * if (heroCardItem.addQualityHp == 99) * { * hpConfirm.isEnabled = false; * hpComfirmBtnLabel.text = "强化已达上限"; * hpComfirmBtnLabel.color = Color.grey; * hpStrengthenValue.color = Color.white; * hpStrengthenValue.gameObject.SetActive(false); * } * else if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP) > 0) * { * hpConfirm.isEnabled = true; * hpComfirmBtnLabel.text = "强身丸"; * hpStrengthenValue.gameObject.SetActive(true); * hpComfirmBtnLabel.color = Color.white; * hpStrengthenValue.color = Color.white; * } * else * { * hpConfirm.isEnabled = false; * hpComfirmBtnLabel.text = "强身丸"; * hpStrengthenValue.gameObject.SetActive(true); * hpComfirmBtnLabel.color = Color.white; * hpStrengthenValue.color = Color.red; * } */ if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP) <= 99) { hpStrengthenValue.text = "X" + Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP); hpAddIcon.SetActive(false); } else { hpStrengthenValue.text = "X" + 99; hpAddIcon.SetActive(true); } if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK) <= 99) { attSthValue.text = "X" + Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK); AttAddIcon.SetActive(false); } else { attSthValue.text = "X" + 99; AttAddIcon.SetActive(true); } } else { heroObject.gameObject.SetActive(false); addIcon.SetActive(true); heroLevel.gameObject.SetActive(false); //cb:这里需要默认显示数量 // hpStrengthenValue.gameObject.SetActive(false); hpCurValue.gameObject.SetActive(false); hpAddValue.gameObject.SetActive(false); hpTimeValue.gameObject.SetActive(false); hpCostMoney.gameObject.SetActive(false); hpConfirm.isEnabled = false; //cb:这里需要默认显示数量 // attSthValue.gameObject.SetActive(false); attCurValue.gameObject.SetActive(false); attAddValue.gameObject.SetActive(false); attTimeValue.gameObject.SetActive(false); attCostMoney.gameObject.SetActive(false); attConfirm.isEnabled = false; attConfirmBtnLabel.text = "大力丸"; hpComfirmBtnLabel.text = "强身丸"; attSthValue.gameObject.SetActive(true); hpStrengthenValue.gameObject.SetActive(true); attConfirmBtnLabel.color = Color.white; hpComfirmBtnLabel.color = Color.white; //hpStrengthInfo.SetActive(false); //AttStrengthInfo.SetActive(false); //药品数量为零的提示显示 if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP) > 0) { hpStrengthenValue.color = Color.white; } else { hpStrengthenValue.color = Color.red; } if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP) <= 99) { hpStrengthenValue.text = "X" + Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.HP); hpAddIcon.SetActive(false); } else { hpStrengthenValue.text = "X" + 99; hpAddIcon.SetActive(true); } if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK) > 0) { attSthValue.color = Color.white; } else { attSthValue.color = Color.red; } if (Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK) <= 99) { attSthValue.text = "X" + Obj_MyselfPlayer.GetMe().GetItemCountByType(ItemType.ATTACK); AttAddIcon.SetActive(false); } else { attSthValue.text = "X" + 99; AttAddIcon.SetActive(true); } } }