// 刷新商店 public void OnClickUpdateShop() { ShopInfo info = ShopManager.Instance.GetShopInfo(_shopType); if (info == null) { return; } UIUtil.ShowConfirm(Str.Format("UI_SHOP_REFRESH_CONFIRM", info.GetRefreshCost()), "", () => { ShopManager.Instance.RequestRefreshShop(_shopType); }); }
// 请求手动刷新商店 public void RequestRefreshShop(ShopType shopType) { ShopInfo info = GetShopInfo(shopType); if (info == null) { return; } int costGold = info.GetRefreshCost(); if (UserManager.Instance.Gold < costGold) { UIUtil.ShowMsgFormat("MSG_CITY_BUILDING_GOLD_LIMIT"); return; } PCMInt data = new PCMInt(); data.arg = (int)shopType; NetworkManager.Instance.Send(eCommand.MANAUL_REFRESH_SHOP, data, (buffer) => { PGeneralGoodList ret = Net.Deserialize <PGeneralGoodList>(buffer); if (!Net.CheckErrorCode(ret.errorCode, eCommand.MANAUL_REFRESH_SHOP)) { return; } // 减少金钱 UserManager.Instance.CostMoney(costGold, PriceType.GOLD); // 增加刷新次数 ++info.refreshCount; OnRefreshShopInfo(ret, shopType); }); }