private void ReflashShop(ShopPropData propdata) { if (propdata == null || m_curType == ShopType.None) { m_ChooseEffect.Visible = false; return; } //m_grid_con.Clear(); int count = propdata.m_itemdata.Count; if (0 == count) { m_shopInfo_com.Visible = false; m_ChooseEffect.Visible = false; this.m_nothingTips.Visible = true; } else { m_shopInfo_com.Visible = true; this.m_nothingTips.Visible = false; } m_grid_con.EnsureSize(count); for (int i = 0; i < count; i++) { ShopItemUIComponent item = m_grid_con.GetChild(i); item.setItemData(propdata.m_itemdata[i], m_shopInfo_com, m_curType, 0 == i); item.Visible = true; } if (m_curType == ShopType.BlackMarket) { m_price_lab.Text = propdata.m_reflashCost.ToString(); } }
public override void OnShow(object param) { base.OnShow(param); is_fast_buy = false; if (null != param) { is_fast_buy = (bool)param; } MainPanelInGameUILogic.Show(); //MessageHandler.RegisterMessageHandler(MessageDefine.MarkeBuyResponse, OnResponse); MessageHandler.RegisterMessageHandler(MessageDefine.MarketResponse, OnResponse); m_close_btn.AddClickCallBack(btnClose); if (!ShopHelper.IsShopDataAvaliable(cate)) { requestData(); } else { ShopPropData crashdata = ShopHelper.getShopData(cate); InitData(crashdata); } }
public static void openShop(MarketResponse shopdata) { ShopPropData propData = getShopData(shopdata); FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_SHOP); param.Param = propData; EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param); }
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); }
private void OnResponse(object msg) { if (msg == null) { return; } if (msg is MarketResponse) { MarketResponse res = (MarketResponse)msg; if (res.Category == Category.Black) { m_ChooseEffect.gameObject.transform.SetParent(m_MaskRoot, false); m_blackdata = ShopHelper.getShopData(res); m_NeedReflash = true; System.DateTime dt = CommonTools.TimeStampToDateTime(m_blackdata.m_NextReflashTime); m_TotalSecond = (float)(dt - System.DateTime.Now).TotalSeconds + 2; m_curTime = Time.time; m_tradingTime_lab.Text = CommonTools.SecondToStringDDMMSS(m_TotalSecond); ReflashShop(m_blackdata); } else if (res.Category == Category.Common) { m_ChooseEffect.gameObject.transform.SetParent(m_MaskRoot, false); m_propdata = ShopHelper.getShopData((res)); ReflashShop(m_propdata); } } else if (msg is MarkeFreshResponse) { MarkeFreshResponse res = (MarkeFreshResponse)msg; if (res.ResponseStatus == null) { m_ChooseEffect.gameObject.transform.SetParent(m_MaskRoot, false); GlobalInfo.MY_PLAYER_INFO.ChangeCash(-m_blackdata.m_reflashCost); MarketResponse shopRes = new MarketResponse(); shopRes.MarketBlack = res.MarketBlack; shopRes.MarketItems.Clear(); shopRes.MarketItems.Add(res.MarketItems); shopRes.Category = Category.Black; m_blackdata = ShopHelper.getShopData(shopRes); ReflashShop(m_blackdata); } else { ResponseStatus resStatus = res.ResponseStatus; PopUpManager.OpenNormalOnePop("shop_limite_times"); } } }
//public override void OnShow(object param) //{ // if (param != null) // { // m_propdata = (ShopPropData)param; // } // base.OnShow(param); // MainPanelInGameUILogic.Show(); // SetCloseBtnID("Button_close"); // m_ChooseEffect.EffectPrefabName = "UI_xuanzhong_shangcheng.prefab"; //} public override void OnShow(object param) { m_propdata = ShopHelper.getShopData(Category.Common); m_blackdata = ShopHelper.getShopData(Category.Black); base.OnShow(param); MainPanelInGameUILogic.Show(); SetCloseBtnID("Button_close"); m_ChooseEffect.EffectPrefabName = "UI_xuanzhong_shangcheng.prefab"; }
protected virtual void InitItemView(ShopPropData propdata) { int count = propdata.m_itemdata.Count; m_grid_com.EnsureSize <ShopCoinItemUIComponent>(count); for (int i = 0; i < count; i++) { if (propdata.m_itemdata[i] != null) { ShopCoinItemUIComponent com = m_grid_com.GetChild <ShopCoinItemUIComponent>(i); com.setData(propdata.m_itemdata[i], shopType, i, is_fast_buy); com.Visible = true; } } }
private void OnResponse(object obj) { if (obj == null) { return; } if (obj is MarketResponse) { var res = (MarketResponse)obj; if (res.Category == cate) { ShopPropData m_crashdata = ShopHelper.getShopData(res); InitData(m_crashdata); } } }
protected virtual void InitData(ShopPropData propdata) { if (is_fast_buy) { List <ShopItemData> temp_datas = propdata.m_itemdata.FindAll((item) => { return(1 == item.m_number && false == item.m_hasDis); }); ShopPropData temp = new ShopPropData() { m_itemdata = temp_datas, m_reflashCount = propdata.m_reflashCount, m_LastReflashTime = propdata.m_LastReflashTime, m_NextReflashTime = propdata.m_NextReflashTime, m_reflashCost = propdata.m_reflashCost, }; propdata = temp; } this.InitItemView(propdata); }
public void RefreshPageByCacheData(Category cat) { if (cat == Category.Black) { m_ChooseEffect.gameObject.transform.SetParent(m_MaskRoot, false); m_blackdata = ShopHelper.getShopData(cat); m_NeedReflash = true; System.DateTime dt = CommonTools.TimeStampToDateTime(m_blackdata.m_NextReflashTime); m_TotalSecond = (float)(dt - System.DateTime.Now).TotalSeconds + 2; m_curTime = Time.time; m_tradingTime_lab.Text = CommonTools.SecondToStringDDMMSS(m_TotalSecond); ReflashShop(m_blackdata); } else if (cat == Category.Common) { m_ChooseEffect.gameObject.transform.SetParent(m_MaskRoot, false); m_propdata = ShopHelper.getShopData((cat)); ReflashShop(m_propdata); } }
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); }