Skip to content

Commit

Permalink
Merge pull request #28 from techno-dwarf-works/feature/refactoring
Browse files Browse the repository at this point in the history
Version 0.1.14
  • Loading branch information
uurha committed Oct 7, 2024
1 parent cc2d248 commit 2eb5155
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Runtime/Implementations/ServiceLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public static bool HasRegistered<TService>()
{
return _source.ContainsKey<IService, TService>();
}

public static bool HasRegistered(Type type)
{
return _source.ContainsKey(type);
}

public static bool TryGet<TService>(out TService service)
where TService : IService
Expand Down Expand Up @@ -78,9 +83,9 @@ public static void Unregister<TService>(TService service)
return;
}

if (!HasRegistered<TService>())
var type = service.GetType();
if (!HasRegistered(type))
{
var type = typeof(TService);
var message = $"{nameof(service)} of {nameof(type)}({type}) not registered";
DebugUtility.LogException<InvalidOperationException>(message);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.tdw.better.locators",
"displayName": "Better Locators",
"version": "0.1.13",
"version": "0.1.14",
"unity": "2021.3",
"description": " ",
"dependencies": {
Expand Down

0 comments on commit 2eb5155

Please sign in to comment.