Beispiel #1
0
        public void BuyClick(StoreItemData target)
        {
            if (target.sell_out)
            {
                return;
            }
            int isCanBuyMessageId = 0;

            if (!GameItemUtil.GetItemIsCanBuy(target.id, target.type, out isCanBuyMessageId))
            {
                MessageTemplateManager.ShowMessage(isCanBuyMessageId);
                return;
            }

            int resBalance = BalanceResourceUtil.GetResValue(target.cost_id);

            if (resBalance < target.cost)
            {
                MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_codefont_in_LTChallengeInstanceShopCtrl_3630"));
                return;
            }
            LTInstanceMapModel.Instance.RequestChallengeBuyScroll(new[] { mx, my }, target.buy_id, delegate
            {
                LTInstanceMapModel.Instance.RequestGetChapterState(() =>
                {
                });
                GlobalMenuManager.Instance.CloseMenu("LTStoreBuyUI");
            });
        }
Beispiel #2
0
        /// <summary>
        /// 购买
        /// </summary>
        public void BuyClick(StoreItemData target)
        {
            if (target.sell_out)
            {
                return;
            }
            int isCanBuyMessageId = 0;

            if (!GameItemUtil.GetItemIsCanBuy(target.id, target.type, out isCanBuyMessageId))
            {
                MessageTemplateManager.ShowMessage(isCanBuyMessageId);
                return;
            }

            if (BalanceResourceUtil.GetResValue(target.cost_id) < target.cost)
            {
                if (target.cost_id.Equals("hc"))
                {
                    BalanceResourceUtil.HcLessMessage();
                    return;
                }
                else if (target.cost_id.Equals("gold"))
                {
                    MessageTemplateManager.ShowMessage(901031, null, delegate(int result)
                    {
                        if (result == 0)
                        {
                            InputBlockerManager.Instance.Block(InputBlockReason.FUSION_BLOCK_UI_INTERACTION, 0.5f);
                            GlobalMenuManager.Instance.Open("LTResourceShopUI");
                        }
                    });
                    return;
                }
                else
                {
                    var ht = Johny.HashtablePool.Claim();
                    ht.Add("0", BalanceResourceUtil.GetResName(target.cost_id));
                    MessageTemplateManager.ShowMessage(902022, ht, null);
                    Johny.HashtablePool.Release(ht);
                    return;
                }
            }
            m_buytarget = target;
            m_BuyRequest.parameters[0].parameter = target.store_type;
            m_BuyRequest.parameters[1].parameter = target.buy_id.ToString();
            m_BuyRequest.parameters[2].parameter = m_buytarget.cost.ToString();
            m_BuyRequest.SendRequest();
            LoadingSpinner.Show();
        }