Skip to content

Commit 062ca7c

Browse files
authored
fix mext
1 parent a77b648 commit 062ca7c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

EIV_Modules/Extensions/ModuleExtensions.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ public static class ModuleExtensions
66
{
77
public static T GetModule<T>(this object obj) where T : IModule
88
{
9-
return (T?)ModuleSub?.Invoke(obj, typeof(T));
9+
return (T?)ModuleSub.GetFirstModule?.Invoke(obj, typeof(T));
1010
}
1111

12-
public static bool TryGetModuleNode<T>(this object obj, out T out_t) where T : IModule
12+
public static List<T> GetModules<T>(this object obj) where T : IModule
13+
{
14+
return (List<T>)ModuleSub.GetModuleList?.Invoke(obj, typeof(T));
15+
}
16+
17+
public static bool TryGetModule<T>(this object obj, out T out_t) where T : IModule
1318
{
1419
out_t = default;
15-
out_t = (T)node.GetChildren().FirstOrDefault(x => x is T);
20+
out_t = (T?)ModuleSub.GetFirstModule?.Invoke(obj, typeof(T));
1621
return out_t != null;
1722
}
1823

19-
public static void AddModuleNode<T>(this object obj, T module) where T : IModule
24+
public static void AddModule<T>(this object obj, T module) where T : IModule
2025
{
21-
module.SetMultiplayerAuthority(node.GetMultiplayerAuthority());
22-
node.AddChild(module);
26+
ModuleSub.AddModule?.Invoke(obj, module);
2327
}
2428

25-
public static void RemoveModuleNode<T>(this object obj) where T : IModule
29+
public static void RemoveModule<T>(this object obj) where T : IModule
2630
{
27-
var NodeList = node.GetChildren().Where(x=>x is T).ToList();
28-
foreach(var Node in NodeList)
29-
{
30-
node.RemoveChild(Node);
31-
}
31+
ModuleSub.RemoveModule?.Invoke(obj, typeof(T));
3232
}
3333
}

0 commit comments

Comments
 (0)