コード例 #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");
            });
        }
コード例 #2
0
        public void OnStoreBuyEvent(StoreItemData data)
        {
            if (data == null || (_controllerILR != null && !_controllerILR.Visibility))
            {
                return;
            }

            BuyClick(data);
        }
コード例 #3
0
        public void OnStoreBuyEvent(StoreItemData data)
        {
            if (data == null)
            {
                return;
            }

            BuyClick(data);
        }
コード例 #4
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();
        }
コード例 #5
0
        private void InitUI()
        {
            InitSkill();
            List <StoreItemData> datas = new List <StoreItemData>();

            for (int i = 0; i < itemList.Count; i++)
            {
                int    sid       = EB.Dot.Integer("id", itemList[i], 0);
                string id        = EB.Dot.String("redeems.data", itemList[i], "");
                string type      = EB.Dot.String("redeems.type", itemList[i], "");
                int    buy_num   = EB.Dot.Integer("redeems.quantity", itemList[i], 0);
                int    have      = GetScrollNum(id);
                string cost_id   = EB.Dot.String("spends.data", itemList[i], "");
                int    cost_num  = EB.Dot.Integer("spends.quantity", itemList[i], 0);
                int    num       = EB.Dot.Integer("num", itemList[i], 0);
                float  mdiscount = EB.Dot.Single("discount", itemList[i], 1);
                bool   sell_out  = num > 0 || num == -1 ? false : true;
                int    weight    = 1;
                int    buyId     = EB.Dot.Integer("id", itemList[i], 0);
                if (!string.IsNullOrEmpty(id))
                {
                    StoreItemData itemdata = new StoreItemData(sid, id, type, buy_num, have, cost_id, cost_num, sell_out, weight, buyId, StoreType, mdiscount);
                    datas.Add(itemdata);
                }
            }
            int left = datas.Count % Columns;

            if (left > 0)
            {
                left = Columns - left;
                for (int i = 0; i < left; i++)
                {
                    StoreItemData itemdata = new StoreItemData(0, "", "", 1, 1, "", 1, true, 1, i, StoreType, 1);
                    datas.Add(itemdata);
                }
            }

            Scroll.SetItemDatas(datas);
        }
コード例 #6
0
        public override void SetMenuData(object param)
        {
            base.SetMenuData(param);
            Data                  = param as StoreItemData;
            Item.LTItemData       = new LTShowItemData(Data.id, Data.num, Data.type, false);
            HaveLabel.text        = EB.Localizer.GetString("ID_codefont_in_LTStoreBuyController_544") + Data.have;
            m_Discount_Label.text = LTChargeManager.GetDiscountText(Data.discount);
            m_Discount_Label.gameObject.CustomSetActive(Data.discount > 0 && Data.discount < 1);

            m_Cost_Label.text = m_Cost_Label.transform.GetChild(0).GetComponent <UILabel>().text = Data.cost.ToString();
            int resBalance = BalanceResourceUtil.GetResValue(Data.cost_id);

            if (resBalance < Data.cost)
            {
                m_Cost_Label.color = LT.Hotfix.Utility.ColorUtility.RedColor;
            }
            else
            {
                m_Cost_Label.color = LT.Hotfix.Utility.ColorUtility.WhiteColor;
            }
            m_Cost_Sprite.spriteName = BalanceResourceUtil.GetResSpriteName(Data.cost_id);

            string desc = string.Empty;

            if (Data.store_type == "challenge")
            {
                Hotfix_LT.Data.SkillTemplate skillTpl = Hotfix_LT.Data.SkillTemplateManager.Instance.GetTemplate(int.Parse(Data.id));
                desc = skillTpl.Description;
            }
            else
            {
                var item = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetItem(Data.id);
                desc = item.Desc;
            }
            Info.text = desc;
        }
