mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-10-21 19:59:48 +08:00
Add Text Map Browser
Update Avatar Tab Image
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GrasscutterTools.Game
|
||||
{
|
||||
internal enum ClimateType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// 晴天
|
||||
/// </summary>
|
||||
Sunny,
|
||||
|
||||
/// <summary>
|
||||
/// 多云
|
||||
/// </summary>
|
||||
Cloudy,
|
||||
|
||||
/// <summary>
|
||||
/// 雨
|
||||
/// </summary>
|
||||
Rain,
|
||||
|
||||
/// <summary>
|
||||
/// 雷暴
|
||||
/// </summary>
|
||||
Thunderstorm,
|
||||
|
||||
/// <summary>
|
||||
/// 雪
|
||||
/// </summary>
|
||||
Snow,
|
||||
|
||||
/// <summary>
|
||||
/// 雾
|
||||
/// </summary>
|
||||
Mist
|
||||
}
|
||||
}
|
70
Source/GrasscutterTools/Game/TextMapData.cs
Normal file
70
Source/GrasscutterTools/Game/TextMapData.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.Game
|
||||
{
|
||||
public class TextMapData
|
||||
{
|
||||
public TextMapData(string resourcesDirPath)
|
||||
{
|
||||
LoadManualTextMap(Path.Combine(resourcesDirPath, "ExcelBinOutput", "ManualTextMapConfigData.json"));
|
||||
LoadTextMaps(Path.Combine(resourcesDirPath, "TextMap"));
|
||||
}
|
||||
|
||||
public Dictionary<string, string> ManualTextMap;
|
||||
public Dictionary<string, string> TextMap;
|
||||
public string[] TextMapFilePaths;
|
||||
public string[] TextMapFiles;
|
||||
|
||||
void LoadManualTextMap(string manualTextMapPath)
|
||||
{
|
||||
using (var fs = File.OpenRead(manualTextMapPath))
|
||||
using (var sr = new StreamReader(fs))
|
||||
using (var reader = new JsonTextReader(sr))
|
||||
{
|
||||
ManualTextMap = new Dictionary<string, string>();
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonToken.PropertyName && (string)reader.Value == "TextMapId")
|
||||
{
|
||||
var textMapId = reader.ReadAsString();
|
||||
reader.Read();
|
||||
ManualTextMap.Add(reader.ReadAsString(), textMapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadTextMaps(string textMapDirPath)
|
||||
{
|
||||
TextMapFilePaths = Directory.GetFiles(textMapDirPath, "TextMap*.json");
|
||||
if (TextMapFilePaths.Length == 0)
|
||||
throw new FileNotFoundException("TextMap*.json Not Found");
|
||||
TextMapFiles = TextMapFilePaths.Select(n => Path.GetFileNameWithoutExtension(n)).ToArray();
|
||||
}
|
||||
|
||||
public void LoadTextMap(string textMapPath)
|
||||
{
|
||||
using (var fs = File.OpenRead(textMapPath))
|
||||
using (var sr = new StreamReader(fs))
|
||||
using (var reader = new JsonTextReader(sr))
|
||||
{
|
||||
TextMap = new Dictionary<string, string>();
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
TextMap.Add((string)reader.Value, reader.ReadAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user