zhaoyang 3 år sedan
förälder
incheckning
cf7666fcb3

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -189,8 +189,8 @@ namespace GFGGame
             MainStorySProxy.GetStoryInfos().Coroutine();
             CardSProxy.GetCardInfos().Coroutine();
             RechargeSProxy.ReqRechargeInfo().Coroutine();
-            // RechargeSProxy.ReqRequestGiftBagInfo().Coroutine();
-            // RechargeSProxy.ReqExchangeInfo().Coroutine();
+            RechargeSProxy.ReqRequestGiftBagInfo().Coroutine();
+            RechargeSProxy.ReqExchangeInfo().Coroutine();
 
             EquipDataCache.cacher.autoPlay = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY) <= 0 ? false : true;
             EquipDataCache.cacher.fightSpeed = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED) <= 1 ? 1 : StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED);

+ 7 - 4
GameClient/Assets/Game/HotUpdate/Data/RechargeDataManager.cs

@@ -35,7 +35,7 @@ namespace GFGGame
 
     public class RechargeDataManager : SingletonBase<RechargeDataManager>
     {
-        public string[] refreshType = { "", "日", "周", "月" };
+        public string[] refreshType = { "永久限购", "限购", "限购", "限购" };
 
         private Dictionary<int, int> _rechargeDic = new Dictionary<int, int>();
         private Dictionary<int, int> _giftDic = new Dictionary<int, int>();
@@ -87,7 +87,7 @@ namespace GFGGame
         /// <returns></returns>
         public int GetRechargeBuyNumById(int rechargeId)
         {
-            return !_rechargeDic.ContainsKey(rechargeId) ? 0 : _giftDic[rechargeId];
+            return !_rechargeDic.ContainsKey(rechargeId) ? 0 : _rechargeDic[rechargeId];
         }
         /// <summary>
         /// 根据礼包id获取购买次数
@@ -105,7 +105,7 @@ namespace GFGGame
         /// <returns></returns>
         public int GetExchangeBuyNumById(int exchangeId)
         {
-            return !_exchangeDic.ContainsKey(exchangeId) ? 0 : _giftDic[exchangeId];
+            return !_exchangeDic.ContainsKey(exchangeId) ? 0 : _exchangeDic[exchangeId];
         }
 
 
@@ -133,7 +133,7 @@ namespace GFGGame
                 int buyTypeA = (a.maxBuyNum == 0 || a.maxBuyNum - GetGiftBuyNumById(a.id) > 0) ? 1 : -1;
                 int buyTypeB = (b.maxBuyNum == 0 || b.maxBuyNum - GetGiftBuyNumById(b.id) > 0) ? 1 : -1;
                 if (buyTypeA > buyTypeB) return -1;
-                if (buyTypeA < buyTypeB) return -1;
+                if (buyTypeA < buyTypeB) return 1;
 
                 //解锁状态
                 int lockA = GetGiftStateById(a.id) ? 1 : -1;
@@ -141,6 +141,9 @@ namespace GFGGame
                 if (lockA > lockB) return -1;
                 if (lockA < lockB) return 1;
 
+                // if (buyTypeA > 0 && buyTypeB < 0) return -1;
+                // if (buyTypeB > 0 && buyTypeA < 0) return 1;
+
                 //免费>钻石>现金>道具
                 if (a.costType < b.costType) return -1;
                 if (a.costType > b.costType) return 1;

+ 13 - 8
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/GiftBagBuyView.cs

@@ -102,7 +102,7 @@ namespace GFGGame
             }
             (item.data as ItemView).SetData(itemData);
         }
-        private void OnBtnBuyClick()
+        private async void OnBtnBuyClick()
         {
 
             GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(_giftId);
@@ -115,15 +115,20 @@ namespace GFGGame
                     return;
                 }
             }
-            if (cfg.costType == CostType.RMB)
+            bool result = await RechargeSProxy.ReqBuyGiftBag(_giftId);
+            if (result && cfg.costType == CostType.RMB)
             {
-
-            }
-            else
-            {
-                RechargeSProxy.ReqBuyGiftBag(_giftId).Coroutine();
-                this.Hide();
+                PromptController.Instance.ShowFloatTextPrompt("虚拟充值购买成功");
             }
+            // if (cfg.costType == CostType.RMB)
+            // {
+
+            // }
+            // else
+            // {
+            // RechargeSProxy.ReqBuyGiftBag(_giftId).Coroutine();
+            this.Hide();
+            // }
         }
     }
 }

+ 19 - 8
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/RechargeStoreView.cs

@@ -56,7 +56,12 @@ namespace GFGGame
         {
             base.OnShown();
             _valueBarController.OnShown();
+            _ui.m_c1.selectedIndex = 0;
+            _ui.m_comTab.m_c1.selectedIndex = 0;
             _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
+            _ui.m_listExchange.numItems = ShopExchangeCfgArray.Instance.dataArray.Length;
+            UpdateGiftBagList();
+            OnTabChange();
         }
 
         protected override void OnHide()
@@ -72,9 +77,6 @@ namespace GFGGame
         private void OnComTabChange()
         {
             _ui.m_c1.selectedIndex = _ui.m_comTab.m_c1.selectedIndex;
-            _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
-            _ui.m_listExchange.numItems = ShopExchangeCfgArray.Instance.dataArray.Length;
-            UpdateGiftBagList();
 
         }
         private void OnTabChange()
@@ -104,8 +106,9 @@ namespace GFGGame
             item.m_btnBuy.target.data = index;
             item.m_txtName.text = string.Format("{0}{1}", itemData.itemNum, itemData.name);
             item.m_txtDesc.text = string.Format("首充赠送+{0}{1}", itemData.itemNum, itemData.name);
-            item.m_imgDouble.visible = RechargeDataManager.Instance.GetRechargeBuyNumById(itemData.id) <= itemData.doubleTimes;
-            item.m_txtDesc.visible = RechargeDataManager.Instance.GetRechargeBuyNumById(itemData.id) <= itemData.doubleTimes; ;
+            bool isDouble = RechargeDataManager.Instance.GetRechargeBuyNumById(itemData.id) < itemData.doubleTimes;
+            item.m_imgDouble.visible = isDouble;
+            item.m_txtDesc.visible = isDouble;
             item.m_icon.url = "ui://RechargeStore/sc_zizhuan_" + itemData.id;
 
             UI_StoreListItem.ProxyEnd();
@@ -118,7 +121,7 @@ namespace GFGGame
             item.m_txtName.text = cfg.name;
             item.m_icon.url = string.Format("ui://RechargeStore/{0}", cfg.res);
 
-            item.m_txtDesc.SetVar("count", cfg.desc);
+            item.m_txtDesc.SetVar("count", cfg.desc).FlushVars(); ;
             item.m_grpDiscount.visible = cfg.desc != "";
 
             item.m_txtEndTime.text = RechargeDataManager.Instance.GetEndTime(cfg.id);
@@ -136,8 +139,9 @@ namespace GFGGame
             }
 
             int buyNum = RechargeDataManager.Instance.GetGiftBuyNumById(cfg.id);
-            item.m_txtLimit.text = string.Format("每{0}限购({1}/{2})", RechargeDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
-            if (cfg.refreshType == RefreshType.NONE) item.m_txtLimit.text = "永久限购";
+            item.m_txtLimit.text = string.Format("{0}({1}/{2})", RechargeDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
+            item.m_txtLimit.visible = cfg.maxBuyNum > 0;
+            // if (cfg.refreshType == RefreshType.NONE) item.m_txtLimit.text = "永久限购";
             // UI_Button14 btn = UI_Button14.Proxy(item.m_btnBuy);
             item.m_c1.selectedIndex = cfg.maxBuyNum == 0 || buyNum < cfg.maxBuyNum ? 0 : 1;
             if (item.m_c1.selectedIndex == 0)
@@ -181,6 +185,13 @@ namespace GFGGame
         private void OnBtnBuyClick(EventContext context)
         {
             GObject btn = context.sender as GObject;
+            int giftId = (int)btn.data;
+            GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(giftId);
+            if (cfg.maxBuyNum != 0 && RechargeDataManager.Instance.GetGiftBuyNumById(giftId) == cfg.maxBuyNum)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("已售罄");
+                return;
+            }
             ViewManager.Show<GiftBagBuyView>(btn.data);
         }
 

BIN
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes