Replicated the weapon flying tick setup using resources
This commit is contained in:
@@ -13,27 +13,22 @@ public partial class CueHandlerInspectorPlugin : EditorInspectorPlugin
|
||||
public override bool _CanHandle(GodotObject @object)
|
||||
{
|
||||
// Find out if its an implementation of CueHandler without having to add [Tool] attribute to them.
|
||||
try
|
||||
if (@object?.GetScript().As<CSharpScript>() is CSharpScript script)
|
||||
{
|
||||
if (@object.GetScript().As<CSharpScript>() is not { }) return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
StringName className = script.GetGlobalName();
|
||||
|
||||
Type baseType = typeof(ForgeCueHandler);
|
||||
System.Reflection.Assembly assembly = baseType.Assembly;
|
||||
|
||||
Type? implementationType =
|
||||
Array.Find(assembly.GetTypes(), x =>
|
||||
x.Name == className &&
|
||||
baseType.IsAssignableFrom(x));
|
||||
|
||||
return implementationType is not null;
|
||||
}
|
||||
|
||||
var script = @object.GetScript().As<CSharpScript>();
|
||||
StringName className = script.GetGlobalName();
|
||||
|
||||
Type baseType = typeof(ForgeCueHandler);
|
||||
System.Reflection.Assembly assembly = baseType.Assembly;
|
||||
|
||||
Type? implementationType =
|
||||
Array.Find(assembly.GetTypes(), x =>
|
||||
x.Name == className &&
|
||||
baseType.IsAssignableFrom(x));
|
||||
|
||||
return implementationType is not null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool _ParseProperty(
|
||||
|
||||
@@ -47,7 +47,7 @@ public partial class CueKeyEditorProperty : EditorProperty
|
||||
|
||||
AddChild(popup);
|
||||
|
||||
ForgeData pluginData = ResourceLoader.Load<ForgeData>("uid://8j4xg16o3qnl");
|
||||
ForgeData pluginData = ResourceLoader.Load<ForgeData>(ForgeData.ForgeDataResourcePath);
|
||||
var tagsManager = new TagsManager([.. pluginData.RegisteredTags]);
|
||||
TreeItem root = tree.CreateItem();
|
||||
BuildTreeRecursively(tree, root, tagsManager.RootNode);
|
||||
|
||||
Reference in New Issue
Block a user