Ejemplo n.º 1
0
        /// <summary>
        /// 点击购买抽奖礼包按钮
        /// </summary>
        public void OnCilckDiamondBuyBtn()
        {
            if (giftDataList.Count <= curGiftIndex)
            {
                EB.Debug.LogError("LTChargeGiftRewadUI OnCilckDiamondBuyBtn is Error, curGiftIndex : {0}, giftDataList.Count : {1}", curGiftIndex, giftDataList.Count);
                return;
            }

            ChargeGiftData data = giftDataList[curGiftIndex];

            if (BalanceResourceUtil.GetUserDiamond() < data.coinValue)
            {
                BalanceResourceUtil.HcLessMessage(delegate { controller.Close(); });
                return;
            }

            LTChargeManager.Instance.ReceiveBuyGift(data.id, delegate
            {
                GlobalMenuManager.Instance.Open("LTShowRewardView", data.rewardList);

                giftDataList.RemoveAt(curGiftIndex);

                if (giftDataList.Count <= 0)
                {
                    ClearGiftData();
                    controller.Close();
                    return;
                }

                ArrowObj.CustomSetActive(curGiftType == EGiftType.eDraw && giftDataList != null && giftDataList.Count > 1);
                curGiftIndex = 0;
                RefreshDrawUI(giftDataList[0]);
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 刷新抽奖礼包
        /// </summary>
        private void RefreshDrawUI(ChargeGiftData data)
        {
            IconSp.spriteName = data.icon;
            if (IconSp.keepAspectRatio != UIWidget.AspectRatioSource.Free)
            {
                IconSp.keepAspectRatio = UIWidget.AspectRatioSource.Free;
            }
            IconSp.MakePixelPerfect();
            IconSp.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnWidth;
            IconSp.width           = 358;

            TitleLab.text     = data.title;
            GiftCountLab.text = string.Format("{0}/{1}", curGiftIndex + 1, giftDataList.Count);

            string colorStr = BalanceResourceUtil.GetUserDiamond() >= data.coinValue ? LT.Hotfix.Utility.ColorUtility.WhiteColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;

            DiamondPriceLab.text = string.Format("[{0}]{1}[-]", colorStr, data.coinValue.ToString());

            DiscountLab.text = LTChargeManager.GetDiscountText(data.discount);
            DiscountLab.transform.parent.gameObject.CustomSetActive(data.discount > 0 && data.discount < 1);

            curItemDataList = data.rewardList;
            curCountDownEnd = data.countDownEnd;
            tempCountDown   = 1;
            RefreshShowItem();
            RefreshDrawCountDown();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 初始化抽奖礼包数据
        /// </summary>
        private void InitDrawGiftData()
        {
            ArrayList array;

            DataLookupsCache.Instance.SearchDataByID("userCultivateGift.gifts", out array);

            if (array == null || array.Count <= 0)
            {
                EB.Debug.LogError("Server GiftData is Null!!");
                controller.Close();
                return;
            }

            giftDataList = new List <ChargeGiftData>();
            for (int i = 0; i < array.Count; i++)
            {
                ChargeGiftData data = new ChargeGiftData
                {
                    id           = EB.Dot.String("id", array[i], ""),
                    tplId        = EB.Dot.Integer("tpl_id", array[i], 0),
                    countDownEnd = EB.Dot.Integer("expiry", array[i], 0)
                };

                if (string.IsNullOrEmpty(data.id) || data.tplId <= 0)
                {
                    EB.Debug.Log("InitChargeGiftData is Error, Data is Null, index : {0}", i);
                    continue;
                }

                Hotfix_LT.Data.PartnerCultivateGift tplData = Hotfix_LT.Data.EventTemplateManager.Instance.GetPartnerCultivateGiftById(data.tplId);
                if (tplData == null)
                {
                    EB.Debug.Log("InitChargeGiftData is Error, tplData is Null, tplId : {0}", data.tplId);
                    continue;
                }
                data.title    = tplData.title;
                data.icon     = tplData.icon;
                data.discount = tplData.discount;

                ArrayList spends = Hotfix_LT.EBCore.Dot.Array("spends", array[i], null);
                if (spends != null && spends.Count > 0)
                {
                    data.coinValue = EB.Dot.Integer("q", spends[0], 0);
                }

                ArrayList redeemersData = Hotfix_LT.EBCore.Dot.Array("redeems", array[i], null);
                data.rewardList = InitRewardData(redeemersData);

                giftDataList.Add(data);
            }

            giftDataList.Sort(delegate(ChargeGiftData x, ChargeGiftData y) { return(y.countDownEnd - x.countDownEnd); });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 刷新抽奖礼包
        /// </summary>
        private void RefreshDrawUI(ChargeGiftData data)
        {
            TitleLab.text = data.title;

            string colorStr = BalanceResourceUtil.GetUserDiamond() >= data.coinValue ? LT.Hotfix.Utility.ColorUtility.WhiteColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;

            DiscountLab.text = LTChargeManager.GetDiscountText(data.discount);
            DiscountLab.transform.parent.gameObject.CustomSetActive(data.discount > 0 && data.discount < 1);

            curItemDataList = data.rewardList;
            RefreshShowItem();
        }