com.puzzlescapegames.services 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Runtime/Registrator.cs +11 -4
- package/package.json +1 -1
package/Runtime/Registrator.cs
CHANGED
|
@@ -62,15 +62,22 @@ namespace PuzzlescapeGames.Services
|
|
|
62
62
|
|
|
63
63
|
public R GetAs< R >()
|
|
64
64
|
where R : class, T =>
|
|
65
|
-
Get<R>() as R;
|
|
66
|
-
|
|
65
|
+
Get< R >() as R;
|
|
66
|
+
|
|
67
67
|
public T Get< R >()
|
|
68
68
|
where R : T
|
|
69
69
|
{
|
|
70
|
-
if ( ContainsType< R >() ) return _registers.
|
|
70
|
+
if ( ContainsType< R >() ) return _registers.FirstOrDefault( x => x is R );
|
|
71
71
|
|
|
72
72
|
throw new Exception( $"REGISTRATOR DOESN'T CONTAINS {typeof(R)} ERROR" );
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
public T Get( Type registr )
|
|
76
|
+
{
|
|
77
|
+
if ( ContainsType( registr ) ) return _registers.FirstOrDefault( x => x.GetType() == registr );
|
|
78
|
+
|
|
79
|
+
throw new Exception( $"REGISTRATOR DOESN'T CONTAINS {registr} ERROR" );
|
|
80
|
+
}
|
|
74
81
|
|
|
75
82
|
public bool ContainsType< R >()
|
|
76
83
|
where R : T =>
|
|
@@ -79,7 +86,7 @@ namespace PuzzlescapeGames.Services
|
|
|
79
86
|
public bool ContainsType< R >( R registr )
|
|
80
87
|
where R : T
|
|
81
88
|
{
|
|
82
|
-
return
|
|
89
|
+
return ContainsType( registr.GetType() );
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
public bool ContainsType( Type registr )
|