Ejemplo n.º 1
0
        public void setItemData(ShopItemData itemData, ShopInfoUIComponent infoComponent, ShopType type, bool ischoose)
        {
            this.m_itemData      = itemData;
            this.m_infoComponent = infoComponent;
            this.m_curType       = type;
            this.m_isChoose      = ischoose;

            m_lastType = m_curType;
        }
Ejemplo n.º 2
0
        public void setPanel(ShopItemData itemdata, ShopType currentType)
        {
            m_itemdata = itemdata;
            if (itemdata == null)
            {
                return;
            }
            m_currentType        = currentType;
            m_NumberRoot.Visible = (m_currentType != ShopType.BlackMarket);

            m_buyNumber           = 1;
            m_buyPropCount        = itemdata.m_number;
            m_cashType_img.Sprite = ShopHelper.getCashType(itemdata.m_costType);
            if (itemdata.m_prop != null)
            {
                m_icon_img.Sprite      = itemdata.m_prop.icon;
                m_itemName_lab.Text    = LocalizeModule.Instance.GetString(itemdata.m_prop.name);
                m_itemContent_lab.Text = LocalizeModule.Instance.GetString(itemdata.m_prop.description);
            }
            m_number_lab.Text       = m_buyNumber.ToString();
            this.m_sumBgImg.Visible = itemdata.m_number > 1;
            if (itemdata.m_number > 1)
            {
                m_count_lab.Text = string.Format("x{0}", itemdata.m_number);
            }
            else
            {
                m_count_lab.Text = string.Empty;
            }
            if (!itemdata.m_hasDis)
            {
                m_disCount_img.Visible = false;
                m_oriRoot_root.Visible = false;
                m_cost           = itemdata.m_oriPrice * m_buyNumber;
                m_price_lab.Text = m_cost.ToString();
            }
            else
            {
                m_disCount_lab.Text = string.Format("-{0}%", itemdata.m_disCount);
                m_oriPrice_lab.Text = itemdata.m_oriPrice.ToString();
                m_cost                 = itemdata.m_disPrice * m_buyNumber;
                m_price_lab.Text       = m_cost.ToString();
                m_oriRoot_root.Visible = true;
                m_disCount_img.Visible = true;
            }

            if (itemdata.m_limitNumber < 0)
            {
                m_limit_root.Visible = false;
            }
            else
            {
                m_limit_root.Visible = true;
                m_limit_lab.Text     = itemdata.m_limitNumber.ToString();
            }
            checkBtnState();
        }
Ejemplo n.º 3
0
        public void SetBuyItemInfo(ShopItemData itemdata)
        {
            m_itemdata = itemdata;

            this.m_itemConf = m_itemdata.m_prop;


            RefreshUI();
        }
Ejemplo n.º 4
0
        public override void OnHide()
        {
            base.OnHide();
            m_buy_btn.RemoveClickCallBack(btnBuy);
            GameEvents.BuyEvent.OnShopRes        -= OnBuyCallback;
            GameEvents.BuyEvent.OnShopReq        -= OnRequestCallback;
            GameEvents.Skill_Event.OnSkillFinish -= OneUseReqCallback;
            m_itemdata    = null;
            m_curShopType = ShopType.None;

            this.m_effect.Visible = false;
        }
Ejemplo n.º 5
0
 public static ShopItemData getShopDataByID(ShopPropData pdata, long id)
 {
     for (int i = 0; i < pdata.m_itemdata.Count; i++)
     {
         ShopItemData itemdata = pdata.m_itemdata[i];
         if (itemdata.marketID == id)
         {
             return(itemdata);
         }
     }
     return(null);
 }
Ejemplo n.º 6
0
 public void setData(ShopItemData itemdata, ShopType shopType, int index_, bool is_fast_buy = false)
 {
     m_itemdata    = itemdata;
     m_curShopType = shopType;
     m_is_fast_buy = is_fast_buy;
     m_idx         = index_;
     if (itemdata == null)
     {
         return;
     }
     if (itemdata.m_prop != null)
     {
         m_icon_img.Sprite = itemdata.m_prop.icon;
     }
 }
