Skip to content

Commit

Permalink
Merge pull request #11 from techno-dwarf-works/feature/refactoring
Browse files Browse the repository at this point in the history
Version 0.0.8
  • Loading branch information
OpOpYaDev authored Apr 21, 2024
2 parents 768424d + c152a59 commit 614f503
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
7 changes: 3 additions & 4 deletions Assets/BetterLocators/Runtime/BetterLocators.Runtime.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"name": "BetterLocators.Runtime",
"rootNamespace": "Better.Locators.Runtime",
"references": [
"GUID:01df13aca8d01e24a911bcc3e8277031",
"GUID:8bd4b41f8da90144d9006c4d926c9679",
"GUID:35101f455c979e94c9a0a4793484b7fd",
"GUID:1c5574afb40e5fe4ca9e9c156009297b"
"GUID:1c5574afb40e5fe4ca9e9c156009297b",
"GUID:8bd4b41f8da90144d9006c4d926c9679"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -17,7 +16,7 @@
"versionDefines": [
{
"name": "com.tdw.better.services",
"expression": "0.1.0",
"expression": "0.0.4",
"define": "BETTER_SERVICES"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#if BETTER_SERVICES
using System;
using Better.Services.Runtime;
using UnityEngine;

namespace Better.Locators.Runtime.Installers
{
[Serializable]
public class MonoServicesInstaller : ServicesInstaller<MonoService>
{
[SerializeField] private MonoService[] _services;

protected override MonoService[] Services => _services;
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#if BETTER_SERVICES
using System;
using Better.Attributes.Runtime.Select;
using Better.Services.Runtime;
using UnityEngine;

namespace Better.Locators.Runtime.Installers
{
[Serializable]
public class PocoServicesInstaller : ServicesInstaller<PocoService>
{
[Select]
[SerializeReference] private PocoService[] _services;

protected override PocoService[] Services => _services;
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Better.Attributes.Runtime.Select;
using Better.Commons.Runtime.Extensions;
using Better.Services.Runtime.Interfaces;
using UnityEngine;
Expand All @@ -13,31 +14,31 @@ namespace Better.Locators.Runtime.Installers
public abstract class ServicesInstaller<TDerivedService> : Installer
where TDerivedService : class, IService
{
[SerializeReference] private TDerivedService[] _services;
protected abstract TDerivedService[] Services { get; }

public override async Task InstallBindingsAsync(CancellationToken cancellationToken)
{
await _services.Select(x => x.InitializeAsync(cancellationToken)).WhenAll();
await Services.Select(x => x.InitializeAsync(cancellationToken)).WhenAll();

if (cancellationToken.IsCancellationRequested)
{
Debug.LogError("Operation was cancelled");
return;
}

for (int i = 0; i < _services.Length; i++)
for (int i = 0; i < Services.Length; i++)
{
ServiceLocator.Register(_services[i]);
ServiceLocator.Register(Services[i]);
}

await _services.Select(x => x.PostInitializeAsync(cancellationToken)).WhenAll();
await Services.Select(x => x.PostInitializeAsync(cancellationToken)).WhenAll();
}

public override void UninstallBindings()
{
for (int i = 0; i < _services.Length; i++)
for (int i = 0; i < Services.Length; i++)
{
ServiceLocator.Unregister<IService>(_services[i]);
ServiceLocator.Unregister<IService>(Services[i]);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions Assets/BetterLocators/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "com.tdw.better.locators",
"displayName": "Better Locators",
"version": "0.1.0",
"name": "com.tdw.better.locator",
"displayName": "Better Locator",
"version": "0.0.8",
"unity": "2021.3",
"description": " ",
"dependencies": {
"com.tdw.better.internal.core": "0.0.2",
"com.tdw.better.commons": "0.0.2",
"com.uurha.betterattributes": "3.1.0"
"com.tdw.better.commons": "0.0.4",
"com.uurha.betterattributes": "3.1.1"
},
"author": {
"name": "Better Plugins",
"url": "https://github.com/techno-dwarf-works"
},
"changelogUrl": "https://github.com/techno-dwarf-works/better-locators",
"documentationUrl": "https://github.com/techno-dwarf-works/better-locators/tree/main#readme",
"changelogUrl": "https://github.com/techno-dwarf-works/better-locator",
"documentationUrl": "https://github.com/techno-dwarf-works/better-locator/tree/main#readme",
"license": "MIT",
"licensesUrl": "https://github.com/techno-dwarf-works/better-locators/blob/main/LICENSE",
"licensesUrl": "https://github.com/techno-dwarf-works/better-locator/blob/main/LICENSE",
"keywords": [
"locators",
"reference management",
Expand Down
3 changes: 1 addition & 2 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"dependencies": {
"com.tdw.better.internal.core": "0.0.2",
"com.tdw.better.services": "0.1.0",
"com.unity.collab-proxy": "2.0.1",
"com.unity.feature.development": "1.0.1",
"com.unity.ide.rider": "3.0.18",
Expand All @@ -12,7 +11,7 @@
"com.unity.timeline": "1.6.4",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.8.0",
"com.uurha.betterattributes": "3.1.0",
"com.uurha.betterattributes": "3.1.1",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
15 changes: 3 additions & 12 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"com.tdw.better.commons": {
"version": "0.0.2",
"version": "0.0.4",
"depth": 1,
"source": "registry",
"dependencies": {
Expand All @@ -16,15 +16,6 @@
"dependencies": {},
"url": "https://package.openupm.com"
},
"com.tdw.better.services": {
"version": "0.1.0",
"depth": 0,
"source": "registry",
"dependencies": {
"com.tdw.better.internal.core": "0.0.2"
},
"url": "https://package.openupm.com"
},
"com.unity.collab-proxy": {
"version": "2.0.1",
"depth": 0,
Expand Down Expand Up @@ -161,11 +152,11 @@
"url": "https://packages.unity.com"
},
"com.uurha.betterattributes": {
"version": "3.1.0",
"version": "3.1.1",
"depth": 0,
"source": "registry",
"dependencies": {
"com.tdw.better.commons": "0.0.2",
"com.tdw.better.commons": "0.0.4",
"com.tdw.better.internal.core": "0.0.2"
},
"url": "https://package.openupm.com"
Expand Down

0 comments on commit 614f503

Please sign in to comment.