//设置公式一升段素材 void SetFormulaOneMaterial(GradeUpRequireInfo info, CSItem card) { SetCostMoney(info.Formula1_Cost);//设置公式一升段所需金钱 //设置素材卡牌头像 与 段位升级卡头像相同 UICardHead tempCardHead = UICardHead.Create(); m_materialList.Add(tempCardHead);//加入到素材列表 tempCardHead.SetParent(m_materialSpritList[0].transform); tempCardHead.SetLocalPosition(Vector3.zero); //获得公式一卡牌 CSItem materialCard = User.Singleton.ItemBag.GetCardBuyIdCardDivisionFormula(card); CardDivisionUpdateProp.Singleton.AddMaterialCard(materialCard); if (null == materialCard) //如果背包里只有一张升段卡牌或者没有所需卡牌时 { tempCardHead.SetCardMask(true); //素材显示黑色遮罩 //升段确定按钮不可点击 m_buttonOk.isEnabled = false; //如果背包里面没有这张卡则创建一张只带有ID的卡牌从表里读取信息 CSItem tempCard = new CSItem(); tempCard.m_id = card.m_id; tempCardHead.SetCardInfo(tempCard); } else { m_materialSpritList[0].GetComponent <Parma>().m_type = 1; //如果表里有这张卡 则显示素材卡信息 tempCardHead.SetCardInfo(materialCard); } tempCardHead.RegisterCallBack(null, PressCardHead); tempCardHead.ShowCard(); tempCardHead.SetCardInfoShow(false); tempCardHead.SetCardLoveShow(false); }
//设置其他公式升段素材 void SetFormulaMaterial(GradeUpRequireInfo info, CSItem card, int formulaIndex) { FormulaInfo tempFormula = info.FormulaList[formulaIndex - 2]; if (null == tempFormula) { return; } //设置金币数量 int cost = tempFormula.Formula_Cost; SetCostMoney(cost); //设置素材卡牌 for (int i = 0; i < tempFormula.Param_Num; i++) { switch (tempFormula.ParamList[i].paramType) { case (int)MaterialType.enAppoint: AddAppointCard(m_materialSpritList[i], tempFormula.ParamList[i], i); break; case (int)MaterialType.enUnAppoint: AddUnAppoint(m_materialSpritList[i], tempFormula.ParamList[i]); break; case (int)MaterialType.enRingOfHonor: AddRingOfHonor(m_materialSpritList[i], tempFormula.ParamList[i]); break; default: break; } } }
//设置属性面板显示 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 Load(byte[] bytes) { BinaryHelper helper = new BinaryHelper(bytes); int length = helper.ReadInt(); GradeUpInfoList = new List <GradeUpRequireInfo>(length); for (int index = 0; index < length; ++index) { GradeUpRequireInfo info = new GradeUpRequireInfo(); info.Load(helper); GradeUpInfoList.Add(info); } }
//检查素材是否齐全 void CheckMaterialEnough(GradeUpRequireInfo gradeInfo) { if (null == gradeInfo) { return; } int money = User.Singleton.UserProps.GetProperty_Int32(UserProperty.money); bool isCanDivision = true; int curtFormula = CardDivisionUpdateProp.Singleton.m_curtFormula; int costMoney = 0; if (curtFormula == (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaOne) { costMoney = gradeInfo.Formula1_Cost; if (m_materialSpritList[0].GetComponent <Parma>().m_type == 0) { isCanDivision = false; } } else { FormulaInfo tempFormula = gradeInfo.FormulaList[curtFormula - 2]; if (null == tempFormula) { return; } costMoney = tempFormula.Formula_Cost; //检查素材 for (int i = 0; i < tempFormula.Param_Num; i++) { if (m_materialSpritList[i].GetComponent <Parma>().m_type == 0) { isCanDivision = false; } } } if (money < costMoney) { isCanDivision = false; } m_buttonOk.isEnabled = isCanDivision; }
//点击已经选择的素材卡牌头像 显示素材卡牌界面 void OnClickCardHeadChooseMaterial(CSItem temp, int materialId) { CSItem card = CardBag.Singleton.GetCardByGuid(CardDivisionUpdateProp.Singleton.m_curDivisionCardGuid); //设置素材卡牌 GradeUpRequireInfo gradeInfo = GameTable.gradeUpRequireAsset.Lookup(card.m_id); if (null == gradeInfo) { return; } int curtFormula = CardDivisionUpdateProp.Singleton.m_curtFormula; FormulaInfo tempFormula = gradeInfo.FormulaList[curtFormula - 2]; if (null == tempFormula) { return; } FormulaParam param = tempFormula.ParamList[materialId]; OperateCardList.Singleton.OnShowDivisionCard(param.paramOccu, param.paramLevel, param.paramRarity, materialId); MainUIManager.Singleton.OnSwitchSingelUI(MainUIManager.EDUITYPE.enOperaterCardList); }
//设置公式按钮 void SetFormulaButton(GradeUpRequireInfo gradeInfo) { m_formulaButton4.isEnabled = (gradeInfo.FormulaNum < (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaFour ? false : true); m_formulaButton3.isEnabled = (gradeInfo.FormulaNum < (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaThree ? false : true); m_formulaButton2.isEnabled = (gradeInfo.FormulaNum < (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaTwo ? false : true); }
//更新段位升级界面上所有信息 void UpdateInfo() { //设置段位升级前卡牌头像 if (null == m_cardBeforHead) { m_cardBeforHead = UICardHead.Create(); m_cardBeforHead.SetParent(m_cardBefor); m_cardBeforHead.SetLocalPosition(Vector3.zero); } CSItem card = CardBag.Singleton.GetCardByGuid(CardDivisionUpdateProp.Singleton.m_curDivisionCardGuid); if (null == card) { return; } m_cardBeforHead.SetCardInfo(card); m_cardBeforHead.RegisterCallBack(null, PressCardHead); m_cardBeforHead.ShowCard(); m_cardBeforHead.SetCardInfoShow(false); m_cardBeforHead.SetCardLoveShow(false); //设置段位升级后卡牌头像 if (null == m_cardAfterHead) { m_cardAfterHead = UICardHead.Create(); m_cardAfterHead.SetParent(m_cardAfter); m_cardAfterHead.SetLocalPosition(Vector3.zero); } m_cardAfterHead.SetCardInfo(card); m_cardAfterHead.RegisterCallBack(null, PressCardHead); m_cardAfterHead.ShowCard(); m_cardAfterHead.SetCardInfoShow(false); m_cardAfterHead.SetCardLoveShow(false); //设置素材卡牌 GradeUpRequireInfo gradeInfo = GameTable.gradeUpRequireAsset.Lookup(card.m_id); if (null == gradeInfo) { return; } int curtFormula = CardDivisionUpdateProp.Singleton.m_curtFormula; //根据当前选择公式 显示素材卡牌 switch (curtFormula) { case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaOne: SetFormulaOneMaterial(gradeInfo, card); break; case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaTwo: SetFormulaMaterial(gradeInfo, card, curtFormula); break; case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaThree: SetFormulaMaterial(gradeInfo, card, curtFormula); break; case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaFour: SetFormulaMaterial(gradeInfo, card, curtFormula); break; default: break; } //设置属性面板显示 SetCardPropPanel(card); //设置公式按钮 SetFormulaButton(gradeInfo); //设置3D动态头像 SetCard3DHead(card); //检查素材是否齐全 CheckMaterialEnough(gradeInfo); }
// 更新选项界面 void UpdateOption() { m_option.gameObject.SetActive(true); CSItem card = CardBag.Singleton.GetCardByGuid(CardBag.Singleton.m_curOptinGuid); HeroInfo hero = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(hero.headImageId); RaceInfo race = GameTable.RaceInfoTableAsset.LookUp(hero.Type); OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(hero.Occupation); RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(hero.Rarity); IconInfomation rarityIconInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId); //设置角色头像图片 m_cardInfoMain.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName); //设置星级图标 m_rarityTexture.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(rarityIconInfo.dirName); //设置种族图标 IconInfomation raceIcon = GameTable.IconInfoTableAsset.Lookup(race.m_iconId); m_cardInfoRace.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(raceIcon.dirName); //设置职业图标 IconInfomation occIcon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId); m_cardInfoOccupation.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(occIcon.dirName); m_optionName.text = hero.StrName; m_optionLevel.text = Localization.Get("CardLevel") + card.Level; m_opInfoOp.text = occupationInfo.m_name; m_optionHp.text = "" + card.GetHp(); m_optionMagAttack.text = "" + card.GetMagAttack(); m_optionPhyAttack.text = "" + card.GetPhyAttack(); m_optionRace.text = race.m_name; //根据是否为最爱 决定按钮显示 图片和头像图标显示 if (card.Love) { //button 按钮换图片 WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enCancelLoveImageName); m_joinLoveSprite.spriteName = worldInfo.StringTypeValue; //显示最爱图标 m_cardInfoLove.gameObject.SetActive(true); } else { //button 按钮换图片 WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enJoinLoveImageName); m_joinLoveSprite.spriteName = worldInfo.StringTypeValue; //隐藏最爱图标 m_cardInfoLove.gameObject.SetActive(false); } // 可强化 if (card.IsStengthen()) { m_stengThen.isEnabled = true; } else { m_stengThen.isEnabled = false; } //设置素材卡牌 GradeUpRequireInfo gradeInfo = GameTable.gradeUpRequireAsset.Lookup(card.m_id); if (null == gradeInfo) { return; } // 是否达到进化所需等级 if (card.IsEvlotion() && card.BreakCounts < gradeInfo.GradeUpTime) { m_evlotion.isEnabled = true; } else { m_evlotion.isEnabled = false; } //是否是代表卡 m_deputyLabel.gameObject.SetActive(false); m_chosenLable.gameObject.SetActive(false); if (User.Singleton.RepresentativeCard == CardBag.Singleton.m_curOptinGuid) { m_deputyLabel.gameObject.SetActive(true); } else { if (Team.Singleton.IsCardInTeam(CardBag.Singleton.m_curOptinGuid)) { m_chosenLable.gameObject.SetActive(true); } } //判断是否可以段位升级(待设定) }