This commit is contained in:
VDH
2026-03-18 17:35:52 +07:00
parent f28efd552f
commit 4e24e1101c
6 changed files with 138 additions and 21 deletions
@@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace BrewMonster.Scripts.Editor
{
public static class DebugCmdHistoryExporter
{
private const string OutputAssetPath = "Assets/PerfectWorld/Resources/DebugCmdHistory.json";
[MenuItem("Tools/DebugCmd/Export History (User -> Resources)")]
public static void ExportUserHistoryToResources()
{
var entries = DebugCmdHistoryStore.Load();
var json = WrapToJson(entries);
Directory.CreateDirectory(Path.GetDirectoryName(OutputAssetPath));
File.WriteAllText(OutputAssetPath, json);
AssetDatabase.ImportAsset(OutputAssetPath);
Debug.Log($"[DebugCmdHistoryExporter] Exported {entries.Count} entries to {OutputAssetPath}");
}
private static string WrapToJson(List<DebugCmdHistoryStore.Entry> entries)
{
// Mirror EntryListWrapper shape: { "items": [...] }
var wrapper = new Wrapper { items = entries ?? new List<DebugCmdHistoryStore.Entry>() };
return JsonUtility.ToJson(wrapper, true);
}
[System.Serializable]
private class Wrapper
{
public List<DebugCmdHistoryStore.Entry> items;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7e0f54d86164c2e4c86036e4aadacd04