Initial Setup
This commit is contained in:
8
Assets/Darkmatter/Code/App.meta
Normal file
8
Assets/Darkmatter/Code/App.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90f7514f0c81b4f4e93a85a4b4279914
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Darkmatter/Code/App/Darkmatter.App.asmdef
Normal file
20
Assets/Darkmatter/Code/App/Darkmatter.App.asmdef
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Darkmatter.App",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6a0a834eb41764f12ba55c3fb04a40cb",
|
||||
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:c1c03c0e5b2f4412b9f2be1c20d6a9b1",
|
||||
"GUID:80ecb87cae9c44d19824e70ea7229748"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/Darkmatter/Code/App/Darkmatter.App.asmdef.meta
Normal file
7
Assets/Darkmatter/Code/App/Darkmatter.App.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a17b34a5422c458ea460613a87c5a08
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Darkmatter/Code/App/LifetimeScopes.meta
Normal file
8
Assets/Darkmatter/Code/App/LifetimeScopes.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e8bdb018476d4d6e8c40e4241d86c61
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using Darkmatter.Libs.Installers;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
public class RootLifetimeScope : LifetimeScope
|
||||
{
|
||||
[SerializeField] private MonoBehaviour[] serviceModules;
|
||||
|
||||
protected override void Configure(IContainerBuilder builder)
|
||||
{
|
||||
foreach (var module in serviceModules)
|
||||
{
|
||||
if (module is IServiceModule serviceModule)
|
||||
serviceModule.Register(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdbf68f1689a84f7588ae13b63f7a3c9
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c319c820c1ff4a589f48c8057958005
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using Darkmatter.Core.Enums.Services.Camera;
|
||||
|
||||
namespace Darkmatter.Core.Contracts.Services.Camera
|
||||
{
|
||||
public interface ICameraService
|
||||
{
|
||||
void RegisterCamera(UnityEngine.Camera camera, CameraType type);
|
||||
UnityEngine.Camera GetCamera(CameraType type = CameraType.MainCamera);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a548291923054b1eafd9f7421415924
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8c5a5b38d3aa43adae4dd7df1b8184c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Core.Contracts.Services.Inputs
|
||||
{
|
||||
public interface IInputReader
|
||||
{
|
||||
Vector2 TouchPosition { get; }
|
||||
event Action OnTouchStart;
|
||||
event Action OnTouchEnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 882d89c37a9f543c09ebe4b15395da7d
|
||||
8
Assets/Darkmatter/Code/Core/Enums/Services/Camera.meta
Normal file
8
Assets/Darkmatter/Code/Core/Enums/Services/Camera.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce4ae8007dffc4bd5834c1b1df2ca060
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Darkmatter.Core.Enums.Services.Camera
|
||||
{
|
||||
public enum CameraType
|
||||
{
|
||||
MainCamera,
|
||||
UICamera
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99aa5bc838df3456b9f2ab1acb2d52a3
|
||||
8
Assets/Darkmatter/Code/Services/Camera.meta
Normal file
8
Assets/Darkmatter/Code/Services/Camera.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ef8ad108b40144fd97398adf29630d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Darkmatter/Code/Services/Camera/Installers.meta
Normal file
8
Assets/Darkmatter/Code/Services/Camera/Installers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8341b25664e9a41bab38767a0705869f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using Darkmatter.Core.Contracts.Services.Camera;
|
||||
using Darkmatter.Libs.Installers;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using CameraType = Darkmatter.Core.Enums.Services.Camera.CameraType;
|
||||
|
||||
namespace Darkmatter.Services.Camera.Installers
|
||||
{
|
||||
public class CameraServiceModule : MonoBehaviour, IServiceModule
|
||||
{
|
||||
[SerializeField] private UnityEngine.Camera mainCamera;
|
||||
[SerializeField] private UnityEngine.Camera uiCamera;
|
||||
|
||||
public void Register(IContainerBuilder builder)
|
||||
{
|
||||
var cameras = new Dictionary<CameraType, UnityEngine.Camera>
|
||||
{
|
||||
{ CameraType.MainCamera, mainCamera },
|
||||
{ CameraType.UICamera, uiCamera },
|
||||
};
|
||||
builder.Register<ICameraService, CameraService>(Lifetime.Singleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d739bbb9f94e0441abcf2a1e7c1fca80
|
||||
8
Assets/Darkmatter/Code/Services/Camera/Service.meta
Normal file
8
Assets/Darkmatter/Code/Services/Camera/Service.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fd5ef07de078438f89d978864c339ad
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using Darkmatter.Core.Contracts.Services.Camera;
|
||||
using Darkmatter.Core.Enums.Services.Camera;
|
||||
|
||||
namespace Darkmatter.Services.Camera
|
||||
{
|
||||
public class CameraService : ICameraService
|
||||
{
|
||||
private readonly Dictionary<CameraType, UnityEngine.Camera> _cameras = new();
|
||||
|
||||
public void RegisterCamera(UnityEngine.Camera camera, CameraType type) => _cameras.Add(type, camera);
|
||||
|
||||
public CameraService(Dictionary<CameraType, UnityEngine.Camera> cameras)
|
||||
{
|
||||
_cameras = cameras;
|
||||
}
|
||||
|
||||
public UnityEngine.Camera GetCamera(CameraType type = CameraType.MainCamera)
|
||||
{
|
||||
return _cameras.GetValueOrDefault(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19e142c4ae83144e6a3d391d744786bc
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "Services.Camera",
|
||||
"rootNamespace": "Darkmatter.Services.Camera",
|
||||
"references": [
|
||||
"GUID:6a0a834eb41764f12ba55c3fb04a40cb",
|
||||
"GUID:c1c03c0e5b2f4412b9f2be1c20d6a9b1",
|
||||
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5250d5b552ecf4265adb8b45c180280b
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Darkmatter/Code/Services/Inputs.meta
Normal file
8
Assets/Darkmatter/Code/Services/Inputs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d54fa8b2c22014496a84c508d897dcdd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Darkmatter/Code/Services/Inputs/Generated.meta
Normal file
8
Assets/Darkmatter/Code/Services/Inputs/Generated.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88abeaac3da9d499288f8b5a1830cebc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1301
Assets/Darkmatter/Code/Services/Inputs/Generated/GameInputs.cs
Normal file
1301
Assets/Darkmatter/Code/Services/Inputs/Generated/GameInputs.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cc101d67503b4fc09ebcac4fecbcea9
|
||||
8
Assets/Darkmatter/Code/Services/Inputs/Installers.meta
Normal file
8
Assets/Darkmatter/Code/Services/Inputs/Installers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 588d1c926497b491c96d2f405876b176
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using Darkmatter.Core.Contracts.Services.Inputs;
|
||||
using Darkmatter.Libs.Installers;
|
||||
using Darkmatter.Services.Inputs.Readers;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace Darkmatter.Services.Inputs
|
||||
{
|
||||
public class InputServiceModule : MonoBehaviour, IServiceModule
|
||||
{
|
||||
[SerializeField] private InputReaderSO inputReaderSO;
|
||||
|
||||
public void Register(IContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterComponent<IInputReader>(inputReaderSO);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b23ca8ea5ee647ddba0712811953811
|
||||
8
Assets/Darkmatter/Code/Services/Inputs/Readers.meta
Normal file
8
Assets/Darkmatter/Code/Services/Inputs/Readers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e8e28c4942b5410d962cbff40ac302f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Darkmatter.Core.Contracts.Services.Inputs;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Darkmatter.Services.Inputs.Readers
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Darkmatter/Inputs/New Input Reader")]
|
||||
public class InputReaderSO : ScriptableObject, IInputReader, GameInputs.IPlayerActions
|
||||
{
|
||||
public Vector2 TouchPosition { get; private set; }
|
||||
public event Action OnTouchStart;
|
||||
public event Action OnTouchEnd;
|
||||
|
||||
private GameInputs _gameInputActions;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_gameInputActions = new GameInputs();
|
||||
_gameInputActions.Player.SetCallbacks(this);
|
||||
_gameInputActions.Enable();
|
||||
}
|
||||
|
||||
public void OnTouchPosition(InputAction.CallbackContext context)
|
||||
{
|
||||
TouchPosition = context.ReadValue<Vector2>();
|
||||
}
|
||||
|
||||
public void OnTouched(InputAction.CallbackContext context)
|
||||
{
|
||||
if(context.started)
|
||||
OnTouchStart?.Invoke();
|
||||
else if(context.canceled)
|
||||
OnTouchEnd?.Invoke();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (_gameInputActions != null)
|
||||
{
|
||||
_gameInputActions.Disable();
|
||||
_gameInputActions.Dispose();
|
||||
_gameInputActions = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7a7f36a3426c43b7a1ceeaa853bdc3e
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Services.Inputs",
|
||||
"rootNamespace": "Darkmatter.Services.Inputs",
|
||||
"references": [
|
||||
"GUID:6a0a834eb41764f12ba55c3fb04a40cb",
|
||||
"GUID:c1c03c0e5b2f4412b9f2be1c20d6a9b1",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68042734671ce4660bff89e042777454
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user