浏览代码

Merge remote-tracking branch 'remotes/origin/master' into xiaojie

hexiaojie 2 年之前
父节点
当前提交
74b9490dee

+ 5 - 2
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -74,7 +74,6 @@ namespace GFGGame
         {
             luckyBoxFreeTimeMillDic.Clear();
             int count = response.KsLuckyBoxId.Count;
-            ET.Log.Debug("打印测试-------进入游戏时候的保存---------" + count);
             for (var i = 0; i < count; i++)
             {
                 luckyBoxFreeTimeMillDic[response.KsLuckyBoxId[i]] = response.VsFreeTime[i];
@@ -233,7 +232,11 @@ namespace GFGGame
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(costId);
             int costNum = GetCostNum(boxId, times);
             long hasNum = ItemDataManager.GetItemNum(itemCfg.id);
-            if (hasNum >= costNum)
+            long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
+            if (freeTime > 0 && freeTime < TimeHelper.ClientNow()) {
+                onSuccess();
+            }
+            else if (hasNum >= costNum)
             {
                 AlertUI.Show(string.Format("是否花费{0}个{1}摘星{2}次?", costNum, itemCfg.name, times)).SetLeftButton(true).SetRightButton(true, "确定", (object data) => { onSuccess(); });
             }

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

@@ -7,7 +7,6 @@ namespace ET
     {
         protected override async ETTask Run(Session session, S2C_NoticeLuckyBoxFreeTime message)
         {
-            ET.Log.Debug("打印测试----------服务器下发-------");
             LuckyBoxDataManager.Instance.UpdateFreeTime(message.LuckyBoxId, message.FreeTime);
             await ETTask.CompletedTask;
         }
@@ -66,7 +65,6 @@ namespace GFGGame
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 {
-                    ET.Log.Debug("打印测试-------请求抽奖初始信息---------" + response.Error);
                     LuckyBoxDataManager.Instance.InitServerData(response);
                 }
             }

+ 9 - 12
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -133,7 +133,7 @@ namespace GFGGame
 
             Timers.inst.AddUpdate(CheckGuide);
 
-            Timers.inst.Add(0.1f, 0, OnTimerUpdate, 1);
+            Timers.inst.Add(1f, 0, OnTimerUpdate, 1);
         }
 
         private void OnTimerUpdate(object param)
@@ -144,11 +144,12 @@ namespace GFGGame
             UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
             if (freeTime > 0)
             {
-                if (freeTime > TimeHelper.ClientNow())
+                long timeDifference = freeTime - TimeHelper.ClientNow();
+                if (timeDifference> 0)
                 {
                     comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
                     comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true;
-                    string strFreeTime = TimeUtil.FormattingTimeTo_HHmmss(freeTime - TimeHelper.ClientNow());
+                    string strFreeTime = TimeUtil.FormattingTimeTo_HHmmss(timeDifference);
                     comBox.m_comLuckBoxBtn.m_txtFreeTime.text = string.Format("{0}后免费", strFreeTime);
                 }
                 else
@@ -157,11 +158,6 @@ namespace GFGGame
                     comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
                 }
             }
-            //else
-            //{
-            //    comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
-            //    comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
-            //}
 
             UI_ComBox1.ProxyEnd();
         }
@@ -327,7 +323,10 @@ namespace GFGGame
             GObject obj = context.sender as GObject;
             int boxId = (int)obj.data;
             LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
+            long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
+
             int boughtCount = GameGlobal.myNumericComponent.GetAsInt(luckyBoxCfg.numericType);
+
             if (boughtCount + LuckyBoxDataManager.ONCE_TIME > luckyBoxCfg.maxCount)
             {
                 PromptController.Instance.ShowFloatTextPrompt("抽奖次数不足");
@@ -335,13 +334,12 @@ namespace GFGGame
             }
             LuckyBoxDataManager.Instance.CheckItemEnough(boxId, LuckyBoxDataManager.ONCE_TIME, async () =>
              {
-                 long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
                  bool result = false;
-                 if (freeTime > 0 && freeTime > TimeHelper.ClientNow())
+                 if (freeTime > 0 && freeTime < TimeHelper.ClientNow())
                     result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME, true);
                  else
                     result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME);
-                  
+
                  if (result)
                  {
                      ViewManager.Show<LuckyBoxStarView>(null, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
@@ -454,7 +452,6 @@ namespace GFGGame
 
         private void UpdateFreeInfo()
         {
-            ET.Log.Debug("打印测试-------运行一次ddd---");
             int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
             LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
             long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);