public void Load(byte[] bytes) { BinaryHelper helper = new BinaryHelper(bytes); int length = helper.ReadInt(); m_ringExchangeTableInfoList = new List <RingExchangeTableInfo>(length); for (int index = 0; index < length; ++index) { RingExchangeTableInfo info = new RingExchangeTableInfo(); info.Load(helper); m_ringExchangeTableInfoList.Add(info); } }
//更新荣誉戒指商店界面 void UpDateRingOfHonorShopUI() { int ring = User.Singleton.UserProps.GetProperty_Int32(UserProperty.ring); int index = 1; foreach (RingOfHonorInfo item in ShopProp.Singleton.m_ringOfHonorList) { UIDragScrollView copy = GameObject.Instantiate(m_ringItem) as UIDragScrollView; copy.GetComponent <Parma>().m_id = item.m_infoId; copy.GetComponent <Parma>().m_type = item.m_cardId; copy.transform.Find("Exchange").GetComponent <UIButton>().transform.Find("RingNum").GetComponent <UILabel>().text = item.m_price.ToString(); //如果戒指数量不足 按钮为灰色 if (ring < item.m_price) { copy.transform.Find("Exchange").GetComponent <UIButton>().enabled = false; } //设置卡牌显示 兑换时间 RingExchangeTableInfo info = GameTable.RingExchangeTableAsset.Lookup(item.m_infoId); UISlider timeSlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("ExchangeTime").GetComponent <UISlider>(); timeSlider.transform.Find("StartTime").GetComponent <UILabel>().text = info.startDate + "~"; timeSlider.transform.Find("EndTime").GetComponent <UILabel>().text = info.endDate; //获得卡牌信息 HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(item.m_cardId); //设置卡牌名字 copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("Name").GetComponent <UILabel>().text = heroInfo.StrName; copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("Name").GetComponent <UILabel>().text = heroInfo.StrName; //设置种族职业 UISlider typeSlider = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("TypePanel").GetComponent <UISlider>(); typeSlider.transform.Find("Type").GetComponent <UILabel>().text = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type).m_name; UISlider occupationSlider = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("OccupationPanel").GetComponent <UISlider>(); occupationSlider.transform.Find("Occupation").GetComponent <UILabel>().text = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation).m_name; UITexture occupationSprite = occupationSlider.transform.Find("Texture").GetComponent <UITexture>(); //设置职业图标 OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation); IconInfomation occicon = GameTable.IconInfoTableAsset.Lookup(occInfo.m_iconId); occupationSprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(occicon.dirName); //设置星级 UISlider raritySlider = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("RarityPanel").GetComponent <UISlider>(); RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity); IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId); raritySlider.transform.Find("Rarity").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName); icon = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId); //设置卡牌图片 copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("Card").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName); //设置魔法攻击力 UISlider magicSlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("MaxMagAttackPanel").GetComponent <UISlider>(); // RarityRelativeInfo rarityRelative = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity); magicSlider.transform.Find("MagAttackNum").GetComponent <UILabel>().text = BattleFormula.GetMagAttack(item.m_cardId, 1) + ""; UISlider phySlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("MaxPhyAttackPanel").GetComponent <UISlider>(); phySlider.transform.Find("PhyAttackNum").GetComponent <UILabel>().text = BattleFormula.GetPhyAttack(item.m_cardId, 1) + ""; //设置生命值 UISlider hpSlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("MaxHpPanel").GetComponent <UISlider>(); hpSlider.transform.Find("MaxHpNum").GetComponent <UILabel>().text = BattleFormula.GetHp(item.m_cardId, 1) + ""; //设置卡牌编号 UILabel cardNum = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("CardNumText").GetComponent <UILabel>(); cardNum.text = string.Format(Localization.Get("MercenaryNum"), heroInfo.CardId); copy.transform.parent = FindChildComponent <UIGrid>("CardGridList").transform; // 设置大小 copy.transform.localScale = m_ringItem.transform.localScale; copy.gameObject.SetActive(true); //设置主动技能 IconInfomation iconInfo = null; SkillInfo skillInfo = null; int skillIndex = 1; List <int> skillIDList = heroInfo.GetAllSkillIDList(); foreach (int skillId in skillIDList) { skillInfo = GameTable.SkillTableAsset.Lookup(skillId); if (0 == skillInfo.SkillType) { UITexture copySkillItem = GameObject.Instantiate(m_skillItem) as UITexture; copySkillItem.GetComponent <Parma>().m_id = skillId; copySkillItem.transform.localScale = m_skillItem.transform.lossyScale; copySkillItem.gameObject.SetActive(true); iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); copySkillItem.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); copySkillItem.name = copySkillItem.name + skillIndex; copySkillItem.transform.parent = copy.transform.Find("CardDetail").transform.Find("Skill").transform; EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onPress, OnShowTips); EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onClick, OnHideTips); //AddChildMouseClickEvent(copySkillItem.name, OnHideTips); } skillIndex++; } m_skillGirdList.Reposition(); //设置被动技能 int passiveIndex = 1; foreach (int skillId in heroInfo.PassiveSkillIDList) { skillInfo = GameTable.SkillTableAsset.Lookup(skillId); if (0 == skillInfo.SkillType) { UISprite copySkillItem = m_skillItem.gameObject.AddComponent <UISprite>(); copySkillItem.GetComponent <Parma>().m_id = skillId; copySkillItem.transform.localScale = m_skillItem.transform.lossyScale; copySkillItem.gameObject.SetActive(true); iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); copySkillItem.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); copySkillItem.name = copySkillItem.name + skillIndex; copySkillItem.transform.parent = copy.transform.Find("CardDetail").transform.Find("PassiveSkill").transform; EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onPress, OnShowTips); EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onClick, OnHideTips); //AddChildMouseClickEvent(copySkillItem.name, OnHideTips); } passiveIndex++; } m_ringHonorGridList.Add(index, copy); AddMouseClickEvent(copy.transform.Find("Exchange").gameObject, OnBuyRingCardButton); index++; } for (; index < m_ringHonorGridList.Count; index++) { m_ringHonorGridList[index].gameObject.SetActive(false); m_ringHonorGridList[index].GetComponent <Parma>().m_id = 0; m_ringHonorGridList[index].GetComponent <Parma>().m_type = 0; } m_cardGridList.Reposition(); }