コード例 #1
0
    void OnBuyBtnClick()
    {
        //判断是否还在打折;
        //TODO::
        bool discount = ShopModule.IsShopItemInDiscount(shopT);

        if (discount != isDiscount)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("shop_bubble7"), transform);
            return;
        }

        //判断是否已经下架;
        //TODO::
        bool isSale = ShopModule.IsShopItemInSaling(shopT);

        if (!isSale)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("shop_bubble6"), transform);
            return;
        }
        //购买商品接口;
        ShopModule.BuyItem(shopT.getId(), 1, isDiscount);

        CloseUI();
    }
コード例 #2
0
    void OnBuyBtnClick()
    {
        //判断是否还在打折;
        //TODO::
        bool discount = ShopModule.IsShopItemInDiscount(ShopT);

        if (discount != isDiscount)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("shop_bubble7"), selfTransform);
            return;
        }

        //判断是否已经下架;
        //TODO::
        bool isSale = ShopModule.IsShopItemInSaling(ShopT);

        if (!isSale)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("shop_bubble6"), selfTransform);
            return;
        }

        //购买商品接口;
        //string err = "";
        //if(!ShopModule.BuyItem(ShopT.getId(),ItemCount, isDiscount, out err))
        //{
        //    InterfaceControler.GetInst().AddMsgBox(err, selfTransform);
        //}
        //else
        //{
        //    CloseUI();
        //}

        ShopModule.BuyItem(ShopT.getId(), ItemCount, isDiscount);
        CloseUI();
    }
コード例 #3
0
    /// <summary>
    /// 点击立刻购买;
    /// </summary>
    void OnMsgBoxYesClick()
    {
        UI_HomeControler.Inst.ReMoveUI(UI_RechargeBox.UI_ResPath);

        int          stoneid = DataTemplate.GetInstance().GetGameConfig().getIdentify_stone_id();
        ShopTemplate shopT   = DataTemplate.GetInstance().GetShopTemplateByID(stoneid);

        if (!ShopModule.IsShopItemInSaling(shopT))
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("shop_bubble6"), transform);
            return;
        }
        int  buyTimes   = ObjectSelf.GetInstance().GetShopBuyInfoByShopId(stoneid).todaynum;
        bool isdiscount = ShopModule.IsShopItemInDiscount(shopT);

        int haveCount = 0;

        ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, itemId, ref haveCount);

        //获取符文鉴定石对应到商店表的id;
        int shopId = DataTemplate.GetInstance().GetGameConfig().getIdentify_stone_id();

        ShopModule.BuyItem(shopId, itemCount - haveCount, isdiscount);
    }
コード例 #4
0
    void OnDefineBtnClick()
    {
        if (mRuneGUID == null || ItemEquipInfo == null)
        {
            return;
        }

        ItemTemplate itemT = ItemEquipInfo.GetItemRowData();

        //一星符文没法鉴定;
        if (itemT.getRune_quality() <= 1)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip3"), transform);
            return;
        }

        int count = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(itemT);

        //是否鉴定满级;
        if (ItemEquipInfo.GetDefineTimes() >= count)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip4"), transform);
            return;
        }

        ///鉴定消耗物品是否足够;
        itemId    = -1;           //消耗道具id
        itemCount = -1;           //消耗道具数量;
        switch (ItemEquipInfo.GetDefineTimes())
        {
        case 0:
            itemId    = itemT.getRune_exposeCostType1();
            itemCount = itemT.getRune_exposeCostValue1();
            break;

        case 1:
            itemId    = itemT.getRune_exposeCostType2();
            itemCount = itemT.getRune_exposeCostValue2();
            break;

        case 2:
            itemId    = itemT.getRune_exposeCostType3();
            itemCount = itemT.getRune_exposeCostValue3();
            break;

        case 3:
            itemId    = itemT.getRune_exposeCostType4();
            itemCount = itemT.getRune_exposeCostValue4();
            break;

        default:
            break;
        }
        if (itemId != -1 && itemCount > 0)
        {
            int haveCount = 0;
            ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, itemId, ref haveCount);

            //道具不足提示;
            if (haveCount < itemCount)
            {
                ItemTemplate   costItemT = DataTemplate.GetInstance().GetItemTemplateById(itemId);
                UI_RechargeBox box       = UI_HomeControler.Inst.AddUI(UI_RechargeBox.UI_ResPath).GetComponent <UI_RechargeBox>();
                box.SetIsNeedDescription(true);
                Sprite sp = UIResourceMgr.LoadSprite(common.defaultPath + costItemT.getIcon());
                //获取商城中该物品的价格----写死的商品id==3;
                int          shopid = DataTemplate.GetInstance().GetGameConfig().getIdentify_stone_id();
                ShopTemplate shopT  = DataTemplate.GetInstance().GetShopTemplateByID(shopid);
                if (!ShopModule.IsShopItemInSaling(shopT))
                {
                    InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("shop_bubble6"), transform);
                    return;
                }
                box.SetConsume_Image(GameUtils.GetSpriteByResourceType(shopT.getCostType()));
                int  buyTimes   = ObjectSelf.GetInstance().GetShopBuyInfoByShopId(shopid).todaynum;
                bool isdiscount = ShopModule.IsShopItemInDiscount(shopT);
                int  needCount  = itemCount - haveCount;
                long costTotal  = (DataTemplate.GetInstance().GetShopBuyCost(shopT, buyTimes, isdiscount) * needCount);
                box.SetConNum(costTotal.ToString());
                string content = string.Format(GameUtils.getString("hero_rune_identifyform_tip1"), GameUtils.getString(costItemT.getName(), TEXT_COLOR.YELLOW) + " X " + needCount);
                box.SetDescription_text(content);
                long resourceCount = 0;
                ObjectSelf.GetInstance().TryGetResourceCountById(shopT.getCostType(), ref resourceCount);
                box.SetMoneyInfo(shopT.getCostType(), (int)resourceCount);
                box.SetMoneyInfoActive(true);
                box.SetLeftBtn_text(GameUtils.getString("common_button_purchase1"));

                if (costTotal > resourceCount)
                {
                    box.SetLeftClick(OnMsgBoxYesNoMoneyClick);
                }
                else
                {
                    box.SetLeftClick(OnMsgBoxYesClick);
                }
            }
            else
            {
                SendIndentifyProtocol();
            }
        }
        else
        {
            LogManager.LogError("错误的道具id:" + itemId + "或者是错误的道具数量:" + itemCount);
        }
    }