diff --git a/Assets/Darkmatter/Code/App/LifetimeScopes/BaseLifetimeScope.cs b/Assets/Darkmatter/Code/App/LifetimeScopes/BaseLifetimeScope.cs new file mode 100644 index 0000000..7ba7e06 --- /dev/null +++ b/Assets/Darkmatter/Code/App/LifetimeScopes/BaseLifetimeScope.cs @@ -0,0 +1,18 @@ +using Darkmatter.Libs.Installers; +using UnityEngine; +using VContainer; +using VContainer.Unity; + +public abstract class BaseLifetimeScope : LifetimeScope +{ + [SerializeField] private MonoBehaviour[] serviceModules; + + protected override void Configure(IContainerBuilder builder) + { + foreach (var module in serviceModules) + { + if (module is IServiceModule serviceModule) + serviceModule.Register(builder); + } + } +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/App/LifetimeScopes/BaseLifetimeScope.cs.meta b/Assets/Darkmatter/Code/App/LifetimeScopes/BaseLifetimeScope.cs.meta new file mode 100644 index 0000000..b9a5d39 --- /dev/null +++ b/Assets/Darkmatter/Code/App/LifetimeScopes/BaseLifetimeScope.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 14a5b12dfbd0540478508a72b0bcc3cc \ No newline at end of file diff --git a/Assets/Darkmatter/Code/App/LifetimeScopes/GameLifetimeScope.cs b/Assets/Darkmatter/Code/App/LifetimeScopes/GameLifetimeScope.cs new file mode 100644 index 0000000..71b1333 --- /dev/null +++ b/Assets/Darkmatter/Code/App/LifetimeScopes/GameLifetimeScope.cs @@ -0,0 +1,8 @@ +using VContainer; + +public class GameLifetimeScope : BaseLifetimeScope +{ + protected override void Configure(IContainerBuilder builder) + { + } +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/App/LifetimeScopes/GameLifetimeScope.cs.meta b/Assets/Darkmatter/Code/App/LifetimeScopes/GameLifetimeScope.cs.meta new file mode 100644 index 0000000..5868652 --- /dev/null +++ b/Assets/Darkmatter/Code/App/LifetimeScopes/GameLifetimeScope.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4ca410c053f074e1cba2f7041f500d34 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/App/LifetimeScopes/RootLifetimeScope.cs b/Assets/Darkmatter/Code/App/LifetimeScopes/RootLifetimeScope.cs index 9273edf..2e23bbb 100644 --- a/Assets/Darkmatter/Code/App/LifetimeScopes/RootLifetimeScope.cs +++ b/Assets/Darkmatter/Code/App/LifetimeScopes/RootLifetimeScope.cs @@ -1,18 +1,9 @@ -using Darkmatter.Libs.Installers; -using UnityEngine; using VContainer; using VContainer.Unity; -public class RootLifetimeScope : LifetimeScope +public class RootLifetimeScope : BaseLifetimeScope { - [SerializeField] private MonoBehaviour[] serviceModules; - protected override void Configure(IContainerBuilder builder) { - foreach (var module in serviceModules) - { - if (module is IServiceModule serviceModule) - serviceModule.Register(builder); - } } } \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Paper.meta b/Assets/Darkmatter/Code/Core/Contracts/Paper.meta new file mode 100644 index 0000000..aa4149b --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Paper.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f91f821f605f4d1ba438f41e4232df0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Core/Contracts/Paper/IArtInputBridge.cs b/Assets/Darkmatter/Code/Core/Contracts/Paper/IArtInputBridge.cs new file mode 100644 index 0000000..7d4f425 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Paper/IArtInputBridge.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace Darkmatter.Core.Contracts.Paper +{ + public interface IArtInputBridge + { + bool TryScreenToArtWorld(Vector2 screenPos, out Vector2 artWorldPos); + } +} diff --git a/Assets/Darkmatter/Code/Core/Contracts/Paper/IArtInputBridge.cs.meta b/Assets/Darkmatter/Code/Core/Contracts/Paper/IArtInputBridge.cs.meta new file mode 100644 index 0000000..94e358b --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Paper/IArtInputBridge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 39f0c8bfbf53c4b299d6beb0a01fd32b \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Paper/IPaperRig.cs b/Assets/Darkmatter/Code/Core/Contracts/Paper/IPaperRig.cs new file mode 100644 index 0000000..498bfc5 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Paper/IPaperRig.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace Darkmatter.Core.Contracts.Paper +{ + public interface IPaperRig + { + Camera ArtCamera { get; } + RenderTexture Surface { get; } + Vector2Int SurfaceSize { get; } + float DesignHalfSize { get; } + Transform PaperRoot { get; } + } +} diff --git a/Assets/Darkmatter/Code/Core/Contracts/Paper/IPaperRig.cs.meta b/Assets/Darkmatter/Code/Core/Contracts/Paper/IPaperRig.cs.meta new file mode 100644 index 0000000..671bac9 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Paper/IPaperRig.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a51496fa9463b41f7baeb4ff40055835 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Services/Capture.meta b/Assets/Darkmatter/Code/Core/Contracts/Services/Capture.meta new file mode 100644 index 0000000..15db40d --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Services/Capture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf985c17631794cc8ba5e0b581de7b4e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Core/Contracts/Services/Capture/ICaptureService.cs b/Assets/Darkmatter/Code/Core/Contracts/Services/Capture/ICaptureService.cs new file mode 100644 index 0000000..009ea65 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Services/Capture/ICaptureService.cs @@ -0,0 +1,12 @@ +using System.Threading; +using Cysharp.Threading.Tasks; + +namespace Darkmatter.Core.Contracts.Services.Capture +{ + public interface ICaptureService + { + UniTask CapturePngAsync(CancellationToken cancellationToken = default); + + UniTask CaptureThumbnailPngAsync(int size, CancellationToken cancellationToken = default); + } +} diff --git a/Assets/Darkmatter/Code/Core/Contracts/Services/Capture/ICaptureService.cs.meta b/Assets/Darkmatter/Code/Core/Contracts/Services/Capture/ICaptureService.cs.meta new file mode 100644 index 0000000..9d249d7 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Services/Capture/ICaptureService.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: bffc27fabc18d4014bee348129b73cf7 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Enums/Services/Camera/CameraType.cs b/Assets/Darkmatter/Code/Core/Enums/Services/Camera/CameraType.cs index 172ddc7..b7feb3d 100644 --- a/Assets/Darkmatter/Code/Core/Enums/Services/Camera/CameraType.cs +++ b/Assets/Darkmatter/Code/Core/Enums/Services/Camera/CameraType.cs @@ -3,6 +3,7 @@ namespace Darkmatter.Core.Enums.Services.Camera public enum CameraType { MainCamera, - UICamera + UICamera, + ArtCamera } } diff --git a/Assets/Darkmatter/Code/Services/Camera/Installers/CameraServiceModule.cs b/Assets/Darkmatter/Code/Services/Camera/Installers/CameraServiceModule.cs index 4992412..3500248 100644 --- a/Assets/Darkmatter/Code/Services/Camera/Installers/CameraServiceModule.cs +++ b/Assets/Darkmatter/Code/Services/Camera/Installers/CameraServiceModule.cs @@ -17,9 +17,9 @@ namespace Darkmatter.Services.Camera.Installers var cameras = new Dictionary { { CameraType.MainCamera, mainCamera }, - { CameraType.UICamera, uiCamera }, + { CameraType.UICamera, uiCamera } }; - builder.Register(Lifetime.Singleton); + builder.Register(Lifetime.Singleton).WithParameter(cameras); } } } \ No newline at end of file diff --git a/Assets/Darkmatter/Content.meta b/Assets/Darkmatter/Content.meta new file mode 100644 index 0000000..bb0b33d --- /dev/null +++ b/Assets/Darkmatter/Content.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50b7af2b4f0f74bcd9a0257839d6f0ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Content/Gameplay.meta b/Assets/Darkmatter/Content/Gameplay.meta new file mode 100644 index 0000000..2caf8fa --- /dev/null +++ b/Assets/Darkmatter/Content/Gameplay.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 227c245961aab4de9b09eae4fe4a619c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Content/Gameplay/PaperRig.meta b/Assets/Darkmatter/Content/Gameplay/PaperRig.meta new file mode 100644 index 0000000..a3d5b72 --- /dev/null +++ b/Assets/Darkmatter/Content/Gameplay/PaperRig.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 68afb1ec24cda44d6a6a57436462a65c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Content/Gameplay/PaperRig/ArtCameraTexture.renderTexture b/Assets/Darkmatter/Content/Gameplay/PaperRig/ArtCameraTexture.renderTexture new file mode 100644 index 0000000..92e94a5 --- /dev/null +++ b/Assets/Darkmatter/Content/Gameplay/PaperRig/ArtCameraTexture.renderTexture @@ -0,0 +1,39 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ArtCameraTexture + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_IsAlphaChannelOptional: 0 + serializedVersion: 6 + m_Width: 1920 + m_Height: 1080 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthStencilFormat: 94 + m_ColorFormat: 8 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_UseDynamicScaleExplicit: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_EnableRandomWrite: 0 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 + m_ShadowSamplingMode: 2 diff --git a/Assets/Darkmatter/Content/Gameplay/PaperRig/ArtCameraTexture.renderTexture.meta b/Assets/Darkmatter/Content/Gameplay/PaperRig/ArtCameraTexture.renderTexture.meta new file mode 100644 index 0000000..3e0a919 --- /dev/null +++ b/Assets/Darkmatter/Content/Gameplay/PaperRig/ArtCameraTexture.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00ba58b6f31d046c1849805f2cb9a57d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 8400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Scenes/Boot.unity b/Assets/Darkmatter/Scenes/Boot.unity index 26c9275..03e099a 100644 --- a/Assets/Darkmatter/Scenes/Boot.unity +++ b/Assets/Darkmatter/Scenes/Boot.unity @@ -129,7 +129,6 @@ GameObject: m_Component: - component: {fileID: 82022335} - component: {fileID: 82022334} - - component: {fileID: 82022333} - component: {fileID: 82022332} m_Layer: 0 m_Name: UI Camera @@ -182,14 +181,6 @@ MonoBehaviour: m_VarianceClampScale: 0.9 m_ContrastAdaptiveSharpening: 0 m_Version: 2 ---- !u!81 &82022333 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 82022331} - m_Enabled: 1 --- !u!20 &82022334 Camera: m_ObjectHideFlags: 0 @@ -281,12 +272,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 147402014} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 16.30939, y: 8.32207, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1050564725} + m_Father: {fileID: 274737044} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &147402016 MonoBehaviour: @@ -301,6 +292,39 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Services.Inputs::Darkmatter.Services.Inputs.InputServiceModule inputReaderSO: {fileID: 11400000, guid: f9b7ed848ae3b4036923bbbb2f77fe40, type: 2} +--- !u!1 &274737043 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 274737044} + m_Layer: 0 + m_Name: ServiceModule + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &274737044 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 274737043} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 292698384} + - {fileID: 147402015} + m_Father: {fileID: 329578012} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &292698383 GameObject: m_ObjectHideFlags: 0 @@ -326,12 +350,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 292698383} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 16.30939, y: 8.32207, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1050564725} + m_Father: {fileID: 274737044} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &292698385 MonoBehaviour: @@ -347,6 +371,58 @@ MonoBehaviour: m_EditorClassIdentifier: Services.Camera::Darkmatter.Services.Camera.Installers.CameraServiceModule mainCamera: {fileID: 519420031} uiCamera: {fileID: 82022334} +--- !u!1 &329578011 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 329578012} + - component: {fileID: 329578013} + m_Layer: 0 + m_Name: GameLifetimeScope + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &329578012 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 329578011} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 274737044} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &329578013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 329578011} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4ca410c053f074e1cba2f7041f500d34, type: 3} + m_Name: + m_EditorClassIdentifier: Darkmatter.App::GameLifetimeScope + parentReference: + TypeName: + autoRun: 1 + autoInjectGameObjects: [] + serviceModules: + - {fileID: 292698385} + - {fileID: 147402016} --- !u!1 &519420028 GameObject: m_ObjectHideFlags: 0 @@ -458,7 +534,7 @@ Camera: m_Depth: -1 m_CullingMask: serializedVersion: 2 - m_Bits: 23 + m_Bits: 0 m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 @@ -485,90 +561,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &619394800 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 619394802} - - component: {fileID: 619394801} - m_Layer: 0 - m_Name: Global Light 2D - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &619394801 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 619394800} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3} - m_Name: - m_EditorClassIdentifier: - m_ComponentVersion: 2 - m_LightType: 4 - m_BlendStyleIndex: 0 - m_FalloffIntensity: 0.5 - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_Intensity: 1 - m_LightVolumeIntensity: 1 - m_LightVolumeEnabled: 0 - m_ApplyToSortingLayers: 00000000 - m_LightCookieSprite: {fileID: 0} - m_DeprecatedPointLightCookieSprite: {fileID: 0} - m_LightOrder: 0 - m_AlphaBlendOnOverlap: 0 - m_OverlapOperation: 0 - m_NormalMapDistance: 3 - m_NormalMapQuality: 2 - m_UseNormalMap: 0 - m_ShadowsEnabled: 0 - m_ShadowIntensity: 0.75 - m_ShadowSoftness: 0 - m_ShadowSoftnessFalloffIntensity: 0.5 - m_ShadowVolumeIntensityEnabled: 0 - m_ShadowVolumeIntensity: 0.75 - m_LocalBounds: - m_Center: {x: 0, y: -0.00000011920929, z: 0} - m_Extent: {x: 0.9985302, y: 0.99853027, z: 0} - m_PointLightInnerAngle: 360 - m_PointLightOuterAngle: 360 - m_PointLightInnerRadius: 0 - m_PointLightOuterRadius: 1 - m_ShapeLightParametricSides: 5 - m_ShapeLightParametricAngleOffset: 0 - m_ShapeLightParametricRadius: 1 - m_ShapeLightFalloffSize: 0.5 - m_ShapeLightFalloffOffset: {x: 0, y: 0} - m_ShapePath: - - {x: -0.5, y: -0.5, z: 0} - - {x: 0.5, y: -0.5, z: 0} - - {x: 0.5, y: 0.5, z: 0} - - {x: -0.5, y: 0.5, z: 0} ---- !u!4 &619394802 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 619394800} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1050564724 GameObject: m_ObjectHideFlags: 0 @@ -597,9 +589,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 292698384} - - {fileID: 147402015} + m_Children: [] m_Father: {fileID: 1798580248} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1798580247 @@ -651,14 +641,12 @@ MonoBehaviour: TypeName: autoRun: 1 autoInjectGameObjects: [] - serviceModules: - - {fileID: 147402016} - - {fileID: 292698385} + serviceModules: [] --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 519420032} - {fileID: 82022335} - - {fileID: 619394802} - {fileID: 1798580248} + - {fileID: 329578012} diff --git a/Assets/Darkmatter/Scenes/GamePlay.unity b/Assets/Darkmatter/Scenes/GamePlay.unity new file mode 100644 index 0000000..2f8a6d2 --- /dev/null +++ b/Assets/Darkmatter/Scenes/GamePlay.unity @@ -0,0 +1,339 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 2 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &619394800 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 619394802} + - component: {fileID: 619394801} + m_Layer: 0 + m_Name: Global Light 2D + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &619394801 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 619394800} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ComponentVersion: 2 + m_LightType: 4 + m_BlendStyleIndex: 0 + m_FalloffIntensity: 0.5 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_LightVolumeIntensity: 1 + m_LightVolumeEnabled: 0 + m_ApplyToSortingLayers: 00000000 + m_LightCookieSprite: {fileID: 0} + m_DeprecatedPointLightCookieSprite: {fileID: 0} + m_LightOrder: 0 + m_AlphaBlendOnOverlap: 0 + m_OverlapOperation: 0 + m_NormalMapDistance: 3 + m_NormalMapQuality: 2 + m_UseNormalMap: 0 + m_ShadowsEnabled: 0 + m_ShadowIntensity: 0.75 + m_ShadowSoftness: 0 + m_ShadowSoftnessFalloffIntensity: 0.5 + m_ShadowVolumeIntensityEnabled: 0 + m_ShadowVolumeIntensity: 0.75 + m_LocalBounds: + m_Center: {x: 0, y: -0.00000011920929, z: 0} + m_Extent: {x: 0.9985302, y: 0.99853027, z: 0} + m_PointLightInnerAngle: 360 + m_PointLightOuterAngle: 360 + m_PointLightInnerRadius: 0 + m_PointLightOuterRadius: 1 + m_ShapeLightParametricSides: 5 + m_ShapeLightParametricAngleOffset: 0 + m_ShapeLightParametricRadius: 1 + m_ShapeLightFalloffSize: 0.5 + m_ShapeLightFalloffOffset: {x: 0, y: 0} + m_ShapePath: + - {x: -0.5, y: -0.5, z: 0} + - {x: 0.5, y: -0.5, z: 0} + - {x: 0.5, y: 0.5, z: 0} + - {x: -0.5, y: 0.5, z: 0} +--- !u!4 &619394802 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 619394800} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &942391588 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 942391592} + - component: {fileID: 942391591} + - component: {fileID: 942391589} + m_Layer: 0 + m_Name: ArtCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &942391589 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942391588} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 +--- !u!20 &942391591 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942391588} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 23 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 8400000, guid: 00ba58b6f31d046c1849805f2cb9a57d, type: 2} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &942391592 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942391588} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 619394802} + - {fileID: 942391592} diff --git a/Assets/Darkmatter/Scenes/GamePlay.unity.meta b/Assets/Darkmatter/Scenes/GamePlay.unity.meta new file mode 100644 index 0000000..92e6c1c --- /dev/null +++ b/Assets/Darkmatter/Scenes/GamePlay.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e5f73f24e812e4a98b4c17d533fd3d6d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Readme.md b/Readme.md index 23571d4..9ccfcf6 100644 --- a/Readme.md +++ b/Readme.md @@ -88,6 +88,9 @@ Assets/Darkmatter/Code/ │ ├── Coloring/ │ │ ├── IColorPalette.cs │ │ └── PaintCommandDTO.cs +│ ├── Paper/ (shared art rig — RT-as-paper) +│ │ ├── IPaperRig.cs +│ │ └── IArtInputBridge.cs │ ├── History/ │ │ ├── ICommand.cs │ │ └── IUndoStack.cs @@ -122,6 +125,7 @@ Assets/Darkmatter/Code/ └── Features/ ├── MainMenu/ ├── DrawingCatalog/ + ├── Paper/ (RT paper rig — ArtCamera + RenderTexture + input bridge) ├── ShapeBuilder/ ├── Coloring/ ├── History/ @@ -209,33 +213,60 @@ Failures show a child-friendly retry screen; never crash. ## 7. Rendering Strategy -Hybrid: **Sprites for artwork, Canvas for HUD**. +**RT-as-paper.** ArtCamera renders the drawing world to an offscreen `RenderTexture`. A Canvas `RawImage` displays that RT. HUD lives on the same Canvas, above the RawImage. The RT *is* the paper — same fixed coordinate system on every device. + +``` +┌──────────────────────────────────────────────────────┐ +│ UICanvas (Screen-Space - Camera, UICamera) │ +│ │ +│ ┌────────────────────────────────────┐ │ +│ │ RawImage (AspectRatioFitter 1:1) │ [HUD] │ +│ │ └─ texture = PaperRig.Surface │ palette │ +│ │ │ undo etc │ +│ │ ArtCamera renders → here │ │ +│ └────────────────────────────────────┘ │ +│ │ +└──────────────────────────────────────────────────────┘ + ▲ + │ rendered offscreen + │ + ArtCamera (orthographicSize fixed, aspect = 1f) + culling mask: Artwork, PaperBackground, Effects + target texture: PaperRig.Surface (2048×2048 ARGB32) +``` ### Cameras -| Camera | Type | Culling Mask | Purpose | -|---|---|---|---| -| `ArtCamera` | Orthographic | `Artwork`, `PaperBackground` | Renders the drawing only. Source for capture. | -| `UICamera` | Overlay (or screen-space) | `UI` | HUD canvas, palette, buttons. | +| Camera | Type | Culling Mask | Render Target | Purpose | +|---|---|---|---|---| +| `ArtCamera` | Orthographic, **fixed ortho size**, aspect = 1 | `Artwork`, `PaperBackground`, `Effects` | `PaperRig.Surface` (offscreen RT) | Renders the drawing world. Never sees the screen. | +| `UICamera` | Camera (Screen-Space – Camera) | `UI` | Screen | Displays the paper RawImage + HUD. | ### Layers | Layer | Used by | |---|---| -| `Artwork` | Drawing region sprites, shape pieces, paper bg | -| `UI` | All Canvas elements | -| `Effects` | Particle bursts, sparkles on completion | +| `Artwork` | Drawing region sprites, shape pieces, paper bg, all in ArtCamera world | +| `Effects` | Particle bursts, sparkles — also in ArtCamera world (so they're captured into the PNG) | +| `UI` | All Canvas elements (RawImage paper + HUD) | -### Why hybrid +### Why RT-as-paper | Need | Choice | Why | |---|---|---| -| Per-region tap-to-fill | Sprites + `PolygonCollider2D` | Clean `Physics2D.OverlapPoint`; deterministic; no shader work for the toddler region count (5–20). | -| Drag/drop shape pieces | Sprites + Physics2D | Natural world bounds, easy snap distance checks. | -| Capture to PNG with paper bg | Sprites under dedicated Camera | `RenderTexture` from `ArtCamera` excludes HUD automatically. | -| Color palette, buttons | Canvas | Anchors handle aspect ratios. Buttons + ScrollRect free. | +| Per-region tap-to-fill | Sprites + `PolygonCollider2D` in ArtCamera world; tapped via `IArtInputBridge` | Coordinate system is fixed (RT space). One `Physics2D.OverlapPoint` call after screen→art-world conversion. | +| Drag/drop shape pieces | Sprites + Physics2D in art world | Same fixed bounds on every device — no per-aspect tray layout. | +| Capture to PNG | `RT → Texture2D → PNG` | The RT *is* the saved image. No camera state override, no compositing pass, no determinism worries. | +| Multi-resolution support | `AspectRatioFitter (1:1, FitInParent)` on the RawImage | The "fit camera" problem reduces to a single Canvas property. Letterbox/pillarbox = whatever the Canvas around the RawImage looks like. | +| Color palette, buttons | Canvas above the RawImage | Anchors handle aspect ratios. Buttons + ScrollRect free. | | Drawing catalog grid | Canvas | `GridLayoutGroup` + ScrollRect, async thumbnail loader. | +### Multi-resolution rule + +The artwork world is **screen-size-independent by construction.** Author every drawing in a fixed 2048×2048 design rect (or 20×20 world units at PPU=100). Pieces, regions, snap radii, slot positions — all expressed in this space and never scaled at runtime. Different screen sizes only change how the *RawImage* is laid out on the Canvas; the contents of the RT stay identical. + +If you need a backdrop (wood/cloth behind the paper), it's a sibling Canvas Image *outside* the RawImage, sized to fill the screen. The RT itself has a transparent or paper-colored background. + --- ## 8. Core Contracts