public void OnClickAddFightNum() { //VipTemplate vip = (VipTemplate)DataTemplate.GetInstance().m_VipTable.getTableData(info.VipLevel); VipTemplate vip = DataTemplate.GetInstance().GetVipTemplateById(info.VipLevel); if (vip.getStageResetBuyTimes() > 0) { if (data.m_BuyBattleNum == vip.getStageResetBuyTimes()) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("fight_stagepurchase_tip1"), MsgBoxGroup); } else { if (needGoldNum <= info.Gold) { CBuyStateBattleNum cbuy = new CBuyStateBattleNum(); cbuy.buytype = 2; cbuy.battleid = info.CurStageID; IOControler.GetInstance().SendProtocol(cbuy); if (UI_HomeControler.Inst != null) { UI_HomeControler.Inst.ReMoveUI(UI_MaxFightManage.UI_ResPath); } else { UI_FightControler.Inst.ReMoveUI(UI_MaxFightManage.UI_ResPath); } } else { InterfaceControler.GetInst().ShowGoldNotEnougth(this.transform); } } } else { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("fight_stagepurchase_tip1"), MsgBoxGroup); } }
/// <summary> /// 当前关卡是否有重置次数-- 返回剩余次数; /// </summary> /// <returns></returns> public int isEnoughResetCount() { StageData obj = ObjectSelf.GetInstance().BattleStageData.GetStageDataByStageId(mStageT.GetID()); if (obj != null) { int vipLevel = ObjectSelf.GetInstance().VipLevel; VipTemplate pRow = (VipTemplate)DataTemplate.GetInstance().m_VipTable.getTableData(vipLevel); if (pRow != null) { return(pRow.getStageResetBuyTimes() - obj.m_BuyBattleNum); } } return(-1); }
public override void InitUIData() { base.InitUIData(); MsgBoxGroup = selfTransform.FindChild("MsgBoxGroup"); selfTransform.FindChild("ContinueButton").GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickAddFightNum)); selfTransform.FindChild("ReturnButton").GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(OnCloseFightBuy)); powerBuyNum = selfTransform.FindChild("BuyNum").GetComponent <Text>(); needGold = selfTransform.FindChild("NeedGold/Text").GetComponent <Text>(); allGold = selfTransform.FindChild("AllGold/Text").GetComponent <Text>(); info = ObjectSelf.GetInstance(); //if (info.GetIsPrompt()) //{ // list = info.BattleStageData.m_BattleStageList[1001]; //} //else //{ // if (info.BattleStageData.m_BattleStageList.ContainsKey(info.GetCurChapterID())) // { // list = info.BattleStageData.m_BattleStageList[info.GetCurChapterID()]; // } //} BattleStage bs = StageModule.GetPlayerBattleStageInfo(); if (bs != null) { list = bs; } data = list == null ? null : list.GetStageData(info.CurStageID); //VipTemplate vip = (VipTemplate)DataTemplate.GetInstance().m_VipTable.getTableData(info.VipLevel); //StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(info.CurStageID); VipTemplate vip = DataTemplate.GetInstance().GetVipTemplateById(info.VipLevel); StageTemplate stageinfo = StageModule.GetStageTemplateById(info.CurStageID); int[] needGoldList = stageinfo.m_resetCost; if (needGoldList.Length > 0) { if (vip.getStageResetBuyTimes() > 0) { if (data.m_BuyBattleNum == vip.getStageResetBuyTimes()) { needGoldNum = needGoldList[needGoldList.Length - 1]; } else { if (needGoldList.Length < data.m_BuyBattleNum) { needGoldNum = needGoldList[needGoldList.Length - 1]; } else { needGoldNum = needGoldList[data.m_BuyBattleNum]; } } } else { needGoldNum = needGoldList[0]; } } powerBuyNum.text = (vip.getStageResetBuyTimes() - data.m_BuyBattleNum).ToString(); needGold.text = needGoldNum.ToString(); allGold.text = info.Gold.ToString(); }