コード例 #7
0
        /// <summary>
        /// 获取数据刷新
        /// </summary>
        public virtual void RefreshData()
        {
            string      title = EB.Localizer.GetString(m_StoreName);
            IDictionary data  = null;

            if (DataLookupsCache.Instance.SearchDataByID <IDictionary>(m_DataID, out data) && data != null)
            {
                m_RefreshCost     = EB.Dot.Integer("refreshCost.quantity", data, m_RefreshCost);
                m_RefreshCostId   = EB.Dot.String("refreshCost.data", data, m_RefreshCostId);
                m_LastRefreshTime = EB.Dot.Integer("lastRefreshTime", data, m_LastRefreshTime);

                int time = EB.Dot.Integer("nextRefreshTime", data, m_NextRefreshTime);

                m_NextRefreshTime = time;

                ShowRefreshPrice();

                int limit = EB.Dot.Integer("unlimited", data, 0);
                if (limit == 1)
                {
                    if (m_RefreshTimeLabel != null)
                    {
                        m_RefreshTimeLabel.gameObject.CustomSetActive(false);
                    }

                    if (RefreshBtnRoot != null)
                    {
                        RefreshBtnRoot.gameObject.CustomSetActive(false);
                    }
                }
                else
                {
                    if (m_RefreshTimeLabel != null)
                    {
                        m_RefreshTimeLabel.gameObject.CustomSetActive(true);
                    }

                    if (RefreshBtnRoot != null)
                    {
                        RefreshBtnRoot.gameObject.CustomSetActive(true);
                        RefreshBtnRoot.onClick.Clear();
                        RefreshBtnRoot.onClick.Add(new EventDelegate(RefreshBtnClick));
                    }
                }

                if (NewCurrencyCommonLabel != null && NewCurrencyCommonSprite != null)
                {
                    if (m_CurStoreGold == "gold")
                    {
                        NewCurrencyCommonLabel.transform.parent.gameObject.SetActive(false);
                    }
                    else
                    {
                        NewCurrencyCommonLabel.transform.parent.gameObject.SetActive(true);
                    }
                    NewCurrencyCommonLabel.text        = BalanceResourceUtil.NumFormat(BalanceResourceUtil.GetResValue(m_CurStoreGold).ToString());
                    NewCurrencyCommonSprite.spriteName = BalanceResourceUtil.GetResSpriteName(m_CurStoreGold);
                }

                if (act != null)
                {
                    StopCoroutine(act);
                    act = null;
                }
                act = RefreshTime(m_NextRefreshTime);
                StartCoroutine(act);

                List <StoreItemData> datas = new List <StoreItemData>();
                ArrayList            items = Hotfix_LT.EBCore.Dot.Array("itemList", data, null);

                float discount  = 1;
                bool  isGoldVIP = LTChargeManager.Instance.IsGoldVIP();
                if (!m_StoreType.Equals("bosschallenge1") && !m_StoreType.Equals("bosschallenge2") && !m_StoreType.Equals("bosschallenge3"))
                {
                    discount = VIPTemplateManager.Instance.GetVIPPercent(VIPPrivilegeKey.ShopDiscount);
                }

                if (items != null && items.Count > 0)
                {
                    for (int i = 0; i < items.Count; i++)
                    {
                        int    sid       = EB.Dot.Integer("id", items[i], 0);
                        string id        = EB.Dot.String("redeems.data", items[i], "");
                        string type      = EB.Dot.String("redeems.type", items[i], "");
                        int    buy_num   = EB.Dot.Integer("redeems.quantity", items[i], 0);
                        int    have      = GameItemUtil.GetItemAlreadyHave(id, type);
                        string cost_id   = EB.Dot.String("spends.data", items[i], "");
                        int    cost_num  = EB.Dot.Integer("spends.quantity", items[i], 0);
                        int    num       = EB.Dot.Integer("num", items[i], 0);
                        float  mdiscount = EB.Dot.Single("discount", items[i], 1);
                        bool   sell_out  = num > 0 || num == -1 ? false : true;
                        int    weight    = 1;

                        float result = cost_num * discount + 0.05f;
                        cost_num = (int)(result);

                        if (!string.IsNullOrEmpty(id))
                        {
                            StoreItemData itemdata = new StoreItemData(sid, id, type, buy_num, have, cost_id, cost_num, sell_out, weight, i, m_StoreType, mdiscount, num);
                            datas.Add(itemdata);
                        }
                    }
                    int left = datas.Count % m_Columns;
                    if (left > 0)         //补全
                    {
                        left = m_Columns - left;
                        for (int i = 0; i < left; i++)
                        {
                            StoreItemData itemdata = new StoreItemData(0, "", "", 1, 1, "", 1, true, 1, i, m_StoreType, 1);
                            datas.Add(itemdata);
                        }
                    }

                    m_Scroll.SetItemDatas(datas);
                }
                else
                {
                    EB.Debug.LogWarning("{0}===no data items", m_DataID);
                }
            }
            else
            {
                EB.Debug.LogWarning("{0}===no data", m_DataID);
            }
        }