public bool LOBBY2CLIENT_PURCHASE_GOODS_RESP(Observers.Interfaces.INotification note) { PurchaseGoodsResp purchaseGoodsResp = note.Body as PurchaseGoodsResp; int shopID = purchaseGoodsResp.goodsType; int shopItemID = purchaseGoodsResp.goodsNo; int costType = purchaseGoodsResp.costType; string shopItemName = string.Empty; if (shopID == 13) { ShopDiamondItemInfo shopDiamondInfo = null; ShopProxy.instance.ShopDiamondItemInfoDic.TryGetValue(shopItemID, out shopDiamondInfo); shopItemName = Localization.Get(shopDiamondInfo.ShopDiamondData.name); } else if (shopID == 14) { ShopActionItemInfo shopActionItemInfo = null; ShopProxy.instance.ShopActionItemInfoDic.TryGetValue(shopItemID, out shopActionItemInfo); shopItemName = Localization.Get(shopActionItemInfo.ShopLimitItemData.name); } else if (shopID == 15) { ShopGoldItemInfo shopGoldItemInfo = null; ShopProxy.instance.ShopGoldItemInfoDic.TryGetValue(shopItemID, out shopGoldItemInfo); shopItemName = Localization.Get(shopGoldItemInfo.ShopLimitItemData.name); } else if (shopID == 16) { ShopGoodsItemInfo shopGoodsItemInfo = null; ShopProxy.instance.ShopGoodsItemInfoDic.TryGetValue(shopItemID, out shopGoodsItemInfo); shopItemName = Localization.Get(shopGoodsItemInfo.ShopGoodsData.name); } CommonAutoDestroyTipsView.Open(string.Format(Localization.Get("ui.shop_view.buy_success_tips"), shopItemName)); return(true); }
public void SetShopGoldItemInfo(ShopGoldItemInfo shopGoldItemInfo) { _shopGoldItemInfo = shopGoldItemInfo; nameText.text = Localization.Get(_shopGoldItemInfo.ShopLimitItemData.name); descriptionText.text = Localization.Get(_shopGoldItemInfo.ShopLimitItemData.description); itemIconImage.SetSprite(ResMgr.instance.Load <Sprite>(ResPath.GetShopItemIconPath(_shopGoldItemInfo.ShopLimitItemData.pic))); itemIconImage.SetNativeSize(); freeTimesRoot.SetActive(false); limitTimesRoot.SetActive(false); freeCountDownSlider.gameObject.SetActive(false); costResourceIcon.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(_shopGoldItemInfo.ShopLimitItemData.costGameResData.type))); costResourceIcon.SetNativeSize(); costResourceCountText.text = _shopGoldItemInfo.ShopLimitItemData.costGameResData.count.ToString(); if (_shopGoldItemInfo.RemainPurchaseTimes > 0) { buyButton.gameObject.SetActive(true); soldOutButton.gameObject.SetActive(false); } else { buyButton.gameObject.SetActive(false); soldOutButton.gameObject.SetActive(true); } }
public void LoadShopGoldItemInfo() { List <ShopLimitItemData> shopGoldLimitDataList = ShopLimitItemData.GetGoldItemDataList(); int shopGoldLimitDataCount = shopGoldLimitDataList.Count; for (int i = 0; i < shopGoldLimitDataCount; i++) { ShopGoldItemInfo shopGoldItemInfo = new ShopGoldItemInfo(shopGoldLimitDataList[i]); _shopGoldItemInfoDic.Add(shopGoldLimitDataList[i].id, shopGoldItemInfo); } }
public bool LOBBY2CLIENT_LIMIT_GOODS_RESP(Observers.Interfaces.INotification note) { LimitGoodsResp limitGoodsResp = note.Body as LimitGoodsResp; List <ShopActionItemInfo> shopActionItemInfoList = ShopProxy.instance.ShopActionItemInfoDic.GetValues(); int shopActionItemInfoCount = shopActionItemInfoList.Count; for (int i = 0; i < shopActionItemInfoCount; i++) { shopActionItemInfoList[i].UpdateInfo(false, 0); } List <ShopGoldItemInfo> shopGoldItemInfoList = ShopProxy.instance.ShopGoldItemInfoDic.GetValues(); int shopGoldItemInfoCount = shopGoldItemInfoList.Count; for (int i = 0; i < shopGoldItemInfoCount; i++) { shopGoldItemInfoList[i].UpdateInfo(false, 0); } List <LimitGoodsProto> limitGoodsProtoList = limitGoodsResp.goods; int limitGoodsProtoCount = limitGoodsProtoList.Count; for (int i = 0; i < limitGoodsProtoCount; i++) { int limitItemID = limitGoodsProtoList[i].goodsNo; ShopActionItemInfo shopActionItemInfo = null; ShopGoldItemInfo shopGoldItemInfo = null; ShopProxy.instance.ShopActionItemInfoDic.TryGetValue(limitItemID, out shopActionItemInfo); ShopProxy.instance.ShopGoldItemInfoDic.TryGetValue(limitItemID, out shopGoldItemInfo); if (shopActionItemInfo != null) { shopActionItemInfo.UpdateInfo(true, limitGoodsProtoList[i].remianPurchaseTimes); } else if (shopGoldItemInfo != null) { shopGoldItemInfo.UpdateInfo(true, limitGoodsProtoList[i].remianPurchaseTimes); } } ShopProxy.instance.OnShopActionItemInfoListUpdate(); ShopProxy.instance.OnShopGoldItemInfoListUpdate(); return(true); }
public bool LOBBY2CLIENT_LIMIT_GOODS_UPDATE_RESP(Observers.Interfaces.INotification note) { LimitGoodsUpdateResp limitGoodsUpdateResp = note.Body as LimitGoodsUpdateResp; List <LimitGoodsProto> addLimitGoodsProtoList = limitGoodsUpdateResp.addGoods; int addLimitGoodsProtoCount = addLimitGoodsProtoList.Count; for (int i = 0; i < addLimitGoodsProtoCount; i++) { int shopItemID = addLimitGoodsProtoList[i].goodsNo; ShopActionItemInfo shopActionItemInfo = null; ShopGoldItemInfo shopGoldItemInfo = null; ShopProxy.instance.ShopActionItemInfoDic.TryGetValue(shopItemID, out shopActionItemInfo); ShopProxy.instance.ShopGoldItemInfoDic.TryGetValue(shopItemID, out shopGoldItemInfo); if (shopActionItemInfo != null) { shopActionItemInfo.UpdateInfo(true, addLimitGoodsProtoList[i].remianPurchaseTimes); } else if (shopGoldItemInfo != null) { shopGoldItemInfo.UpdateInfo(true, addLimitGoodsProtoList[i].remianPurchaseTimes); } } int deleteShopItemID = limitGoodsUpdateResp.delGoods; ShopActionItemInfo deleteShopActionItemInfo = null; ShopGoldItemInfo deleteShopGoldItemInfo = null; ShopProxy.instance.ShopActionItemInfoDic.TryGetValue(deleteShopItemID, out deleteShopActionItemInfo); ShopProxy.instance.ShopGoldItemInfoDic.TryGetValue(deleteShopItemID, out deleteShopGoldItemInfo); if (deleteShopActionItemInfo != null) { deleteShopActionItemInfo.UpdateInfo(false, 0); } else if (deleteShopGoldItemInfo != null) { deleteShopGoldItemInfo.UpdateInfo(false, 0); } LimitGoodsProto updateLimitGoodsProto = limitGoodsUpdateResp.updateGoods; if (updateLimitGoodsProto != null) { ShopActionItemInfo updateShopActionItemInfo = null; ShopGoldItemInfo updateShopGoldItemInfo = null; ShopProxy.instance.ShopActionItemInfoDic.TryGetValue(updateLimitGoodsProto.goodsNo, out updateShopActionItemInfo); ShopProxy.instance.ShopGoldItemInfoDic.TryGetValue(updateLimitGoodsProto.goodsNo, out updateShopGoldItemInfo); if (updateShopActionItemInfo != null) { updateShopActionItemInfo.UpdateInfo(updateShopActionItemInfo.IsOpen, updateLimitGoodsProto.remianPurchaseTimes); } else if (updateShopGoldItemInfo != null) { updateShopGoldItemInfo.UpdateInfo(updateShopGoldItemInfo.IsOpen, updateLimitGoodsProto.remianPurchaseTimes); } } ShopProxy.instance.OnShopActionItemInfoListUpdate(); ShopProxy.instance.OnShopGoldItemInfoListUpdate(); return(true); }