Removed Unnecessary stuff
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8c5a5b38d3aa43adae4dd7df1b8184c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Core.Contracts.Services.Inputs
|
||||
{
|
||||
public interface IInputReader
|
||||
{
|
||||
Vector2 TouchPosition { get; }
|
||||
event Action OnTouchStart;
|
||||
event Action OnTouchEnd;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 882d89c37a9f543c09ebe4b15395da7d
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f555e5ed9c45e44cd804a598d08efc6c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f26c384b6ed9f482b8b3f325ba5e06f5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using Darkmatter.Core.Contracts.Features.Paper;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Features.PaperRig
|
||||
{
|
||||
[Serializable]
|
||||
public class PaperRig : IPaperRig
|
||||
{
|
||||
[SerializeField] private Camera artCamera;
|
||||
[SerializeField] private RectTransform displayRect;
|
||||
public Camera ArtCamera => artCamera;
|
||||
public RectTransform DisplayRect => displayRect;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd7db17694325451c8441d824b221199
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "Features.PaperRig",
|
||||
"rootNamespace": "Darkmatter.Features.PaperRig",
|
||||
"references": [
|
||||
"GUID:6a0a834eb41764f12ba55c3fb04a40cb",
|
||||
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc",
|
||||
"GUID:c1c03c0e5b2f4412b9f2be1c20d6a9b1"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c54b3e6267ecb41b68cc06079d4b39f2
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0156c96d959344bfbf0c1212ea68d473
|
||||
timeCreated: 1779859615
|
||||
@@ -1,45 +0,0 @@
|
||||
using Darkmatter.Core.Contracts.Features.Paper;
|
||||
using Darkmatter.Core.Contracts.Services.Camera;
|
||||
using UnityEngine;
|
||||
using CameraType = Darkmatter.Core.Enums.Services.Camera.CameraType;
|
||||
|
||||
namespace Darkmatter.Features.PaperRig.Darkmatter.Code.Features.PaperRig.Input
|
||||
{
|
||||
public class ArtInputBridge : IArtInputBridge
|
||||
{
|
||||
private readonly IPaperRig _paperRig;
|
||||
private ICameraService _cameraService;
|
||||
|
||||
public ArtInputBridge(IPaperRig paperRig, ICameraService cameraService)
|
||||
{
|
||||
_paperRig = paperRig;
|
||||
_cameraService = cameraService;
|
||||
}
|
||||
|
||||
public bool TryScreenToArtWorld(Vector2 screenPos, out Vector2 artWorldPos)
|
||||
{
|
||||
var rectT = _paperRig.DisplayRect;
|
||||
var uiCamera = _cameraService.GetCamera(CameraType.UICamera);
|
||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
rectT, screenPos, uiCamera, out var local))
|
||||
{
|
||||
artWorldPos = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
var rect = rectT.rect;
|
||||
var uv = new Vector2(
|
||||
(local.x - rect.xMin) / rect.width,
|
||||
(local.y - rect.yMin) / rect.height);
|
||||
|
||||
if (uv.x < 0 || uv.x > 1 || uv.y < 0 || uv.y > 1)
|
||||
{
|
||||
artWorldPos = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
artWorldPos = _paperRig.ArtCamera.ViewportToWorldPoint(uv);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0337c48e57934443887873de8e382d4e
|
||||
timeCreated: 1779859625
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecba85ae080a44ef9b1a1d55f3f86659
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,20 +0,0 @@
|
||||
using Darkmatter.Core.Contracts.Features.Paper;
|
||||
using Darkmatter.Features.PaperRig.Darkmatter.Code.Features.PaperRig.Input;
|
||||
using Darkmatter.Libs.Installers;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace Darkmatter.Features.PaperRig
|
||||
{
|
||||
public class PaperRigServiceModule : MonoBehaviour, IServiceModule
|
||||
{
|
||||
[SerializeField] private PaperRig paperRig;
|
||||
|
||||
public void Register(IContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterComponent<IPaperRig>(paperRig);
|
||||
builder.Register<IArtInputBridge, ArtInputBridge>(Lifetime.Singleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef7eaa67fc66d48c88c8ec12d27f9b14
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 588d1c926497b491c96d2f405876b176
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b23ca8ea5ee647ddba0712811953811
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e8e28c4942b5410d962cbff40ac302f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,47 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7a7f36a3426c43b7a1ceeaa853bdc3e
|
||||
Reference in New Issue
Block a user