浏览代码

每日重置

guodong 3 年之前
父节点
当前提交
98a9ff9b4e

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit c6d6248d1540bac39c1c4280fd57c5f7e4c0a36e
+Subproject commit cbc8e9c8281e222864f334a39f05cae1b53b56ab

+ 11 - 9
GameClient/Assets/Game/HotUpdate/Data/Handler/RoleDataHandler.cs

@@ -1,5 +1,6 @@
 using ET;
 using FairyGUI;
+using static UnityEngine.UI.CanvasScaler;
 
 namespace GFGGame
 {
@@ -10,8 +11,10 @@ namespace GFGGame
         private static int _heartbeatCDEnd = 0;
         public static void StartUpdate()
         {
-            _heartbeatCDEnd = ServerDataManager.currentTimeSecs + INTERVAL_HEARTBEAT;
+            int currentTimeSecs = (int)(Game.TimeInfo.ServerNow() / 1000);
+            _heartbeatCDEnd = currentTimeSecs + INTERVAL_HEARTBEAT;
             StopUpdate();
+            //每秒检测
             Timers.inst.Add(1, 0, OnUpdate);
         }
 
@@ -22,27 +25,26 @@ namespace GFGGame
 
         private static void OnUpdate(object param)
         {
-            if(!RoleDataManager.powerTimeLock &&!RoleDataManager.CheckPowerFull())
+            int currentTimeSecs = (int)(Game.TimeInfo.ServerNow() / 1000);
+            if (!RoleDataManager.powerTimeServerLock &&!RoleDataManager.CheckPowerFull())
             {
                 int powerTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerTime);
-                int passTime = ServerDataManager.currentTimeSecs - powerTime;
+                int passTime = currentTimeSecs - powerTime;
                 if(passTime >= GameConst.INTERVAL_TIME_SECONDS_POWER)
                 {
-                    RoleDataManager.powerTimeLock = true;
+                    RoleDataManager.powerTimeServerLock = true;
                     NumericHelper.RequestAddAttributePoint(GameGlobal.zoneScene, NumericType.Power).Coroutine();
                 }
             }
-            int currentTimeSecs = ServerDataManager.currentTimeSecs;
             if(currentTimeSecs >= _heartbeatCDEnd) 
             {
                 //GameProxy.ReqUpdateTime();
                 _heartbeatCDEnd = currentTimeSecs + INTERVAL_HEARTBEAT;
             }
-            int day = ServerDataManager.CurrentDay;
-            int recommendDay = GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount);
-            if(recommendDay >= 0 && recommendDay != day) 
+            int dailyResetSecs = GameGlobal.myNumericComponent.GetAsInt(NumericType.DailyResetSecs);
+            if (TimeHelper.ServerNowSecs >= dailyResetSecs)
             {
-                StoryDataManager.ResetDailyData();
+                RoleSproxy.ResetDailyData().Coroutine();
             }
         }
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -8,7 +8,7 @@ namespace GFGGame
 {
     public class RoleDataManager
     {
-        public static bool powerTimeLock;
+        public static bool powerTimeServerLock;
         public static long roleId;
         public static string roleName;
         public static int rechargeTotal;

+ 0 - 49
GameClient/Assets/Game/HotUpdate/Data/ServerDataManager.cs

@@ -1,49 +0,0 @@
-using System;
-
-namespace GFGGame
-{
-    public class ServerDataManager
-    {
-        private const long TIME_ORIGINAL = 621355968000000000;
-        private static long _dTime;
-
-
-        public static void SetServerTime(long serverTime)
-        {
-            _dTime = serverTime - CurrentlocalTime;
-        }
-
-        public static long currentTimeMillis
-        {
-            get
-            {
-                return CurrentlocalTime + _dTime;
-            }
-        }
-
-        public static int currentTimeSecs
-        {
-            get
-            {
-                return (int)currentTimeMillis/1000;
-            }
-        }
-
-        public static long CurrentlocalTime
-        {
-            get
-            {
-                return (DateTime.Now.Ticks - TIME_ORIGINAL)/10000;
-            }
-            
-        }
-
-        public static int CurrentDay {
-            get
-            {
-                DateTime dateTime = new DateTime(currentTimeMillis*10000 + TIME_ORIGINAL);
-                return dateTime.Day;
-            }
-        }
-    }
-}

+ 0 - 9
GameClient/Assets/Game/HotUpdate/Data/StoryDataManager.cs

@@ -20,7 +20,6 @@ namespace GFGGame
         public static int _passLevel = 0;
         private static int _passChapterJY = 10000;
         private static int _passLevelJY = 0;
-        public static int recommendDay = -1;
 
         //关卡最高分数记录
         private static Dictionary<int, int> _highestScoreDic = new Dictionary<int, int>();
@@ -90,14 +89,6 @@ namespace GFGGame
             }
         }
 
