//设置属性面板显示 void SetCardPropPanel(CSItem card) { //升段前属性 int beaforLevel = card.Level; //当前等级 int beaforMaxLevel = card.GetMaxLevel(); //最大等级 m_danBefor.transform.Find("LevelTips").GetComponent <UILabel>().text = beaforLevel.ToString() + '/' + beaforMaxLevel.ToString(); GradeUpRequireInfo gradeInfo = GameTable.gradeUpRequireAsset.Lookup(card.m_id); if (null == gradeInfo) { return; } int beaforBreak = card.BreakCounts; //当前突破次数 int maxBreak = gradeInfo.GradeUpTime; //最大突破次数 m_danBefor.transform.Find("Dan").GetComponent <UILabel>().text = beaforBreak.ToString() + '/' + maxBreak.ToString(); int beaforHp = card.GetHp();//当前生命值 m_danBefor.transform.Find("HP").GetComponent <UILabel>().text = beaforHp.ToString(); int beaforAttack = card.GetPhyAttack();//物理攻击力 m_danBefor.transform.Find("Attack").GetComponent <UILabel>().text = beaforAttack.ToString(); int beaforMagAtt = card.GetMagAttack();//魔法攻击力 m_danBefor.transform.Find("MagAttack").GetComponent <UILabel>().text = beaforMagAtt.ToString(); //升段后属性 int afterLevel = card.Level; //升级后等级 int afterMaxLevel = card.GetMaxLevel() + gradeInfo.LevelLimitUp; //最大等级 m_danAfter.transform.Find("LevelTips").GetComponent <UILabel>().text = afterLevel.ToString() + '/' + afterMaxLevel.ToString(); int afterBreak = card.BreakCounts + 1;//当前突破次数 m_danAfter.transform.Find("Dan").GetComponent <UILabel>().text = afterBreak.ToString() + '/' + maxBreak.ToString(); int afterHp = card.GetHp() + gradeInfo.HpUp;//升级后生命值 m_danAfter.transform.Find("HP").GetComponent <UILabel>().text = afterHp.ToString() + "(+" + gradeInfo.HpUp.ToString() + ')'; int afterAttack = card.GetPhyAttack() + gradeInfo.AttackUp;//升级后攻击力 m_danAfter.transform.Find("Attack").GetComponent <UILabel>().text = afterAttack.ToString() + "(+" + gradeInfo.AttackUp.ToString() + ')'; int afterMagAtt = card.GetMagAttack() + gradeInfo.MagicAttackUp;//升级后攻击力 m_danAfter.transform.Find("MagAttack").GetComponent <UILabel>().text = afterMagAtt.ToString() + "(+" + gradeInfo.MagicAttackUp.ToString() + ')'; }
// 获得 对某个卡牌 赋予 经验值后 的等级和经验 public void GetLevelUpLVExp(CSItem card, int supplyExp, int breakCounts, out int level, out int exp) { level = 0; exp = 0; if (null == card) { return; } if (0 == supplyExp) { return; } int curLevel = card.Level; int curExp = card.Exp; LevelUpInfo info = GameTable.LevelUpTableAsset.LookUp(curLevel); HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); // 此卡 还可以突破的次数 int couldBreakCouts = heroInfo.BreakThroughCount - card.BreakCounts; if (couldBreakCouts > 0) { if (breakCounts > couldBreakCouts) { breakCounts = couldBreakCouts; } } int totalExp = supplyExp + curExp; int maxLevel = card.GetMaxLevel() + breakCounts * heroInfo.BreakThroughLevel; // 代表可以升级 if (totalExp > info.Monster_Exp) { // 用一个循环来算 100 是一个 够用范围 for (int i = 0; i < 100; i++) { // 不超过最大等级上限 if (curLevel >= maxLevel) { break; } info = GameTable.LevelUpTableAsset.LookUp(curLevel); curExp = totalExp - info.Monster_Exp; if (curExp < 0) { break; } totalExp = curExp; curLevel++; } } level = curLevel; exp = totalExp; }
// 更新 强化成功信息 并显示出来 void UpdateSuccessInfo() { m_success.gameObject.SetActive(true); CSItem card = CardBag.Singleton.GetCardByGuid(CardUpdateProp.Singleton.m_levelUpAfterGuid); if (null == card) { return; } HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == info) { return; } IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId); if (null == imageInfo) { return; } // 突破次数 int breakNum = card.BreakCounts - CardUpdateProp.Singleton.m_oldBreak; if (breakNum > 0) { m_successBreak.text = string.Format(Localization.Get("BreakNum"), breakNum); } else { m_successBreak.text = ""; } m_successCardBG.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName); // 升级前的数据 m_oldLv.text = CardUpdateProp.Singleton.m_oldLevelTips; m_oldHp.text = "" + CardUpdateProp.Singleton.m_oldHP; m_oldMagAttack.text = "" + CardUpdateProp.Singleton.m_oldMagAtk; m_oldPhyAttack.text = "" + CardUpdateProp.Singleton.m_oldPhyAtk; // 升级后的数据 m_newLv.text = card.Level + "/" + card.GetMaxLevel(); m_newHp.text = "" + (int)card.GetHp(); m_newMagAttack.text = "" + card.GetMagAttack(); m_newPhyAttack.text = "" + card.GetPhyAttack(); }
// 设置升级前的 老数据 public void SetOldData() { CSItem card = CardBag.Singleton.GetCardByGuid(m_curLevelGuid); if (null == card) { return; } m_oldLevel = card.Level; m_oldLevelTips = card.Level + "/" + card.GetMaxLevel(); m_oldHP = card.GetHp(); m_oldBreak = card.BreakCounts; m_oldMagAtk = card.GetMagAttack(); m_oldPhyAtk = card.GetPhyAttack(); // 记录 技能相关信息 SetOldSkillData(); }
// 更新信息 void UpdateInfo() { CSItem card = CardBag.Singleton.m_cardForDetail; if (null == card) { return; } // 如果卡牌ID为0则 是用预览卡牌(不是背包里的卡牌) 此时 加到最爱 进化 强化等按钮不显示 if (CardBag.Singleton.m_curOptinGuid.Equals(CSItemGuid.Zero)) { m_levelUpBtn.gameObject.SetActive(false); m_evolutionBtn.gameObject.SetActive(false); m_breachBtn.gameObject.SetActive(false); } else { m_levelUpBtn.gameObject.SetActive(card.IsStengthen()); m_evolutionBtn.gameObject.SetActive(card.IsEvlotion()); m_breachBtn.gameObject.SetActive(true); } m_grid.Reposition(); AddModel(card, m_model); HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == heroInfo) { Debug.LogWarning("heroInfo == NULL heroInfo cardID:" + card.IDInTable); return; } m_cardPanel.Update(card.IDInTable); IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId); OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation); RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type); // LevelUpInfo levelupInfo = GameTable.LevelUpTableAsset.LookUp(card.Level); m_cost.text = "" + heroInfo.Cost; m_phyAttack.text = "" + (int)card.GetPhyAttack(); m_magAttack.text = "" + (int)card.GetMagAttack(); m_hp.text = "" + (int)card.GetHp(); m_occupation.text = occupationInfo.m_name; m_type.text = raceInfo.m_name; m_curLevel.text = "" + card.Level; m_maxLevel.GetComponent <UILabel>().text = card.GetMaxLevel().ToString(); IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId); m_occTexture.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName); icon = GameTable.IconInfoTableAsset.Lookup(raceInfo.m_iconId); m_raceTexture.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName); // 段位升级 UpdateDanData(card.BreakCounts); foreach (UICardDetailSkillItem item in m_skillList) { if (null != item) { item.HideWindow(); } } foreach (UICardDetailSkillItem item in m_passvieSkillList) { if (null != item) { item.HideWindow(); } } int i = 0; List <int> skillIDList = heroInfo.GetAllSkillIDList(); foreach (int skillId in skillIDList) { if (0 != heroInfo.NormalSkillIDList.Find(item => item == skillId)) { continue; } SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId); if (null == skillInfo) { continue; } // 普通技能才被列入 if (skillInfo.SkillType != 0) { continue; } iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); if (null == iconInfo) { continue; } if (i < m_skillList.Length) { UICardDetailSkillItem item = m_skillList[i]; if (null == item) { item = UICardDetailSkillItem.Create(); m_skillList[i] = item; item.SetParent(m_skillParent.transform); item.SetPressCallbacked(OnShowTips); item.SetClickCallbacked(OnHideTips); } item.ShowWindow(); item.Update(skillId); i++; } } m_skillParent.GetComponent <UIGrid>().Reposition(); i = 0; bool bNone = true; foreach (int skillId in heroInfo.PassiveSkillIDList) { SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId); if (null == skillInfo) { continue; } iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); if (null == iconInfo) { continue; } if (i >= m_passvieSkillList.Length) { continue; } bNone = false; UICardDetailSkillItem item = m_passvieSkillList[i]; if (null == item) { item = UICardDetailSkillItem.Create(); m_passvieSkillList[i] = item; item.SetParent(m_passiveSkillParent.transform); item.SetPressCallbacked(OnShowTips); item.SetClickCallbacked(OnHideTips); } item.ShowWindow(); item.Update(skillId); i++; } m_passiveSkillParent.GetComponent <UIGrid>().Reposition(); m_skillNoneLabel.gameObject.SetActive(bNone); }
//设置属性面板显示 void SetCardPropPanel(CSItem card) { //进阶前属性 int beaforLevel = card.Level; //当前等级 int beaforMaxLevel = card.GetMaxLevel(); //最大等级 m_evolutionBefore.transform.Find("LevelTips").GetComponent <UILabel>().text = beaforLevel.ToString() + '/' + beaforMaxLevel.ToString(); int beaforHp = card.GetHp();//当前生命值 m_evolutionBefore.transform.Find("HP").GetComponent <UILabel>().text = beaforHp.ToString(); int beaforAttack = card.GetPhyAttack();//物理攻击力 m_evolutionBefore.transform.Find("Attack").GetComponent <UILabel>().text = beaforAttack.ToString(); int beaforMagAtt = card.GetMagAttack();//魔法攻击力 m_evolutionBefore.transform.Find("MagAttack").GetComponent <UILabel>().text = beaforMagAtt.ToString(); HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == info) { Debug.Log("UICardEvolution HeroInfo == null card.m_id:" + card.IDInTable); return; } HeroInfo afterInfo = GameTable.HeroInfoTableAsset.Lookup(info.EvolveChangeID); if (null == afterInfo) { Debug.Log("UICardEvolution afterInfo == null card.m_id:" + info.EvolveChangeID); return; } //进阶后属性 int afterLevel = 1; //升级后等级 int afterMaxLevel = card.GetMaxLevel() + afterInfo.MaxLevel; //最大等级 m_evolutionAfter.transform.Find("LevelTips").GetComponent <UILabel>().text = afterLevel.ToString() + '/' + afterMaxLevel.ToString(); m_evolutionAfter.transform.Find("LevelTips").GetComponent <UILabel>().color = Color.red; int afterHp = (int)afterInfo.FHPMax;//升级后生命值 m_evolutionAfter.transform.Find("HP").GetComponent <UILabel>().text = afterHp.ToString(); if (afterHp > beaforHp) { m_evolutionAfter.transform.Find("HP").GetComponent <UILabel>().color = Color.green; } else { m_evolutionAfter.transform.Find("HP").GetComponent <UILabel>().color = Color.red; } int afterAttack = (int)afterInfo.FPhyAttack;//升级后攻击力 m_evolutionAfter.transform.Find("Attack").GetComponent <UILabel>().text = afterAttack.ToString(); if (afterAttack > beaforAttack) { m_evolutionAfter.transform.Find("Attack").GetComponent <UILabel>().color = Color.green; } else { m_evolutionAfter.transform.Find("Attack").GetComponent <UILabel>().color = Color.red; } int afterMagAtt = (int)afterInfo.FMagAttack;//升级后攻击力 m_evolutionAfter.transform.Find("MagAttack").GetComponent <UILabel>().text = afterMagAtt.ToString(); if (afterMagAtt > beaforMagAtt) { m_evolutionAfter.transform.Find("MagAttack").GetComponent <UILabel>().color = Color.green; } else { m_evolutionAfter.transform.Find("MagAttack").GetComponent <UILabel>().color = Color.red; } }
public void Update(CSItem card, ENSortType sortType, int index = 0) { if (null == card) { return; } ShowWindow(); m_index = index; // 表示 用显示卡牌详情 int cardID = card.IDInTable; m_bg.gameObject.SetActive(true); HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID); if (heroInfo != null) { // 道具ID m_param.m_guid = card.Guid; // 头像 IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.headImageId); if (null != iconInfo) { m_headImage.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); } // 等级 m_level.gameObject.SetActive(true); // 排序后的 应显示的 属性 switch (sortType) { case ENSortType.enByRarity: { m_level.text = heroInfo.Rarity.ToString(); break; } case ENSortType.enByPhyAttack: { m_level.text = card.GetPhyAttack().ToString(); break; } case ENSortType.enByMagAttack: { m_level.text = card.GetMagAttack().ToString(); break; } case ENSortType.enByHp: { m_level.text = card.GetHp().ToString(); break; } default: int levelMax = card.GetMaxLevel(); if (card.Level >= levelMax) { m_level.text = Localization.Get("MaxCardLevel"); } else { m_level.text = Localization.Get("CardLevel") + card.Level; } break; } // 文字闪现 播放一致 m_chosen.GetComponent <TweenAlpha>().ResetToBeginning(); // 是否在编队中 m_chosen.SetActive(Team.Singleton.IsCardInTeam(card.Guid)); // 是否是最爱 m_love.gameObject.SetActive(card.Love); m_defaultHead.gameObject.SetActive(false); // 职业 OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation); if (null != occupationInfo) { iconInfo = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId); if (null != iconInfo) { m_occ.gameObject.SetActive(true); m_occ.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); } } RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity); if (null != rarityInfo) { iconInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId); m_rarity.gameObject.SetActive(true); m_rarity.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); } } }