Merge branch 'feature/clinic' into 'develop'
文件相关 See merge request aibis-dream/aibis-dream!322
This commit is contained in:
@@ -24,7 +24,7 @@ namespace AibisDream.Kit
|
||||
/// <summary>
|
||||
/// 每一行的打印内容
|
||||
/// </summary>
|
||||
private static string LogContent => "--------------------------" + Time + "--------------------------\n{0}\n{1}";
|
||||
private static string LogContent => Time + ": {0}\n{1}";
|
||||
|
||||
private FileLogger _fileLogger;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
@@ -14,6 +16,8 @@ namespace AibisDream
|
||||
{
|
||||
public class GameLoopManager : Singleton<GameLoopManager>
|
||||
{
|
||||
private const int MaxSaveNum = 200;
|
||||
|
||||
#region 运行模式相关
|
||||
|
||||
[Header("可用so合集")] public TalkSceneSO[] totalSceneSos;
|
||||
@@ -229,6 +233,9 @@ namespace AibisDream
|
||||
|
||||
// 存为Json
|
||||
JsonUtil.SaveJObject(saveFile, GetSavePath());
|
||||
#if !UNITY_EDITOR
|
||||
DeleteOldSave();
|
||||
#endif
|
||||
}
|
||||
|
||||
private string GetSavePath()
|
||||
@@ -245,9 +252,22 @@ namespace AibisDream
|
||||
gameStageStr = gameStage;
|
||||
}
|
||||
|
||||
return $"{SaveFilePath}/{_currentTalkSceneSo.name}_{gameStageStr}_{DateTime.Now:yyyyMMdd_HHmmss}";
|
||||
return $"{SaveFilePath}/{DateTime.Now:yyyyMMdd_HHmmss}_{_currentTalkSceneSo.name}_{gameStageStr}";
|
||||
}
|
||||
|
||||
private void DeleteOldSave()
|
||||
{
|
||||
var fileList = Directory.GetFiles(SaveFilePath);
|
||||
if (fileList.Length > MaxSaveNum)
|
||||
{
|
||||
var sorted = fileList.OrderByDescending(f => f).ToArray();
|
||||
for (var i = MaxSaveNum; i < fileList.Length; i++)
|
||||
{
|
||||
File.Delete(sorted[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user