cheat
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user