Browse Source

常驻礼包

何晓捷 2 years ago
parent
commit
dac6d530f8

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -122,5 +122,6 @@ namespace GFGGame
         public const string ACTIVE_SKILL = "ACTIVE_SKILL"; //���ܼ���
         public const string ACTIVE_SKILL = "ACTIVE_SKILL"; //���ܼ���
         
         
         public const string CONTINUOUS_REBATE_GIFT = "CONTINUOUS_REBATE_GIFT";//领取连续返利礼包
         public const string CONTINUOUS_REBATE_GIFT = "CONTINUOUS_REBATE_GIFT";//领取连续返利礼包
+        public const string CONTINUOUS_REBATE_GIFT_SHOP_BUY = "CONTINUOUS_REBATE_GIFT_SHOP_BUY";
     }
     }
 }
 }

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

@@ -112,7 +112,6 @@ namespace GFGGame
             await ShopSProxy.ReqShopInfo();
             await ShopSProxy.ReqShopInfo();
             await StudioSProxy.ReqStudioInfos();
             await StudioSProxy.ReqStudioInfos();
             await RoleInfoSProxy.ReqPersonalInfo();
             await RoleInfoSProxy.ReqPersonalInfo();
-            await EnduringGiftBoxSProxy.ReqGetAllGiftBagRebateStatus();
 
 
             GameGlobal.lastLoginTime = StorageDataManager.Instance.GetStorageValue(ConstStorageId.LAST_LOGIN_TIME);
             GameGlobal.lastLoginTime = StorageDataManager.Instance.GetStorageValue(ConstStorageId.LAST_LOGIN_TIME);
             long lastTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
             long lastTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
@@ -252,6 +251,7 @@ namespace GFGGame
             PoemGallerySProxy.ReqGalleryTheme().Coroutine();
             PoemGallerySProxy.ReqGalleryTheme().Coroutine();
             ArenaDataManager.Instance.ReqArenaInfo();
             ArenaDataManager.Instance.ReqArenaInfo();
             SkillSProxy.ReqGetSkillList(SkillType.LeagueSkill).Coroutine();
             SkillSProxy.ReqGetSkillList(SkillType.LeagueSkill).Coroutine();
+            EnduringGiftBoxSProxy.ReqGetAllGiftBagRebateStatus().Coroutine();
 
 
             int storageAutoPlay = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY);
             int storageAutoPlay = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY);
             FightDataManager.Instance.autoPlay = storageAutoPlay <= 0 ? false : true;
             FightDataManager.Instance.autoPlay = storageAutoPlay <= 0 ? false : true;

+ 1 - 1
GameClient/Assets/Game/HotUpdate/GameConfig.cs

@@ -18,7 +18,7 @@ namespace GFGGame
             ET.Log.Debug($"gamecfg \n{json}");
             ET.Log.Debug($"gamecfg \n{json}");
             var result = JsonMapper.ToObject<Result>(json);
             var result = JsonMapper.ToObject<Result>(json);
             LoginAddress = result.loginApiUrl;
             LoginAddress = result.loginApiUrl;
-            //LoginAddress = "10.108.64.127:10005";
+            LoginAddress = "127.0.0.1:10005";//测试地址
             PlatformName = result.platformName;
             PlatformName = result.platformName;
             showGM = int.Parse(result.showGM);
             showGM = int.Parse(result.showGM);
             GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
             GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";

+ 2 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/EnduringGiftBoxSProxy.cs

@@ -45,6 +45,8 @@ namespace GFGGame
                 {
                 {
                     var itemDataList = ItemUtil.CreateItemDataList(response.ItemList);
                     var itemDataList = ItemUtil.CreateItemDataList(response.ItemList);
                     BonusController.TryShowBonusList(itemDataList);
                     BonusController.TryShowBonusList(itemDataList);
+                    EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(ShopCfgArray.Instance.GetCfg(shopId)
+                        .itemId);
                     EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT);
                     EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT);
                     return true;
                     return true;
                 }
                 }

+ 7 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ShopSProxy.cs

@@ -47,6 +47,13 @@ namespace GFGGame
                     {
                     {
                         itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, response.Times * shopCfg.itemNum);
                         itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, response.Times * shopCfg.itemNum);
                     }
                     }
