解决了node的问题(脚本编写错误并非代码错误)
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
|
||||
using Convention;
|
||||
using Convention.WindowsUI.Variant;
|
||||
using Demo.Game;
|
||||
using Sirenix.OdinInspector;
|
||||
using Unity.Profiling;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -296,22 +297,17 @@ namespace Demo
|
||||
{
|
||||
// 上下文系统
|
||||
|
||||
public readonly Dictionary<string, float> ScriptContextSpace = new();
|
||||
public Dictionary<string, float> GetCompleteScriptContext()
|
||||
[Content] public Dictionary<string, float> ScriptContextSpace = new();
|
||||
|
||||
public bool GetCompleteScriptContext(string key, out float value)
|
||||
{
|
||||
if (Parent != null)
|
||||
if (ScriptContextSpace.TryGetValue(key, out value) == false)
|
||||
{
|
||||
Dictionary<string, float> context = Parent != null ? Parent.GetCompleteScriptContext() : new();
|
||||
foreach (var (name, value) in ScriptContextSpace)
|
||||
{
|
||||
context[name] = value;
|
||||
}
|
||||
return context;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new(ScriptContextSpace);
|
||||
if (Parent == null)
|
||||
return false;
|
||||
return Parent.GetCompleteScriptContext(key, out value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -353,7 +349,7 @@ namespace Demo
|
||||
value = value.Trim();
|
||||
if (TimePoints.TryGetValue(value, out var result))
|
||||
return result;
|
||||
if (GetCompleteScriptContext().TryGetValue(value, out result))
|
||||
if (GetCompleteScriptContext(value, out result))
|
||||
return result;
|
||||
if(value.EndsWith(']'))
|
||||
{
|
||||
@@ -503,7 +499,7 @@ namespace Demo
|
||||
/// <para>使用<see cref="ScriptableCallAttribute"/>标记可编辑脚本所能够调用的函数,并附加注释</para>
|
||||
/// <para>使用<see cref="DefaultScriptAttribute"/>标记派生类,并附加默认模板</para>
|
||||
/// </summary>
|
||||
public partial class ScriptableObject : MonoBehaviour, IHierarchyItemClickEventListener
|
||||
public partial class ScriptableObject : SerializedMonoBehaviour, IHierarchyItemClickEventListener
|
||||
{
|
||||
|
||||
public static Dictionary<string, Type> FastScriptableObjectTypen = new();
|
||||
@@ -569,11 +565,13 @@ namespace Demo
|
||||
MyHierarchyItem.GetHierarchyItem().title = this.ScriptName + $"<{scriptType}>";
|
||||
MyHierarchyItem.GetHierarchyItem().target = this;
|
||||
MyHierarchyItem.GetHierarchyItem().ButtonGameObject.GetComponent<Editor.UI.RightClick>().ScriptObjectMenu = OnHierarchyItemRightClick;
|
||||
var parentHierarchyItem = MyHierarchyItem.GetParent();
|
||||
if (parentHierarchyItem != null)
|
||||
parentHierarchyItem.GetPropertyListItem().RefreshChilds();
|
||||
//var parentHierarchyItem = MyHierarchyItem.GetParent();
|
||||
//if (parentHierarchyItem != null)
|
||||
// parentHierarchyItem.GetPropertyListItem().RefreshChilds();
|
||||
}
|
||||
|
||||
public const string RootObjectQuickPath = "project/";
|
||||
|
||||
public ScriptableObject FindWithPath(string path, bool isMustExist = true)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
@@ -586,9 +584,10 @@ namespace Demo
|
||||
|
||||
// GetParent
|
||||
ScriptableObject result = Parent;
|
||||
if (path[0] == '/' || path[0]=='\\')
|
||||
if (path.Replace('\\','/').ToLower().StartsWith(RootObjectQuickPath))
|
||||
{
|
||||
result = GetRoot();
|
||||
path = path[RootObjectQuickPath.Length..];
|
||||
}
|
||||
|
||||
if (Parent == null)
|
||||
@@ -654,8 +653,8 @@ namespace Demo
|
||||
// 生成对象
|
||||
var child = creater();
|
||||
// 路径预处理
|
||||
if (path.Replace('\\', '/').ToLower().StartsWith("project/"))
|
||||
path = $"{new ToolFile(GetRoot().SourcePath) | path[5..]}";
|
||||
if (path.Replace('\\', '/').ToLower().StartsWith(RootObjectQuickPath))
|
||||
path = $"{new ToolFile(GetRoot().SourcePath) | path[RootObjectQuickPath.Length..]}";
|
||||
// 获取文件
|
||||
ToolFile file;
|
||||
if (File.Exists(path))
|
||||
|
||||
Reference in New Issue
Block a user