Quellcode durchsuchen

添加华容道小游戏的刷新页面事件;修改奖励列表弹窗的通用逻辑

leiyasi vor 1 Jahr
Ursprung
Commit
fb861f2333

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

@@ -213,5 +213,8 @@ namespace GFGGame
 
         //更新游戏界面门票数量
         public const string MINI_GAME_UPDATE = "MINI_GAME_UPDATE";
+
+        // 更新华容道活动界面数据
+        public const string ACTIVITY_HUARONGDAO_UPDATE = "ACTIVITY_HUARONGDAO_UPDATE";
     }
 }

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/ActivityHuaRongDao/UI_level.cs

@@ -9,6 +9,7 @@ namespace UI.ActivityHuaRongDao
         public GComponent target;
         public Controller m_light;
         public GTextField m_levelNum;
+        public GGraph m_reward;
         public const string URL = "ui://wf8geywtltoye";
         public const string PACKAGE_NAME = "ActivityHuaRongDao";
         public const string RES_NAME = "level";
@@ -58,11 +59,13 @@ namespace UI.ActivityHuaRongDao
         {
             m_light = comp.GetController("light");
             m_levelNum = (GTextField)comp.GetChild("levelNum");
+            m_reward = (GGraph)comp.GetChild("reward");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_light = null;
             m_levelNum = null;
+            m_reward = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 3 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/DailyWelfare/UI_GiftDetailUI.cs

@@ -9,8 +9,8 @@ namespace UI.DailyWelfare
         public GComponent target;
         public Controller m_c1;
         public GComponent m_bg;
-        public GList m_listGiftBag;
         public GButton m_btnCheck;
+        public GList m_listGiftBag;
         public const string URL = "ui://t8nwuj7ievdh2a";
         public const string PACKAGE_NAME = "DailyWelfare";
         public const string RES_NAME = "GiftDetailUI";
@@ -60,15 +60,15 @@ namespace UI.DailyWelfare
         {
             m_c1 = comp.GetController("c1");
             m_bg = (GComponent)comp.GetChild("bg");
-            m_listGiftBag = (GList)comp.GetChild("listGiftBag");
             m_btnCheck = (GButton)comp.GetChild("btnCheck");
+            m_listGiftBag = (GList)comp.GetChild("listGiftBag");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_c1 = null;
             m_bg = null;
-            m_listGiftBag = null;
             m_btnCheck = null;
+            m_listGiftBag = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 29 - 1
GameClient/Assets/Game/HotUpdate/Views/ActivityHuaRongDao/ActivityHuaRongDaoEntryView.cs

@@ -55,6 +55,18 @@ namespace GFGGame
             base.OnHide();
         }
 
+        protected override void AddEventListener()
+        {
+            base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.ACTIVITY_HUARONGDAO_UPDATE, InitInfo);
+        }
+
+        protected override void RemoveEventListener()
+        {
+            base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_HUARONGDAO_UPDATE, InitInfo);
+        }
+
         private void InitIDList()
         {
             IDList = new List<int>();
@@ -75,7 +87,13 @@ namespace GFGGame
 
             _ui.m_scrollPane.m_list.ResizeToFit();
             InitProgressWidth();
-            _ui.m_scrollPane.m_list.ScrollToView(curLevel);
+            ProgressAutoLocate();
+        }
+
+        private void ProgressAutoLocate()
+        {
+            _ui.m_scrollPane.target.scrollPane.posX
+                = curLevel * (_ui.m_scrollPane.m_list.GetChildAt(0).width + _ui.m_scrollPane.m_list.columnGap);
         }
 
         private void OnBtnBackClick()
@@ -127,7 +145,17 @@ namespace GFGGame
             UI_reward rewardUI = UI_reward.Proxy(item);
             rewardUI.m_level.m_levelNum.text = (index + 1).ToString();
             rewardUI.m_level.m_light.SetSelectedIndex(curLevel > index ? 0 : 1);
+            rewardUI.m_level.m_reward.touchable = (index >= curLevel);
+            rewardUI.m_level.m_reward.data = index;
+            rewardUI.m_level.m_reward.onClick.Add(OnClickReward);
             UI_reward.ProxyEnd();
         }
+
+        private void OnClickReward(EventContext eventContext)
+        {
+            GObject obj = (GObject)eventContext.sender;
+            int id = (int)obj.data;
+            ViewManager.Show<GiftDetailView>(HuarongRoadGameArray.Instance.GetCfg(IDList[id]).bonusWinArr);
+        }
     }
 }

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/ActivityHuaRongDao/ActivityHuaRongDaoView.cs

@@ -326,6 +326,7 @@ namespace GFGGame
                                 // 关卡推进
                                 int passLevel = cfg.resArr[0];
                                 ActivityHuaRongDaoEntryView.curLevel = Mathf.Max(passLevel, ActivityHuaRongDaoEntryView.curLevel);
+                                EventAgent.DispatchEvent(ConstMessage.ACTIVITY_HUARONGDAO_UPDATE);
                                 // 弹出成功界面
                                 ViewManager.Show<ActivityHuaRongDaoSuccessView>(cfg);
                             }

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/ActivityWanShiLiUI/ActivityWanShiLiView.cs

@@ -288,7 +288,8 @@ namespace GFGGame
             else
             {
                 // 显示奖励详细列表
-                ViewManager.Show<GiftDetailView>(getState.rewardID);
+                ActivityRecharge2Cfg _rechargeCfgs = ActivityRecharge2CfgArray.Instance.GetCfg(getState.rewardID);
+                ViewManager.Show<GiftDetailView>(_rechargeCfgs.bonusArr);
             }
         }
 

+ 5 - 4
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/GiftDetailView.cs

@@ -31,6 +31,8 @@ namespace GFGGame
             this.viewCom = _ui.target;
             this.viewCom.Center();
             this.modal = true;
+            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
+
             _ui.m_listGiftBag.itemRenderer = ListRewardItemRender;
             _ui.m_btnCheck.onClick.Add(OnBtnCheckClick);
         }
@@ -38,10 +40,9 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            int id = (int)viewData;
-            ActivityRecharge2Cfg _rechargeCfgs = ActivityRecharge2CfgArray.Instance.GetCfg(id);
-            _ui.m_listGiftBag.data = _rechargeCfgs.bonusArr;
-            _ui.m_listGiftBag.numItems = _rechargeCfgs.bonusArr.Length;
+            int[][] gifts = (int[][])viewData;
+            _ui.m_listGiftBag.data = gifts;
+            _ui.m_listGiftBag.numItems = gifts.Length;
             _ui.m_listGiftBag.scrollPane.ScrollTop();
         }
 

BIN
GameClient/Assets/ResIn/UI/ActivityHuaRongDao/ActivityHuaRongDao_fui.bytes


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_fui.bytes