Initial Setup

This commit is contained in:
Savya Bikram Shah
2026-05-26 18:45:12 +05:45
parent 8d599a6396
commit a1ba052ece
48 changed files with 2393 additions and 781 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ef8ad108b40144fd97398adf29630d2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8341b25664e9a41bab38767a0705869f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d739bbb9f94e0441abcf2a1e7c1fca80

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2fd5ef07de078438f89d978864c339ad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 19e142c4ae83144e6a3d391d744786bc

View File

@@ -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
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5250d5b552ecf4265adb8b45c180280b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d54fa8b2c22014496a84c508d897dcdd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 88abeaac3da9d499288f8b5a1830cebc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6cc101d67503b4fc09ebcac4fecbcea9

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 588d1c926497b491c96d2f405876b176
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1b23ca8ea5ee647ddba0712811953811

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e8e28c4942b5410d962cbff40ac302f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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;
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c7a7f36a3426c43b7a1ceeaa853bdc3e

View File

@@ -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
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 68042734671ce4660bff89e042777454
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: