private bool CheckAdvancedHero(ObjectCard hero)
    {
        if (hero == null)
        {
            return(false);
        }

        bool         _result;
        HeroTemplate _heroTemplate = hero.GetHeroRow();

        long _resourceCount = 0;

        if (m_ObjectSelf.TryGetResourceCountById(_heroTemplate.getStageUpCostType1(), ref _resourceCount))
        {
            _result = hero.GetHeroData().Level >= _heroTemplate.getMaxLevel() && _resourceCount > _heroTemplate.getStageUpCost1();
        }
        else
        {
            _result = false;
        }

        if (!_result && m_ObjectSelf.TryGetResourceCountById(_heroTemplate.getStageUpCostType2(), ref _resourceCount))
        {
            _result |= _resourceCount > _heroTemplate.getStageUpCost2();
        }

        return(_result);
    }
Beispiel #2
0
    private void BuyResetHandler()
    {
        ObjectSelf obj             = ObjectSelf.GetInstance();
        int        reminResetTimes = isEnoughResetCount();

        //是否有购买重置次数;
        if (reminResetTimes > 0)
        {
            //UI_RechargeBox box = UI_HomeControler.Inst.AddUI(UI_RechargeBox.UI_ResPath).GetComponent<UI_RechargeBox>();
            //int vipLevel = ObjectSelf.GetInstance().VipLevel;
            //StringBuilder sb = new StringBuilder();
            //sb.Append(GameUtils.getString("fight_stagepurchase_form_content"));
            //sb.Append(string.Format("<size=40><color=#F7F709> {0}</color></size>", ObjectSelf.GetInstance().RapidClearBuyTimes));
            //box.SetDescription_text(sb.ToString());
            //box.SetLeftClick(OnBuyRapidClick);
            //int curGold = ObjectSelf.GetInstance().Gold;
            //box.SetMoneyInfo((int)EM_RESOURCE_TYPE.Gold, curGold);
            //box.SetMoneyInfoActive(true);
            //int buyTimes = VIPModule.GetBuyStageMopupTimes(vipLevel) - ObjectSelf.GetInstance().RapidClearBuyTimes;
            //int cost = StageModule.GetBuyRapidCost(buyTimes);
            //box.SetConNum(cost + "");
            //UI_RechargeBox.Data = curGold >= cost;
            //box.SetConsume_Image(GameUtils.GetSpriteByResourceType(EM_RESOURCE_TYPE.Gold));
            //box.SetLeftBtn_text(GameUtils.getString("common_button_purchase"));
            long resCount = -1;
            if (obj.TryGetResourceCountById(EM_RESOURCE_TYPE.Gold, ref resCount))
            {
                int         vipLevel = ObjectSelf.GetInstance().VipLevel;
                VipTemplate pRow     = (VipTemplate)DataTemplate.GetInstance().m_VipTable.getTableData(vipLevel);

                StageData sd         = ObjectSelf.GetInstance().BattleStageData.GetStageDataByStageId(mStageT.GetID());
                int       buyCostIdx = -1;
                buyCostIdx = Mathf.Max(0, sd.m_BuyBattleNum);
                buyCostIdx = Mathf.Min(pRow.getResetcost().Length - 1, buyCostIdx);
                int        cost         = pRow.getResetcost()[buyCostIdx];
                bool       isGoldEnough = resCount >= cost;
                TEXT_COLOR tc           = isGoldEnough ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                UICommonManager.Inst.ShowMsgBox(
                    GameUtils.getString("maoxianguanka8"),
                    string.Format(GameUtils.getString("maoxianguanka9"), reminResetTimes),
                    string.Format(GameUtils.getString("maoxianguanka10"), GameUtils.StringWithColor(cost.ToString(), tc)),
                    GameUtils.getString("huoli_tips5"),
                    OnBuyResetBtnClick,
                    null,
                    isGoldEnough
                    );
            }
            else
            {
                Debug.LogError("不存在的资源类型" + EM_RESOURCE_TYPE.Gold);
            }

            return;
        }
        else
        {
            //VIP等级是否满级15级;
            if (obj.VipLevel >= 15)
            {
                InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("maoxianguanka27"), selfTransform);
                return;
            }
            else
            {
                UICommonManager.Inst.ShowMsgBox(
                    GameUtils.getString("maoxianguanka8"),
                    string.Format(GameUtils.getString("huoli_tips4"), 0),
                    GameUtils.getString("huoli_tips6"),
                    GameUtils.getString("huoli_tips7"),
                    OnShowVipBtnClick,
                    null
                    );

                return;
            }
        }
    }