diff --git a/.DS_Store b/.DS_Store index 8eab601..d0f58a9 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/DrawingCatalog/IDrawingTemplate.cs b/Assets/Darkmatter/Code/Core/Contracts/Features/DrawingCatalog/IDrawingTemplate.cs index 28f5769..9e997a5 100644 --- a/Assets/Darkmatter/Code/Core/Contracts/Features/DrawingCatalog/IDrawingTemplate.cs +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/DrawingCatalog/IDrawingTemplate.cs @@ -10,7 +10,7 @@ namespace Darkmatter.Core.Contracts.Features.DrawingCatalog string Id { get; } string DisplayName { get; } Sprite DefaultThumbnail { get; } - Sprite PaperBackground { get; } + GameObject Prefab { get; } IReadOnlyList Pieces { get; } IReadOnlyList Regions { get; } } diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow.meta b/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow.meta new file mode 100644 index 0000000..9e39e59 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ddd3ece612334da5befd516d65ddc88c +timeCreated: 1779952530 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow/IGameplaySceneRefs.cs b/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow/IGameplaySceneRefs.cs new file mode 100644 index 0000000..35bd7d1 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow/IGameplaySceneRefs.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace Darkmatter.Core.Contracts.Features.GameplayFlow; + +public interface IGameplaySceneRefs +{ + RectTransform PaperRoot { get; } + RectTransform SlotsParent { get; } + RectTransform PiecesParent { get; } + RectTransform RegionsParent { get; } + RectTransform HudRoot { get; } + RectTransform TrayPanel { get; } +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow/IGameplaySceneRefs.cs.meta b/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow/IGameplaySceneRefs.cs.meta new file mode 100644 index 0000000..ce0e819 --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/GameplayFlow/IGameplaySceneRefs.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9794063828774e7e98d911a8252842c0 +timeCreated: 1779952541 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder.meta b/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder.meta new file mode 100644 index 0000000..4435b7a --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 68c97391df7846648bbb6d7847dafb18 +timeCreated: 1779950354 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder/IShapeBuilderController.cs b/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder/IShapeBuilderController.cs new file mode 100644 index 0000000..588bf2a --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder/IShapeBuilderController.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Threading; +using Cysharp.Threading.Tasks; +using Darkmatter.Core.Contracts.Features.DrawingCatalog; + +namespace Darkmatter.Core.Contracts.Features.ShapeBuilder; + +public interface IShapeBuilderController +{ + UniTask InitializeAsync(CancellationToken ct); + + UniTask BuildAsync(IDrawingTemplate template, + IReadOnlyCollection preSnappedIds, CancellationToken ct); + + IReadOnlyCollection GetSnappedPieceIds(); + void Clear(); +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder/IShapeBuilderController.cs.meta b/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder/IShapeBuilderController.cs.meta new file mode 100644 index 0000000..e1d128a --- /dev/null +++ b/Assets/Darkmatter/Code/Core/Contracts/Features/ShapeBuilder/IShapeBuilderController.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 218237e181434d4983ad55d38db77c74 +timeCreated: 1779950364 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Core/Core.asmdef b/Assets/Darkmatter/Code/Core/Core.asmdef index 528670a..3d3ef16 100644 --- a/Assets/Darkmatter/Code/Core/Core.asmdef +++ b/Assets/Darkmatter/Code/Core/Core.asmdef @@ -2,7 +2,8 @@ "name": "Core", "rootNamespace": "Darkmatter.Core", "references": [ - "GUID:f51ebe6a0ceec4240a699833d6309b23" + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "GUID:9e24947de15b9834991c9d8411ea37cf" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/Darkmatter/Code/Core/Data/Static/Features/DrawingTemplate/DrawingTemplateSO.cs b/Assets/Darkmatter/Code/Core/Data/Static/Features/DrawingTemplate/DrawingTemplateSO.cs index 1159911..9e10add 100644 --- a/Assets/Darkmatter/Code/Core/Data/Static/Features/DrawingTemplate/DrawingTemplateSO.cs +++ b/Assets/Darkmatter/Code/Core/Data/Static/Features/DrawingTemplate/DrawingTemplateSO.cs @@ -12,7 +12,7 @@ namespace Darkmatter.Core.Data.Static.Features.DrawingTemplate [field: SerializeField] public string Id { get; private set; } [field: SerializeField] public string DisplayName { get; private set; } [field: SerializeField] public Sprite DefaultThumbnail { get; private set; } - [field: SerializeField] public Sprite PaperBackground { get; private set; } + [field: SerializeField] public GameObject Prefab { get; private set; } [field: SerializeField] public IReadOnlyList Pieces { get; private set; } [field: SerializeField] public IReadOnlyList Regions { get; private set; } } diff --git a/Assets/Darkmatter/Code/Features/AppBoot.meta b/Assets/Darkmatter/Code/Features/AppBoot.meta new file mode 100644 index 0000000..2ffc527 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/AppBoot.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3841157d2ef124a25b2c16956605ca40 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/AppBoot/Features.AppBoot.asmdef b/Assets/Darkmatter/Code/Features/AppBoot/Features.AppBoot.asmdef new file mode 100644 index 0000000..b3b1104 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/AppBoot/Features.AppBoot.asmdef @@ -0,0 +1,3 @@ +{ + "name": "Features.AppBoot" +} diff --git a/Assets/Darkmatter/Code/Features/AppBoot/Features.AppBoot.asmdef.meta b/Assets/Darkmatter/Code/Features/AppBoot/Features.AppBoot.asmdef.meta new file mode 100644 index 0000000..8242acc --- /dev/null +++ b/Assets/Darkmatter/Code/Features/AppBoot/Features.AppBoot.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a00b1d9e55c264fb785b78914db69e05 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow.meta b/Assets/Darkmatter/Code/Features/GameplayFlow.meta new file mode 100644 index 0000000..9484e2f --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e69d4466105646aabc1668844cac5b7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Features.GameplayFlow.asmdef b/Assets/Darkmatter/Code/Features/GameplayFlow/Features.GameplayFlow.asmdef new file mode 100644 index 0000000..de08802 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Features.GameplayFlow.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Features.GameplayFlow", + "rootNamespace": "Darkmatter.Features.GameplayFlow", + "references": [ + "GUID:6a0a834eb41764f12ba55c3fb04a40cb", + "GUID:b0214a6008ed146ff8f122a6a9c2f6cc", + "GUID:c1c03c0e5b2f4412b9f2be1c20d6a9b1" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Features.GameplayFlow.asmdef.meta b/Assets/Darkmatter/Code/Features/GameplayFlow/Features.GameplayFlow.asmdef.meta new file mode 100644 index 0000000..46a1577 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Features.GameplayFlow.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 995166e584dda4ff98501f62b07aa9cb +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Flow.meta b/Assets/Darkmatter/Code/Features/GameplayFlow/Flow.meta new file mode 100644 index 0000000..fcd838c --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Flow.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: adb650c457f6843c2a5704f12bcd0160 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Installers.meta b/Assets/Darkmatter/Code/Features/GameplayFlow/Installers.meta new file mode 100644 index 0000000..e4742f0 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Installers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 46180d2f7b7a14e42b77afb776b3a129 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Installers/GameplayFlowFeatureModule.cs b/Assets/Darkmatter/Code/Features/GameplayFlow/Installers/GameplayFlowFeatureModule.cs new file mode 100644 index 0000000..6cc2540 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Installers/GameplayFlowFeatureModule.cs @@ -0,0 +1,20 @@ +using Darkmatter.Core.Contracts.Features.GameplayFlow; +using Darkmatter.Features.GameplayFlow.SceneRefs; +using Darkmatter.Libs.Installers; +using UnityEngine; +using VContainer; +using VContainer.Unity; + +namespace Darkmatter.Features.GameplayFlow +{ + public class GameplayFlowFeatureModule : MonoBehaviour, IModule + { + [SerializeField] private GameplaySceneRefs sceneRefs; + + public void Register(IContainerBuilder builder) + { + if (sceneRefs != null) + builder.RegisterComponent(sceneRefs); + } + } +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Installers/GameplayFlowFeatureModule.cs.meta b/Assets/Darkmatter/Code/Features/GameplayFlow/Installers/GameplayFlowFeatureModule.cs.meta new file mode 100644 index 0000000..d3a6ba8 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Installers/GameplayFlowFeatureModule.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c784b80c101814d24bf8820233bb0f62 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs.meta b/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs.meta new file mode 100644 index 0000000..293754f --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 38e2583efd5f84627b5ff0fc7599bf03 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs/GameplaySceneRefs.cs b/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs/GameplaySceneRefs.cs new file mode 100644 index 0000000..c964211 --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs/GameplaySceneRefs.cs @@ -0,0 +1,24 @@ +using Darkmatter.Core.Contracts.Features.GameplayFlow; +using UnityEngine; + +namespace Darkmatter.Features.GameplayFlow.SceneRefs +{ + public class GameplaySceneRefs : MonoBehaviour, IGameplaySceneRefs + { + [SerializeField] private RectTransform paperRoot; + [SerializeField] private RectTransform slotsParent; + [SerializeField] private RectTransform piecesParent; + [SerializeField] private RectTransform regionsParent; + + [SerializeField] private RectTransform hudRoot; + [SerializeField] private RectTransform trayPanel; + + + public RectTransform PaperRoot => paperRoot; + public RectTransform SlotsParent => slotsParent; + public RectTransform PiecesParent => piecesParent; + public RectTransform RegionsParent => regionsParent; + public RectTransform HudRoot => hudRoot; + public RectTransform TrayPanel => trayPanel; + } +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs/GameplaySceneRefs.cs.meta b/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs/GameplaySceneRefs.cs.meta new file mode 100644 index 0000000..e2018cf --- /dev/null +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/SceneRefs/GameplaySceneRefs.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f2e39895945b94467b1677388b2fb896 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/ShapeBuilder/Commands/SnapPieceCommand.cs b/Assets/Darkmatter/Code/Features/ShapeBuilder/Commands/SnapPieceCommand.cs index 44b038a..c04352d 100644 --- a/Assets/Darkmatter/Code/Features/ShapeBuilder/Commands/SnapPieceCommand.cs +++ b/Assets/Darkmatter/Code/Features/ShapeBuilder/Commands/SnapPieceCommand.cs @@ -4,11 +4,6 @@ using UnityEngine; namespace Darkmatter.Features.ShapeBuilder.Commands { - /// - /// Undoable snap. Captures the piece's pre-snap pose + parent at ctor time; - /// Execute drives the normal snap tween; Undo restores the pre-snap state - /// and re-enables drag. - /// internal sealed class SnapPieceCommand : ICommand { private readonly ShapePiece _piece; diff --git a/Assets/Darkmatter/Code/Features/ShapeBuilder/Installers/ShapeBuilderFeatureModule.cs b/Assets/Darkmatter/Code/Features/ShapeBuilder/Installers/ShapeBuilderFeatureModule.cs index 017748e..fd6df8f 100644 --- a/Assets/Darkmatter/Code/Features/ShapeBuilder/Installers/ShapeBuilderFeatureModule.cs +++ b/Assets/Darkmatter/Code/Features/ShapeBuilder/Installers/ShapeBuilderFeatureModule.cs @@ -1,7 +1,10 @@ +using Darkmatter.Core.Contracts.Features.ShapeBuilder; using Darkmatter.Core.Data.Static.Features.ShapeBuilder; +using Darkmatter.Features.ShapeBuilder.Systems; using Darkmatter.Libs.Installers; using UnityEngine; using VContainer; +using VContainer.Unity; namespace Darkmatter.Features.ShapeBuilder.Installers { @@ -12,10 +15,8 @@ namespace Darkmatter.Features.ShapeBuilder.Installers public void Register(IContainerBuilder builder) { if (config != null) - builder.RegisterInstance(config); - - // ShapePiece instances are MonoBehaviours instantiated by the - // ShapeBuilderController; nothing to register here for them. + builder.RegisterComponent(config); + builder.Register(Lifetime.Singleton); } } -} +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/ShapeBuilder/Systems/ShapeBuilderController.cs b/Assets/Darkmatter/Code/Features/ShapeBuilder/Systems/ShapeBuilderController.cs new file mode 100644 index 0000000..005eeca --- /dev/null +++ b/Assets/Darkmatter/Code/Features/ShapeBuilder/Systems/ShapeBuilderController.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using Cysharp.Threading.Tasks; +using Darkmatter.Core.Contracts.Features.DrawingCatalog; +using Darkmatter.Core.Contracts.Features.History; +using Darkmatter.Core.Contracts.Features.ShapeBuilder; +using Darkmatter.Core.Contracts.Services.Assets; +using Darkmatter.Core.Contracts.Services.Audio; +using Darkmatter.Core.Contracts.Features.GameplayFlow; +using Darkmatter.Core.Data.Signals.Features.ShapeBuilder; +using Darkmatter.Core.Data.Static.Features.ShapeBuilder; +using Darkmatter.Features.ShapeBuilder.UI; +using Darkmatter.Libs.Observer; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace Darkmatter.Features.ShapeBuilder.Systems +{ + public class ShapeBuilderController : IShapeBuilderController, IDisposable + { + private const string PiecePrefabKey = "ShapeBuilder/Piece"; + + private string _currentTemplateId; + private int _expected; + private int _snapped; + private GameObject _drawingInstance; + private GameObject _piecePrefab; + private IDisposable _snappedSub; + + private readonly List _snappedPieceIds = new(); + private readonly ShapeBuilderConfig _cfg; + private readonly ISfxPlayer _sfx; + private readonly IEventBus _bus; + private readonly IUndoStack _undo; + private readonly IAssetProviderService _assetProviderService; + private readonly IEventBus _eventBus; + private readonly IGameplaySceneRefs _refs; + + + public ShapeBuilderController( + ShapeBuilderConfig cfg, + ISfxPlayer sfx, + IEventBus bus, + IUndoStack undo, + IAssetProviderService assetProviderService, + IEventBus eventBus, + IGameplaySceneRefs refs) + { + _cfg = cfg; + _sfx = sfx; + _bus = bus; + _undo = undo; + _assetProviderService = assetProviderService; + _eventBus = eventBus; + _refs = refs; + } + + public async UniTask InitializeAsync(CancellationToken cancellationToken) + { + await TryLoadPiecePrefabAsync(cancellationToken); + + _snappedSub = _eventBus.Subscribe(OnPieceSnapped); + } + + private void OnPieceSnapped(PieceSnappedSignal obj) + { + _snappedPieceIds.Add(obj.PieceId); + CheckIfShapeAssembled(); + } + + public async UniTask BuildAsync( + IDrawingTemplate template, + IReadOnlyCollection preSnappedIds, + CancellationToken ct = default) + { + Clear(); + + if (template.Prefab == null) + throw new System.Exception($"No drawing layout prefab for '{template.Id}'"); + + _drawingInstance = Object.Instantiate(template.Prefab, _refs.PaperRoot); + ct.ThrowIfCancellationRequested(); + + var slots = _drawingInstance.GetComponentsInChildren(includeInactive: true); + + await TryLoadPiecePrefabAsync(ct); + + int count = template.Pieces.Count; + float trayW = _refs.TrayPanel.rect.width; + float pitch = trayW / (count + 1); + + _currentTemplateId = template.Id; + _expected = count; + _snapped = 0; + + CreateShapePieceInstances(template, preSnappedIds, count, slots, pitch, trayW); + + CheckIfShapeAssembled(); + } + + private void CreateShapePieceInstances(IDrawingTemplate template, IReadOnlyCollection preSnappedIds, + int count, + SlotMarker[] slots, float pitch, float trayW) + { + for (int i = 0; i < count; i++) + { + var shape = template.Pieces[i]; + var slot = FindSlotForShape(slots, shape); + if (slot == null) + { + Debug.LogError($"[ShapeBuilder] No SlotMarker for '{shape.Id}' in '{template.Id}'"); + continue; + } + + var trayPos = new Vector2(pitch * (i + 1) - trayW * 0.5f, 0f); + bool preSnapped = preSnappedIds != null && preSnappedIds.Contains(shape.Id); + + var go = Object.Instantiate(_piecePrefab, _refs.TrayPanel); + go.name = $"Piece_{shape.Id}"; + + var piece = go.GetComponent(); + piece.Setup(shape, slot, _cfg, _sfx, _bus, _undo, trayPos, preSnapped); + + if (preSnapped) _snapped++; + } + } + + private void CheckIfShapeAssembled() + { + if (_expected > 0 && _snapped == _expected) + _bus.Publish(new ShapeAssembledSignal(_currentTemplateId)); + } + + private async UniTask TryLoadPiecePrefabAsync(CancellationToken ct) + { + if (_piecePrefab == null) + { + _piecePrefab = await _assetProviderService.LoadAssetAsync( + PiecePrefabKey, progress: null, cancellationToken: ct); + if (_piecePrefab == null) + throw new System.Exception($"No piece prefab at '{PiecePrefabKey}'"); + } + } + + private static SlotMarker FindSlotForShape(SlotMarker[] slots, ShapeSO shape) + { + foreach (var s in slots) + if (s.Shape == shape) + return s; + return null; + } + + public IReadOnlyCollection GetSnappedPieceIds() + { + return _snappedPieceIds; + } + + public void Clear() + { + } + + public void Dispose() + { + _snappedSub?.Dispose(); + } + } +} \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/ShapeBuilder/Systems/ShapeBuilderController.cs.meta b/Assets/Darkmatter/Code/Features/ShapeBuilder/Systems/ShapeBuilderController.cs.meta new file mode 100644 index 0000000..50ce41a --- /dev/null +++ b/Assets/Darkmatter/Code/Features/ShapeBuilder/Systems/ShapeBuilderController.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2964329afc8ef47fe8817d4a701b8fe1 \ No newline at end of file diff --git a/Assets/Darkmatter/Code/Features/ShapeBuilder/UI/ShapePiece.cs b/Assets/Darkmatter/Code/Features/ShapeBuilder/UI/ShapePiece.cs index 4e11b19..3a8ad12 100644 --- a/Assets/Darkmatter/Code/Features/ShapeBuilder/UI/ShapePiece.cs +++ b/Assets/Darkmatter/Code/Features/ShapeBuilder/UI/ShapePiece.cs @@ -12,12 +12,6 @@ using UnityEngine.UI; namespace Darkmatter.Features.ShapeBuilder.UI { - /// - /// Single-MB shape piece. Handles drag, reactive preview lerp, snap, - /// and return-to-tray. Snap is wrapped in a - /// pushed onto the shared so it participates in - /// the same undo/redo flow as coloring. - /// [RequireComponent(typeof(RectTransform))] public sealed class ShapePiece : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler @@ -116,7 +110,7 @@ namespace Darkmatter.Features.ShapeBuilder.UI _slot.RectTransform.anchoredPosition); if (dist <= _cfg.SnapRadius) - _undo.Push(new SnapPieceCommand(this)); // Push calls Execute → SnapInternal + _undo.Push(new SnapPieceCommand(this)); else ReturnToTray(); } @@ -132,7 +126,6 @@ namespace Darkmatter.Features.ShapeBuilder.UI RectTransform.localRotation = Quaternion.Slerp(Quaternion.identity, slot.localRotation, t); } - // ---- Command-driven snap / un-snap ---- internal void SnapInternal() { Lock(); diff --git a/Assets/Darkmatter/Content/Intro/Create_intro_for_kids_game_202605272007.mp4 b/Assets/Darkmatter/Content/Intro/Create_intro_for_kids_game_202605272007.mp4 deleted file mode 100644 index adc15da..0000000 Binary files a/Assets/Darkmatter/Content/Intro/Create_intro_for_kids_game_202605272007.mp4 and /dev/null differ diff --git a/Assets/Darkmatter/Content/Intro/intro.mp4 b/Assets/Darkmatter/Content/Intro/intro.mp4 new file mode 100644 index 0000000..f2c5369 Binary files /dev/null and b/Assets/Darkmatter/Content/Intro/intro.mp4 differ diff --git a/Assets/Darkmatter/Content/Intro/Create_intro_for_kids_game_202605272007.mp4.meta b/Assets/Darkmatter/Content/Intro/intro.mp4.meta similarity index 88% rename from Assets/Darkmatter/Content/Intro/Create_intro_for_kids_game_202605272007.mp4.meta rename to Assets/Darkmatter/Content/Intro/intro.mp4.meta index ec68d47..09f0998 100644 --- a/Assets/Darkmatter/Content/Intro/Create_intro_for_kids_game_202605272007.mp4.meta +++ b/Assets/Darkmatter/Content/Intro/intro.mp4.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ec78f9cae5b834662a0005dcbadd12c6 +guid: 94bb9480e86df4128b09488bd123a53e VideoClipImporter: externalObjects: {} serializedVersion: 3 diff --git a/Assets/Darkmatter/Scenes/Boot.unity b/Assets/Darkmatter/Scenes/Boot.unity index 88982b5..90f5a73 100644 --- a/Assets/Darkmatter/Scenes/Boot.unity +++ b/Assets/Darkmatter/Scenes/Boot.unity @@ -637,7 +637,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 @@ -966,7 +966,7 @@ VideoPlayer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2122267603} m_Enabled: 1 - m_VideoClip: {fileID: 32900000, guid: ec78f9cae5b834662a0005dcbadd12c6, type: 3} + m_VideoClip: {fileID: 32900000, guid: 94bb9480e86df4128b09488bd123a53e, type: 3} m_TargetCameraAlpha: 1 m_TargetCamera3DLayout: 0 m_TargetCamera: {fileID: 0} @@ -988,7 +988,7 @@ VideoPlayer: m_EnabledAudioTracks: 01 m_DirectAudioMutes: 00 m_ControlledAudioTrackCount: 1 - m_PlayOnAwake: 0 + m_PlayOnAwake: 1 m_SkipOnDrop: 1 m_Looping: 0 m_WaitForFirstFrame: 0 diff --git a/Assets/Darkmatter/Scenes/GamePlay.unity b/Assets/Darkmatter/Scenes/GamePlay.unity index f7e02fb..103ff84 100644 --- a/Assets/Darkmatter/Scenes/GamePlay.unity +++ b/Assets/Darkmatter/Scenes/GamePlay.unity @@ -119,6 +119,56 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &396806865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 396806866} + - component: {fileID: 396806867} + m_Layer: 0 + m_Name: SceneRefs + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &396806866 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396806865} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3.31064, y: 1.32407, 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!114 &396806867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396806865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2e39895945b94467b1677388b2fb896, type: 3} + m_Name: + m_EditorClassIdentifier: Features.GameplayFlow::Darkmatter.Features.GameplayFlow.SceneRefs.GameplaySceneRefs + paperRoot: {fileID: 0} + slotsParent: {fileID: 0} + piecesParent: {fileID: 0} + regionsParent: {fileID: 0} + hudRoot: {fileID: 0} + trayPanel: {fileID: 0} --- !u!1 &590523272 GameObject: m_ObjectHideFlags: 0 @@ -198,6 +248,51 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1046038182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1046038183} + - component: {fileID: 1046038184} + m_Layer: 0 + m_Name: GameplayFlowFeatureModule + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1046038183 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1046038182} + 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: 1965442263} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1046038184 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1046038182} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c784b80c101814d24bf8820233bb0f62, type: 3} + m_Name: + m_EditorClassIdentifier: Features.GameplayFlow::Darkmatter.Features.GameplayFlow.GameplayFlowFeatureModule + sceneRefs: {fileID: 396806867} --- !u!1 &1224714931 GameObject: m_ObjectHideFlags: 0 @@ -248,7 +343,9 @@ MonoBehaviour: autoRun: 1 autoInjectGameObjects: [] serviceModules: + - {fileID: 1046038184} - {fileID: 1551649429} + - {fileID: 1991184380} --- !u!1 &1551649427 GameObject: m_ObjectHideFlags: 0 @@ -323,6 +420,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1046038183} - {fileID: 1551649428} - {fileID: 1991184379} m_Father: {fileID: 1224714932} @@ -480,4 +578,5 @@ SceneRoots: m_Roots: - {fileID: 2069155641} - {fileID: 590523275} + - {fileID: 396806866} - {fileID: 1224714932}