Ejemplo n.º 7
0
        public virtual void setData(ShopItemData itemdata, ShopType shopType, int index_, bool is_fast_buy = false)
        {
            m_itemdata    = itemdata;
            m_curShopType = shopType;
            m_is_fast_buy = is_fast_buy;
            m_idx         = index_;
            if (itemdata == null)
            {
                return;
            }
            if (itemdata.m_prop != null)
            {
                m_icon_img.Sprite = itemdata.m_prop.icon;
            }

            m_cashType_img.Sprite         = ShopHelper.getCashType(itemdata.m_costType);
            m_limited_cashType_img.Sprite = ShopHelper.getCashType(itemdata.m_costType);

            m_count_lab.Text = string.Format("x{0}", itemdata.m_number);

            if (itemdata.m_hasDis)
            {
                m_cost = itemdata.m_disPrice;
                m_disCount_root.Visible = true;
                m_oriPrice_root.Visible = true;
                m_disCount_lab.Text     = string.Format("-{0}%", (100 - itemdata.m_disCount));
                m_oriPrice_lab.Text     = itemdata.m_oriPrice.ToString();
                m_limited_cost_lab.Text = m_cost_lab.Text = itemdata.m_disPrice.ToString();
            }
            else
            {
                m_cost = itemdata.m_oriPrice;
                m_disCount_root.Visible = false;
                m_oriPrice_root.Visible = false;
                m_limited_cost_lab.Text = m_cost_lab.Text = itemdata.m_oriPrice.ToString();
            }

            if (ShopType.Coin == m_curShopType && null == m_icon_effect)
            {
                m_icon_effect = Make <GameUIEffect>("UI_jinbi_goumai01");
            }

            if (null != m_icon_effect)
            {
                m_icon_effect.EffectPrefabName = string.Format("UI_jinbi_goumai0{0}.prefab", index_ + 1);
            }

            if (ShopType.Vit == m_curShopType && itemdata.m_limitNumber >= 0)
            {
                m_limited_buy_btn.Visible  = true;
                m_buy_btn.Visible          = false;
                m_limited_max_num          = itemdata.m_limitNumber;
                m_limited_buy_num_txt.Text = string.Format("({0}/{1})", m_limited_max_num, m_limited_max_num);
            }
            else
            {
                m_limited_buy_btn.Visible = false;
                m_buy_btn.Visible         = true;
            }

            if (ShopType.Vit == m_curShopType && 0 == itemdata.m_limitNumber)
            {
                m_limited_buy_btn.Enable = false;
                m_limited_buy_btn.SetGray(true);
            }
            else
            {
                m_limited_buy_btn.Enable = true;
                m_limited_buy_btn.SetGray(false);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 购买回调
        /// </summary>
        /// <param name="res"></param>
        private void OnBuyCallback(MarkeBuyResponse res)
        {
            if (request_Type != m_curType)
            {
                return;
            }
            if (res.ResponseStatus != null)
            {
                PopUpManager.OpenNormalOnePop("shop_rmb_no");
                requestShopData();
            }
            else
            {
                if (request_ID == m_curChooseID)
                {
                    request_Type = ShopType.None;
                    ShopItemData curItemdata = getShopDataByID();
                    if (curItemdata != null)
                    {
                        //PopUpManager.OpenNormalOnePop("shop_rmb_ok");
                        ConfProp prop = ConfProp.Get(curItemdata.m_prop.id);
                        if (prop != null && prop.type != 3)
                        {
                            ResultWindowData windowDatas = new ResultWindowData(new List <ResultItemData> {
                                new ResultItemData(curItemdata.m_prop.id, total_prop_count)
                            });
                            FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                            param.Param = windowDatas;
                            EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                        }
                        //CommonHelper.OpenGift(curItemdata.m_prop.id, request_Market_Count);
                        if (curItemdata.m_limitNumber > 0)
                        {
                            curItemdata.m_limitNumber -= request_Market_Count;
                        }
                        m_shopInfo_com.setPanel(curItemdata, m_curType);
                        int cost = 0;
                        if (curItemdata.m_hasDis)
                        {
                            cost = curItemdata.m_disPrice * request_Market_Count;
                        }
                        else
                        {
                            cost = curItemdata.m_oriPrice * request_Market_Count;
                        }
                        GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(curItemdata.m_prop.id, total_prop_count);

                        GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke();

                        if (curItemdata.m_costType == CostType.CostCash)
                        {
                            GlobalInfo.MY_PLAYER_INFO.ChangeCash(-cost);
                        }
                        else if (curItemdata.m_costType == CostType.CostCoin)
                        {
                            GlobalInfo.MY_PLAYER_INFO.ChangeCoin(-cost);
                        }
                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.ContentID, curItemdata.marketID },
                            { UBSParamKeyName.NumItems, request_Market_Count }
                        };

                        if (m_curType == ShopType.Prop)
                        {
                            UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.shop_buy, null, _params);
                        }

                        if (curItemdata.m_limitNumber == 0 && m_curType == ShopType.Prop)
                        {
                            requestShopData();
                        }
                        else if (m_curType == ShopType.BlackMarket)
                        {
                            requestShopData();
                            UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.blackmarket_buy, null, _params);
                        }
                        //GlobalInfo.MY_PLAYER_INFO.SetCoin(res.PlayerBaseInfo.Coin);
                    }
                }
            }
        }
        public override void setData(ShopItemData itemdata, ShopType shopType, int index_, bool is_fast_buy = false)
        {
            base.setData(itemdata, shopType, index_, is_fast_buy);

            RefeshItemInbagNum();
        }
