예제 #1
0
    void OnItemClick()
    {
        //判断VIP等级是否足够;
        if (mShopT.getVipLimit() > ObjectSelf.GetInstance().VipLevel)
        {
            InterfaceControler.GetInst().AddMsgBox(string.Format(GameUtils.getString("shop_bubble3"), mShopT.getVipLimit()), UI_ShopMgr.inst.transform);
            return;
        }

        //当前金钱够不够买一个的;
        bool isDiscount = ShopModule.IsShopItemInDiscount(mShopT);

        int buyTimes = ObjectSelf.GetInstance().GetShopBuyInfoByShopId(mShopT.getId()).todaynum;

        int costNum = DataTemplate.GetInstance().GetShopBuyCost(mShopT, buyTimes, isDiscount);

        long             curCount = -1;
        EM_RESOURCE_TYPE resType  = (EM_RESOURCE_TYPE)mShopT.getCostType();

        if (ObjectSelf.GetInstance().TryGetResourceCountById(resType, ref curCount))
        {
            if (curCount >= costNum)
            {
                if (mShopT.getType() != 51)
                {
                    LogManager.LogError("不是金币类型51的物品,所属标签填写错误!" + mShopT.getId());
                    return;
                }

                //打开金币购买界面;
                UI_GoldBuyMgr.SetData(mShopT);
                UI_HomeControler.Inst.AddUI(UI_GoldBuyMgr.UI_ResPath);
            }
            else
            {
                switch (resType)
                {
                case EM_RESOURCE_TYPE.Gold:
                    //打开魔钻不足提示窗;
                    InterfaceControler.GetInst().ShowGoldNotEnougth(UI_QuikBuyGoldMgr.Inst.transform);
                    break;

                default:
                    InterfaceControler.GetInst().AddMsgBox("除魔钻资源不足时,其他资源不足先不做处理", UI_ShopMgr.inst.transform);
                    break;
                }
            }
        }
    }