示例#1
0
    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();
    }