Ejemplo n.º 10
0
        public static ShopPropData getShopData(MarketResponse shopdata)
        {
            if (shopdata == null)
            {
                return(null);
            }
            ShopPropData pdata = new ShopPropData();

            pdata.m_itemdata = new List <ShopItemData>();
            List <ShopItemData> m_giftData = new List <ShopItemData>(); //礼盒

            if (shopdata.Category == Category.Black && shopdata.MarketBlack != null)
            {
                pdata.m_reflashCost     = shopdata.MarketBlack.FreshCost;
                pdata.m_reflashCount    = shopdata.MarketBlack.FreshLimit;
                pdata.m_LastReflashTime = shopdata.MarketBlack.LastUpdateTime * 10000;
                pdata.m_NextReflashTime = shopdata.MarketBlack.NextUpdateTime * 10000;
            }
            for (int i = 0; i < shopdata.MarketItems.Count; i++)
            {
                ShopItemData  itemdata = new ShopItemData();
                MarketItemMsg markitem = shopdata.MarketItems[i];
                if (markitem != null)
                {
                    ConfProp prop = ConfProp.Get(markitem.SellId);
                    itemdata.m_number      = markitem.SellCount;
                    itemdata.marketID      = markitem.Id;
                    itemdata.m_oriPrice    = markitem.Cost;
                    itemdata.m_limitNumber = markitem.BuyLimit;
                    itemdata.m_maxNumber   = markitem.MaxLimit;
                    itemdata.m_costType    = markitem.CostType;
                    if (markitem.DiscountInfo != null)
                    {
                        System.DateTime startTime = CommonTools.TimeStampToDateTime(markitem.DiscountInfo.DiscountStart * 10000);
                        System.DateTime endTime   = CommonTools.TimeStampToDateTime(markitem.DiscountInfo.DiscountEnd * 10000);
                        System.DateTime nowTime   = CommonTools.GetCurrentTime();
                        if (markitem.DiscountInfo.Discount == 0 || nowTime < startTime || nowTime > endTime)
                        {
                            itemdata.m_hasDis = false;
                        }
                        else
                        {
                            itemdata.m_hasDis   = true;
                            itemdata.m_disPrice = markitem.DiscountInfo.DiscountCost;
                            itemdata.m_disCount = markitem.DiscountInfo.Discount;
                            itemdata.m_disIcon  = markitem.DiscountInfo.DiscountIcon;
                        }
                    }
                    else
                    {
                        itemdata.m_hasDis = false;
                    }
                    if (prop != null)
                    {
                        itemdata.m_prop = prop;
                        //todo 临时修改礼盒最前面
                        if (itemdata.m_prop.type == (int)PROP_TYPE.E_GIFT)
                        {
                            m_giftData.Add(itemdata);
                        }
                        else
                        {
                            pdata.m_itemdata.Add(itemdata);
                        }
                    }
                    else
                    {
                        Debug.LogError("item id is not exist:" + markitem.SellId);
                    }
                }
            }
            pdata.m_itemdata.InsertRange(0, m_giftData);

            ShopDataCache[shopdata.Category] = pdata;

            return(pdata);
        }
Ejemplo n.º 11
0
 private void ShowBuyPopView(ShopItemData data_)
 {
     m_gameInternalShopComponent.SetBuyItemInfo(data_);
     m_gameInternalShopComponent.Visible = true;
 }