Ver Fonte

每天清理一次日志

lzx há 19 horas atrás
pai
commit
7d0f3a38ca

+ 8 - 1
Assets/Scripts/GameLogic/Player/PlayerManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using Core.Audio;
 using Core.Language;
@@ -79,7 +80,7 @@ public class PlayerManager : Singleton<PlayerManager>
     public void Init()
     {
         AccountFileInfo.Instance.LoadPlayerData();
-        LogServer.Instance.playerID= AccountFileInfo.Instance.playerData.playerId;
+        LogServer.Instance.playerID = AccountFileInfo.Instance.playerData.playerId;
         SetConfigs();
 
         InitGameData();
@@ -484,6 +485,12 @@ public class PlayerManager : Singleton<PlayerManager>
     {
         if (TimeHelper.ClientNow() > AccountFileInfo.Instance.playerData.nextRefence)
         {
+            //每天删一次日志
+            if (File.Exists(Path.Combine(Application.persistentDataPath, "GameLog.txt")))
+            {
+                File.Delete(Path.Combine(Application.persistentDataPath, "GameLog.txt"));
+            }
+
             AccountFileInfo.Instance.playerData.todayTotalAds = 0;
             AccountFileInfo.Instance.playerData.nextRefence =
                 TimeHelper.GetBaseRefreshTime(TimeHelper.ClientNow());

+ 1 - 1
Assets/Scripts/GameUI/GameApplction.cs

@@ -48,7 +48,7 @@ public class GameApplction : IGameStart, ILogSend
     private GameStartUIPanel gameStartUIPanel;
     private System.Action LoadFinish;
 
-    private static string LogPath =>
+    public static string LogPath =>
         Path.Combine(Application.persistentDataPath, "GameLog.txt");
 
     private static readonly StringBuilder _cache = new StringBuilder();