Forráskód Böngészése

抽奖次数显示

guodong 1 éve
szülő
commit
95698700ba

+ 22 - 1
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -34,8 +34,10 @@ namespace GFGGame
         //存储奖池免费时间,大于存储时间免费
         public Dictionary<int, long> luckyBoxFreeTimeMillDic = new Dictionary<int, long>();
 
+        //存储奖池摘星次数
+        public Dictionary<int, long> luckyBoxPlayTimesDic = new Dictionary<int, long>();
+
 
-        public int times = 0;
         public int luckyBoxIndex;
         public List<ItemData> RewardList
         {
@@ -86,6 +88,25 @@ namespace GFGGame
             {
                 luckyBoxFreeTimeMillDic[response.KsLuckyBoxId[i]] = response.VsFreeTime[i];
             }
+            luckyBoxPlayTimesDic.Clear();
+            count = response.KsPlayedId.Count;
+            for (var i = 0; i < count; i++)
+            {
+                luckyBoxPlayTimesDic[response.KsPlayedId[i]] = response.VsPlayedTimes[i];
+            }
+        }
+
+        public void UpdatePlayTimes(int luckyBoxId, long playTimes)
+        {
+            luckyBoxPlayTimesDic.TryGetValue(luckyBoxId, out long times);
+            times += playTimes;
+            luckyBoxPlayTimesDic[luckyBoxId] = times;
+        }
+
+        public long GetPlayTimes(int luckyBoxId)
+        {
+            luckyBoxPlayTimesDic.TryGetValue(luckyBoxId, out long times);
+            return times;
         }
 
         public void UpdateFreeTime(int luckyBoxId, long freeTimeMill)

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/LuckyBox/UI_LuckyBoxPreShowUI.cs

@@ -12,6 +12,7 @@ namespace UI.LuckyBox
         public UI_ButtonTab1 m_btnProb;
         public GList m_list;
         public UI_Component1 m_compText;
+        public GTextField m_txtPlayTimes;
         public const string URL = "ui://drx9d1usga16e";
         public const string PACKAGE_NAME = "LuckyBox";
         public const string RES_NAME = "LuckyBoxPreShowUI";
@@ -64,6 +65,7 @@ namespace UI.LuckyBox
             m_btnProb = (UI_ButtonTab1)UI_ButtonTab1.Create(comp.GetChild("btnProb"));
             m_list = (GList)comp.GetChild("list");
             m_compText = (UI_Component1)UI_Component1.Create(comp.GetChild("compText"));
+            m_txtPlayTimes = (GTextField)comp.GetChild("txtPlayTimes");
         }
         public void Dispose(bool disposeTarget = false)
         {
@@ -75,6 +77,7 @@ namespace UI.LuckyBox
             m_list = null;
             m_compText.Dispose();
             m_compText = null;
+            m_txtPlayTimes = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 1 - 2
GameClient/Assets/Game/HotUpdate/ServerProxy/LuckyBoxSProxy.cs

@@ -56,8 +56,7 @@ namespace GFGGame
                             ActivityDataManager.Instance.allLimitStlycTimes += response.Times;
                         }
                     }
-
-                    LuckyBoxDataManager.Instance.times = response.Times;
+                    LuckyBoxDataManager.Instance.UpdatePlayTimes(response.LuckyBoxId, response.Times);
                     // LuckyBoxDataManager.Instance.luckyBoxIndex = response.LuckyBoxId;
                     LuckyBoxDataManager.Instance.RewardList = ItemUtil.CreateItemDataList(response.bonusList);
                     return true;

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxPreShowView.cs

@@ -40,6 +40,8 @@ namespace GFGGame
             _ui.m_list.RemoveChildrenToPool();
             _ui.m_list.itemRenderer = ListItemRenderer;
             _ui.m_list.numItems = _bonusList.Count;
+            long playTimes = LuckyBoxDataManager.Instance.GetPlayTimes(cfg.id);
+            _ui.m_txtPlayTimes.SetVar("name", cfg.name).SetVar("times", playTimes  + "").FlushVars();
         }
 
         protected override void OnHide()

BIN
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_fui.bytes