增加高亮功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Utility;
|
||||
@@ -15,6 +16,7 @@ namespace AibisDream
|
||||
private const string VariablePrefix = "$";
|
||||
private const string GlobalPrefix = "$global.";
|
||||
private const string DataPrefix = "$data.";
|
||||
private const int MaxSaveNum = 200;
|
||||
|
||||
private static readonly string SaveFilePath = Application.streamingAssetsPath + "/SaveFiles";
|
||||
|
||||
@@ -196,19 +198,19 @@ namespace AibisDream
|
||||
{
|
||||
case float:
|
||||
{
|
||||
var value = System.Convert.ToSingle(variablePair.Value);
|
||||
var value = Convert.ToSingle(variablePair.Value);
|
||||
floatDict.Add(variablePair.Key, value);
|
||||
break;
|
||||
}
|
||||
case string:
|
||||
{
|
||||
var value = System.Convert.ToString(variablePair.Value);
|
||||
var value = Convert.ToString(variablePair.Value);
|
||||
stringDict.Add(variablePair.Key, value);
|
||||
break;
|
||||
}
|
||||
case bool:
|
||||
{
|
||||
var value = System.Convert.ToBoolean(variablePair.Value);
|
||||
var value = Convert.ToBoolean(variablePair.Value);
|
||||
boolDict.Add(variablePair.Key, value);
|
||||
break;
|
||||
}
|
||||
@@ -230,6 +232,9 @@ namespace AibisDream
|
||||
// 先序列化Yarn变量
|
||||
var saveFile = new JObject();
|
||||
|
||||
// 保存版本号
|
||||
saveFile["version"] = $"Ver.{Application.version}";
|
||||
|
||||
// 保存系统数据
|
||||
saveFile["systemData"] = _dataContainer.SaveAsJson();
|
||||
|
||||
@@ -245,6 +250,20 @@ namespace AibisDream
|
||||
DeleteOldSave();
|
||||
#endif
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Load(string savePath)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user