BS 0.2.0 UI控件同步 / EP Unity.1 Diagram版本下的附属增强提案

This commit is contained in:
2025-07-23 15:22:18 +08:00
parent d0e5420f95
commit 86842492ea
30 changed files with 1471 additions and 96 deletions

View File

@@ -264,12 +264,8 @@ namespace Convention
}
}
public static Registering Register(Type slot, object target, Action completer, params Type[] dependences)
public static Registering RegisterWithDuplicateAllow(Type slot, object target, Action completer, params Type[] dependences)
{
if (RegisterHistory.Add(slot) == false)
{
throw new InvalidOperationException("Illegal duplicate registrations");
}
Completer[slot] = completer;
UncompleteTargets[slot] = target;
Dependences[slot] = new DependenceModel(from dependence in dependences where dependence != slot select new TypeQuery(dependence));
@@ -278,9 +274,18 @@ namespace Convention
return new Registering(slot);
}
public static Registering Register(Type slot, object target, Action completer, params Type[] dependences)
{
if (RegisterHistory.Add(slot) == false)
{
throw new InvalidOperationException("Illegal duplicate registrations");
}
return RegisterWithDuplicateAllow(slot, target, completer, dependences);
}
public static Registering Register<T>(T target, Action completer, params Type[] dependences) => Register(typeof(T), target!, completer, dependences);
public static bool Contains(Type type) => Childs.ContainsKey(type);
public static bool Contains(Type type) => Childs.TryGetValue(type, out var value) && value != null;
public static bool Contains<T>() => Contains(typeof(T));