+                    
+                    if (itemCfg.itemType == ConstItemType.GIFT_BAG &&
+                        itemCfg.subType == ConstItemSubType.CONTINUOUS_REWARD_GIFT)
+                    {
+                        EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, shopCfg);
+                    }
+                    
                     BonusController.TryShowBonusList(itemDatas);
                     BonusController.TryShowBonusList(itemDatas);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
                     return true;
                     return true;

+ 46 - 4
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/EnduringGiftBoxView.cs

@@ -39,7 +39,7 @@ namespace GFGGame
             this.viewCom.Center();
             this.viewCom.Center();
             this.modal = true;
             this.modal = true;
             viewAnimationType = EnumViewAnimationType.None;
             viewAnimationType = EnumViewAnimationType.None;
-            
+
             _ui.m_btnSure.onClick.Add(OnClickBtnSure);
             _ui.m_btnSure.onClick.Add(OnClickBtnSure);
             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
             _ui.m_btnBack.onClick.Add(OnClickBtnCancel);
             _ui.m_btnBack.onClick.Add(OnClickBtnCancel);
@@ -67,19 +67,23 @@ namespace GFGGame
             AddEffect();
             AddEffect();
             _ui.m_t1.Play();
             _ui.m_t1.Play();
             _ui.m_t2.Play();
             _ui.m_t2.Play();
+         
             UpdateView();
             UpdateView();
         }
         }
 
 
         protected override void AddEventListener()
         protected override void AddEventListener()
         {
         {
             base.AddEventListener();
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpDayRebateAndView);
+            EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, UpdateView);
+            // EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
         }
         }
 
 
         protected override void RemoveEventListener()
         protected override void RemoveEventListener()
         {
         {
             base.RemoveEventListener();
             base.RemoveEventListener();
-            EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpdateView);
         }
         }
 
 
         private void AddEffect()
         private void AddEffect()
@@ -286,6 +290,7 @@ namespace GFGGame
             }
             }
 
 
             //领取按钮点击事件
             //领取按钮点击事件
+            item.m_btnCurReceive.target.onClick.Add(OnBtnCurReceiveClick);
             //购买按钮点击事件
             //购买按钮点击事件
             item.m_btnBuy.target.onClick.Add(OnBtnBuyClick);
             item.m_btnBuy.target.onClick.Add(OnBtnBuyClick);
 
 
@@ -295,6 +300,22 @@ namespace GFGGame
         }
         }
 
 
         //领取按钮点击事件
         //领取按钮点击事件
+        private void OnBtnCurReceiveClick(EventContext context)
+        {
+            GObject sender = context.sender as GObject;
+            GObject obj = sender.parent;
+            ShopCfg cfg = obj.data as ShopCfg;
+            bool isSellOut = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(cfg.itemId);
+
+            if (isSellOut)
+            {
+                EnduringGiftBoxSProxy.ReqGetGiftBagRebate(cfg.id).Coroutine();
+            }
+            else
+            {
+                PromptController.Instance.ShowFloatTextPrompt("无法领取");
+            }
+        }
 
 
         //购买按钮点击事件
         //购买按钮点击事件
         private void OnBtnBuyClick(EventContext context)
         private void OnBtnBuyClick(EventContext context)
@@ -430,9 +451,30 @@ namespace GFGGame
             this.Hide();
             this.Hide();
         }
         }
 
 
-        private void OnClickBtnCancel()
+        private void UpDayRebateAndView(EventContext context)
+        {
+            ShopCfg shopCfg = context.data as ShopCfg;
+            var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
+            if (itemCfg.itemType == ConstItemType.GIFT_BAG &&
+                itemCfg.subType == ConstItemSubType.CONTINUOUS_REWARD_GIFT)
+            {
+                EnduringGiftBoxDataManager.Instance.AddDayAllRebateItemIds(itemCfg.id);
+                EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(itemCfg.id);
+            }
+
+            UpdateView();
+        }
+
+        protected override void OnHide()
         {
         {
             Dispose();
             Dispose();
+            base.Hide();
+            _onSuccess = null;
+        }
+        
+        private void OnClickBtnCancel()
+        {
+            // Dispose();
             this.Hide();
             this.Hide();
         }
         }
     }
     }

BIN
GameClient/Assets/ResIn/UI/EnduringGiftBox/EnduringGiftBox_fui.bytes