NodeScript+ 导入了个 UI Extend
Signed-off-by: TRADER_FOER <lhf190@outlook.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Ichni.NodeScript;
|
||||
using Ichni.RhythmGame;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse;
|
||||
@@ -383,7 +384,7 @@ namespace Ichni.Editor
|
||||
if (hold.track.trackPathSubmodule.pathNodeList.Count > 2)
|
||||
{
|
||||
LogWindow.Log("the Hold may not be split currently", Color.yellow);
|
||||
return;
|
||||
|
||||
}
|
||||
hold.UpdateNoteInMovableTrack(CoreServices.TimeProvider.SongTime);
|
||||
Track NewTrack = Track.GenerateElement(hold.elementName + "_SplitTrack", Guid.NewGuid(), new List<string>(), true, parentTrack);
|
||||
@@ -425,7 +426,7 @@ namespace Ichni.Editor
|
||||
if (track.trackPathSubmodule.pathNodeList.Count > 2)
|
||||
{
|
||||
LogWindow.Log("the Hold may not be split currently", Color.yellow);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
foreach (var hold in holds)
|
||||
@@ -1135,6 +1136,78 @@ namespace Ichni.Editor
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region NodeScript Console Commands (节点脚本控制台命令)
|
||||
|
||||
/// <summary>
|
||||
/// 新建 NodeScript 编辑器,从当前选中 GameElement 开始 Init
|
||||
/// </summary>
|
||||
public static void newNode()
|
||||
{
|
||||
if (NodeManager.Instance == null)
|
||||
{
|
||||
var prefab = EditorManager.instance.basePrefabs.NodeEditor;
|
||||
if (prefab == null)
|
||||
{
|
||||
LogWindow.Log("NodeEditor prefab is null, check BasePrefabsCollection!", Color.red);
|
||||
return;
|
||||
}
|
||||
var go = UnityEngine.Object.Instantiate(prefab,
|
||||
EditorManager.instance.uiManager.WindowsCanvas.gameObject.transform);
|
||||
var mgr = go.GetComponent<NodeManager>();
|
||||
if (mgr != null && EditorManager.instance.operationManager.currentSelectedElements.Count > 0)
|
||||
mgr.Init(EditorManager.instance.operationManager.currentSelectedElements[0]);
|
||||
LogWindow.Log("NodeScript Editor created.", Color.green);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Object.Destroy(NodeManager.Instance.gameObject);
|
||||
LogWindow.Log("NodeScript Editor destroyed.", Color.yellow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 另存为指定文件名到 StreamingAssets/NodeScript/{name}.json
|
||||
/// </summary>
|
||||
public static void saveNode(string name)
|
||||
{
|
||||
if (NodeManager.Instance == null)
|
||||
{
|
||||
LogWindow.Log("No NodeScript Editor active. Use newNode first.", Color.red);
|
||||
return;
|
||||
}
|
||||
NodeManager.Instance.SaveToFile(name);
|
||||
LogWindow.Log($"NodeScript graph saved as {name}.", Color.green);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从 StreamingAssets/NodeScript/{name}.json 读取 NodeScript 图
|
||||
/// </summary>
|
||||
public static void loadNode(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
LogWindow.Log("Usage: loadNode <name> — loads StreamingAssets/NodeScript/<name>.json", Color.yellow);
|
||||
return;
|
||||
}
|
||||
|
||||
// 确保 NodeManager 存在
|
||||
if (NodeManager.Instance == null)
|
||||
{
|
||||
var prefab = EditorManager.instance.basePrefabs.NodeEditor;
|
||||
if (prefab == null)
|
||||
{
|
||||
LogWindow.Log("NodeEditor prefab is null, check BasePrefabsCollection!", Color.red);
|
||||
return;
|
||||
}
|
||||
UnityEngine.Object.Instantiate(prefab,
|
||||
EditorManager.instance.uiManager.WindowsCanvas.gameObject.transform);
|
||||
}
|
||||
|
||||
NodeManager.Instance.LoadFromFile(name);
|
||||
LogWindow.Log($"NodeScript graph loaded from {name}.", Color.green);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
Reference in New Issue
Block a user