-        public static void ResetDailyData()
-        {
-            //_recommendCount = GameConst.MAX_COUNT_RECOMMEND;
-            int day = ServerDataManager.CurrentDay;
-            //recommendDay = day;
-            //GameProxy.ReqUpdateRecommendCount(_recommendCount);
-        }
-
         //获取宝箱奖励状态
         public static int GetChapterBonusStatus(int chapterID, int index)
         {

+ 6 - 6
GameClient/Assets/Game/HotUpdate/Net/Proxy/GameProxy.cs

@@ -176,7 +176,7 @@ namespace GFGGame
             {
                 if (result != null && result.roleInfo != null)
                 {
-                    ServerDataManager.SetServerTime(result.roleInfo.serverTime);
+                    //ServerDataManager.SetServerTime(result.roleInfo.serverTime);
                     AntiAddictionController.CheckOnlineTime(result.roleInfo.onlineTimeSecs, result.roleInfo.onlineDurationSecs, result.roleInfo.onlineDurationSecsDay);
                     RoleDataManager.rechargeTotalMon = result.roleInfo.rechargeTotalMon;
                 }
@@ -185,12 +185,12 @@ namespace GFGGame
 
         public static void ReqUpdateRecommendCount(int recommendCount)
         {
-            int day = StoryDataManager.recommendDay;
-            Dictionary<string, object> data = JsonUtil.createJsonDic("id", RoleDataManager.roleId, "recommendCount", recommendCount, "recommendDay", day);
-            Post(GameProtoId.UPDATE_RECOMMEND_COUNT, "roleInfo", data, (GameResult result) =>
-            {
+            //int day = StoryDataManager.recommendDay;
+            //Dictionary<string, object> data = JsonUtil.createJsonDic("id", RoleDataManager.roleId, "recommendCount", recommendCount, "recommendDay", day);
+            //Post(GameProtoId.UPDATE_RECOMMEND_COUNT, "roleInfo", data, (GameResult result) =>
+            //{
 
-            });
+            //});
         }
 
         public static void ReqUpdateRecharge(int money)

+ 24 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/RoleSproxy.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using ET;
+
+namespace GFGGame
+{
+    public static class RoleSproxy
+    {
+        public static async ETTask ResetDailyData()
+        {
+            M2C_ResetDailyData response = null;
+            response = (M2C_ResetDailyData)await MessageHelper.SendToServer(new C2M_ResetDailyData());
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    
+                }
+            }
+        }
+    }
+}

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/ServerDataManager.cs.meta → GameClient/Assets/Game/HotUpdate/ServerProxy/RoleSproxy.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 84728b8b83bdbb8449835c1731f7bca0
+guid: fdecfed829472cc4786338b3f3449600
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 5 - 7
GameClient/Assets/Game/HotUpdate/Views/CommonGame/ApproachOfItemView.cs

