refactor
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace RebootKit.Engine.Foundation {
|
||||
public interface IController : IDisposable {
|
||||
@@ -25,6 +26,16 @@ namespace RebootKit.Engine.Foundation {
|
||||
}
|
||||
}
|
||||
|
||||
public T Get<T>() where T : class, IController {
|
||||
foreach (TController controller in _controllers) {
|
||||
if (controller is T res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool TryFind<T>(out T outController) where T : IController {
|
||||
foreach (TController controller in _controllers) {
|
||||
if (controller is T res) {
|
||||
|
||||
Reference in New Issue
Block a user