@@ -77,9 +77,8 @@ namespace GFGGame
             if (functionId == ConstFunctionId.JU_QING_GUAN_QIA)
             {
                 string value = infos[1];
-                string[] values = value.Split('_');
-                int chapterInt = int.Parse(values[0]);
-                int levelInt = int.Parse(values[1]);
+                var levelCfgId = int.Parse(value);
+                CalculateHelper.GetStoryChapterLevel(levelCfgId, out int chapterInt, out int levelInt);
                 string chapter = NumberUtil.GetChiniseNumberText(chapterInt);
                 string level = NumberUtil.GetChiniseNumberText(levelInt);
                 listItem.target.text = string.Format(gameFunctionCfg.name, chapter, level);
@@ -106,16 +105,15 @@ namespace GFGGame
                     break;
                 case ConstFunctionId.JU_QING_GUAN_QIA:
                     string value = infos[1];
-                    string[] values = value.Split('_');
-                    int chapterInt = int.Parse(values[0]);
-                    int levelInt = int.Parse(values[1]);
+                    var levelCfgId = int.Parse(value);
+                    CalculateHelper.GetStoryChapterLevel(levelCfgId, out int chapterInt, out int levelInt);
                     if ((string)_fromeViewDatas[0] == ViewName.DRESS_UP_FIGHT_VIEW)
                     {
                         //从战斗换装必需品来源跳转到剧情界面,在剧情界面点返回后直接返回章节界面,无需返回换装界面
                         _fromeViewDatas = null;
                     }
                     ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, chapterInt, _fromeViewDatas, true);
-                    StoryController.ShowLevelView(chapterInt, levelInt);
+                    StoryController.ShowLevelView(levelCfgId);
                     break;
                 case ConstFunctionId.FU_ZHUANG_HE_CHENG:
 

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterView.cs

@@ -193,7 +193,8 @@ namespace GFGGame
 
             UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(context.sender as GObject);
             int level = int.Parse(levelItem.target.name.Replace("g", ""));
-            StoryController.ShowLevelView(_chapterID, level);
+            var levelCfgId = CalculateHelper.GetStoryLevelId(_chapterID, level);
+            StoryController.ShowLevelView(levelCfgId);
         }
 
         private void UpdateBonusBoxName(UI_CompBonusBox bonusBox, string name)

+ 7 - 16
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryController.cs

@@ -1,20 +1,21 @@
 using ET;
+using log4net.Core;
 using System.Collections.Generic;
 
 namespace GFGGame
 {
     public class StoryController
     {
-        public static void ShowLevelView(int chapterID, int level)
-        {
-            int levelID = chapterID*GameConst.STORY_LEVEL_KEY_NUM + level;
+        public static void ShowLevelView(int levelCfgId)
+{
+            CalculateHelper.GetStoryChapterLevel(levelCfgId, out int chapterID, out int level);
             StoryDataManager.currentChapter = chapterID;
-            StoryDataManager.currentLevelCfgId = levelID;
-            StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
+            StoryDataManager.currentLevelCfgId = levelCfgId;
+            StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
             StoryDataManager.currentLevel = level;
             if (levelCfg.fightID.Length > 0)
             {
-                ViewManager.Show(ViewName.STORY_LEVEL_INFO_VIEW, levelID);
+                ViewManager.Show(ViewName.STORY_LEVEL_INFO_VIEW, levelCfgId);
             }
             else if (levelCfg.storyStartID.Length > 0)
             {
@@ -79,20 +80,10 @@ namespace GFGGame
 
         private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
         {
-
-            //List<ItemData> bonusList = null;
-            bool _fistPassLastLvl = false;
-            bool _curLvfirstPass = false;
             if (!StoryDataManager.CheckCurrentLevelPass())
             {
-                //bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass);
                 StorySProxy.FinishStoryDialogLevel(StoryDataManager.currentLevelCfgId).Coroutine();
             }
-            
-            //if (bonusList != null && bonusList.Count > 0)
-            //{
-            //    ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
-            //}
         }
 
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetScoreView.cs

@@ -467,7 +467,7 @@ namespace GFGGame
         private void Skip(object param = null)
         {
             EventAgent.RemoveEventListener(ConstMessage.CARD_SKILL, UpdateCircleResult);
-            ViewManager.Show(ViewName.STORY_FIGHT_RESULT_VIEW);
+            StoryController.CheckStoryFightResult().Coroutine();
         }
         private void Reset()
         {