diff --git a/Assets/Art/Sprites/OverworldBuildings/AEblerup_Map_Statue.png.meta b/Assets/Art/Sprites/OverworldBuildings/AEblerup_Map_Statue.png.meta index 041175fc..f673f5f7 100644 --- a/Assets/Art/Sprites/OverworldBuildings/AEblerup_Map_Statue.png.meta +++ b/Assets/Art/Sprites/OverworldBuildings/AEblerup_Map_Statue.png.meta @@ -122,6 +122,32 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WindowsStoreApps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -129,10 +155,10 @@ TextureImporter: name: AEblerup_Map_Statue_0 rect: serializedVersion: 2 - x: 59 - y: 48 - width: 405 - height: 567 + x: 0 + y: 0 + width: 555 + height: 676 alignment: 9 pivot: {x: 0.5, y: 0.25} border: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 1.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 1.asset index c7f3fe8a..61d245ae 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 1.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 1.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: Shoe decorationName: Shoe decorationSprite: {fileID: -792204027, guid: f1b529408513adc409a57c9ba7131823, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 2.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 2.asset index 08c22658..e6c86cf0 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 2.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 2.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: axe decorationName: axe decorationSprite: {fileID: 6674386295937086461, guid: 3bd1c178a78fcd144965cd1731dc309b, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 3.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 3.asset index 67bf4561..4297c1d6 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 3.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 3.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: can decorationName: can decorationSprite: {fileID: 792078976, guid: f1b529408513adc409a57c9ba7131823, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 4.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 4.asset index 34922fd3..614d5d8f 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 4.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 4.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: i_feel_the_magic_between_you_and_i decorationName: I feel the magic between you and I decorationSprite: {fileID: 1623587888, guid: 1630961e1f25e4243ad74e4e3b0c7e54, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 5.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 5.asset index 6c1d6121..94caddf2 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 5.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 5.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: the_people's_sticker decorationName: the people's sticker decorationSprite: {fileID: 3452003437791708593, guid: 4c13556eeb918624c9dd3d7e4086242e, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 6.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 6.asset index 96afc9d8..5983097d 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 6.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 6.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: cardalbum decorationName: CardAlbum decorationSprite: {fileID: -4354454609415314374, guid: 1ba1f8cf73f79214190f1432fe1e3bc6, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 7.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 7.asset index 18f1d1ed..124bf5da 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 7.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 7.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: chocolate decorationName: chocolate decorationSprite: {fileID: -509776585262497855, guid: c648336c825f7d7479582bbe4d95d0bc, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 8.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 8.asset index c467b930..90398526 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 8.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 8.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: tennis_ball decorationName: tennis ball decorationSprite: {fileID: -8897872742393391051, guid: 44a64b7a80921694790236bab7765357, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData 9.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData 9.asset index fdab1f82..7333058a 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData 9.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData 9.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: bird_poop decorationName: bird poop decorationSprite: {fileID: 6130942287420046110, guid: 9ef635f111f888a4386a7f0290117264, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/Data/Minigames/StatueDressup/TestDecorationData.asset b/Assets/Data/Minigames/StatueDressup/TestDecorationData.asset index feb3c7b2..95d89ca9 100644 --- a/Assets/Data/Minigames/StatueDressup/TestDecorationData.asset +++ b/Assets/Data/Minigames/StatueDressup/TestDecorationData.asset @@ -15,6 +15,5 @@ MonoBehaviour: decorationId: backpack decorationName: backpack decorationSprite: {fileID: -6415490079858998490, guid: b9d1a045f7c163a4d9e2d38071913885, type: 3} - authoredSize: {x: 512, y: 512} - iconSize: {x: 256, y: 256} + authoredSize: {x: 300, y: 300} isUnlocked: 1 diff --git a/Assets/External/Placeholders/statue_outline.png b/Assets/External/Placeholders/statue_outline.png new file mode 100644 index 00000000..1c418172 Binary files /dev/null and b/Assets/External/Placeholders/statue_outline.png differ diff --git a/Assets/External/Placeholders/statue_outline.png.meta b/Assets/External/Placeholders/statue_outline.png.meta new file mode 100644 index 00000000..a4d2d877 --- /dev/null +++ b/Assets/External/Placeholders/statue_outline.png.meta @@ -0,0 +1,195 @@ +fileFormatVersion: 2 +guid: 338c4323de4ff7f4c99e4c10a744e914 +TextureImporter: + internalIDToNameTable: + - first: + 213: -7424888634701936452 + second: statue_outline_0 + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WindowsStoreApps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: statue_outline_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 555 + height: 676 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + customData: + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: cb881cf102f75f890800000000000000 + internalID: -7424888634701936452 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: a4e62b13d7f4aeb42a7c302cf33555e9 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: + statue_outline_0: -7424888634701936452 + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Minigames/StatueDressup/DecorationItem.prefab b/Assets/Prefabs/Minigames/StatueDressup/DecorationDraggableInstance.prefab similarity index 88% rename from Assets/Prefabs/Minigames/StatueDressup/DecorationItem.prefab rename to Assets/Prefabs/Minigames/StatueDressup/DecorationDraggableInstance.prefab index 9d89cc4f..c9e89879 100644 --- a/Assets/Prefabs/Minigames/StatueDressup/DecorationItem.prefab +++ b/Assets/Prefabs/Minigames/StatueDressup/DecorationDraggableInstance.prefab @@ -9,12 +9,12 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7351787172634191403} - - component: {fileID: 1765490150995458244} - component: {fileID: 7495592582591578536} - component: {fileID: 597267714783345863} - component: {fileID: 3617977973382190563} + - component: {fileID: 8998709565229564215} m_Layer: 5 - m_Name: DecorationItem + m_Name: DecorationDraggableInstance m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -39,27 +39,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1765490150995458244 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 769974252937479200} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 31a82dde0ffb439e86b79499b9daa92b, type: 3} - m_Name: - m_EditorClassIdentifier: AppleHillsScripts::Minigames.StatueDressup.DragDrop.DecorationItem - moveSpeed: 50 - smoothMovement: 0 - snapDuration: 0.3 - visual: {fileID: 0} - isSelectable: 1 - selectionOffset: 50 - decorationData: {fileID: 0} - decorationImage: {fileID: 597267714783345863} - statueArea: {fileID: 0} --- !u!222 &7495592582591578536 CanvasRenderer: m_ObjectHideFlags: 0 @@ -110,3 +89,17 @@ CanvasGroup: m_Interactable: 1 m_BlocksRaycasts: 1 m_IgnoreParentGroups: 0 +--- !u!114 &8998709565229564215 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 769974252937479200} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e4659fd035c74a79af0311de9e17f44a, type: 3} + m_Name: + m_EditorClassIdentifier: AppleHillsScripts::Minigames.StatueDressup.DragDrop.DecorationDraggableInstance + decorationImage: {fileID: 597267714783345863} + canvasGroup: {fileID: 0} diff --git a/Assets/Prefabs/Minigames/StatueDressup/DecorationItem.prefab.meta b/Assets/Prefabs/Minigames/StatueDressup/DecorationDraggableInstance.prefab.meta similarity index 100% rename from Assets/Prefabs/Minigames/StatueDressup/DecorationItem.prefab.meta rename to Assets/Prefabs/Minigames/StatueDressup/DecorationDraggableInstance.prefab.meta diff --git a/Assets/Prefabs/Minigames/StatueDressup/DecorationGridIcon.prefab b/Assets/Prefabs/Minigames/StatueDressup/DecorationGridIcon.prefab new file mode 100644 index 00000000..87ac011b --- /dev/null +++ b/Assets/Prefabs/Minigames/StatueDressup/DecorationGridIcon.prefab @@ -0,0 +1,105 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &769974252937479200 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7351787172634191403} + - component: {fileID: 7495592582591578536} + - component: {fileID: 597267714783345863} + - component: {fileID: 3617977973382190563} + - component: {fileID: 2222137027263565689} + m_Layer: 5 + m_Name: DecorationGridIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7351787172634191403 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 769974252937479200} + 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} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7495592582591578536 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 769974252937479200} + m_CullTransparentMesh: 1 +--- !u!114 &597267714783345863 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 769974252937479200} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!225 &3617977973382190563 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 769974252937479200} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &2222137027263565689 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 769974252937479200} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c806d80a321498c9f33f13d7a31065c, type: 3} + m_Name: + m_EditorClassIdentifier: AppleHillsScripts::Minigames.StatueDressup.DragDrop.DecorationGridIcon + iconImage: {fileID: 597267714783345863} + decorationData: {fileID: 0} diff --git a/Assets/Prefabs/Minigames/StatueDressup/DecorationGridIcon.prefab.meta b/Assets/Prefabs/Minigames/StatueDressup/DecorationGridIcon.prefab.meta new file mode 100644 index 00000000..e4c3f99f --- /dev/null +++ b/Assets/Prefabs/Minigames/StatueDressup/DecorationGridIcon.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a461d4cb94a8ab1429388c90bbd543b6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MiniGames/StatueDecoration.unity b/Assets/Scenes/MiniGames/StatueDecoration.unity index cbd10635..07df1172 100644 --- a/Assets/Scenes/MiniGames/StatueDecoration.unity +++ b/Assets/Scenes/MiniGames/StatueDecoration.unity @@ -348,6 +348,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1078270174} + - {fileID: 1325274730} - {fileID: 166400579} m_Father: {fileID: 1443594949} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -653,25 +654,14 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: acbd542762b44e719326dff6c3a69e6e, type: 3} m_Name: m_EditorClassIdentifier: AppleHillsScripts::Minigames.StatueDressup.Controllers.DecorationMenuController - itemPrefab: {fileID: 1765490150995458244, guid: 064cd4d021ea13e47860a59bbe8224aa, type: 3} + iconPrefab: {fileID: 2222137027263565689, guid: a461d4cb94a8ab1429388c90bbd543b6, type: 3} + draggablePrefab: {fileID: 8998709565229564215, guid: 064cd4d021ea13e47860a59bbe8224aa, type: 3} itemsContainer: {fileID: 699865155} + draggableContainer: {fileID: 1217454518} nextPageButton: {fileID: 2071711339} previousPageButton: {fileID: 194466356} - statueArea: {fileID: 65358845} - statueParent: {fileID: 166400579} statueController: {fileID: 1647993458} - allDecorations: - - {fileID: 11400000, guid: 2ea75de9ff6dbfb4b8c246a654868479, type: 2} - - {fileID: 11400000, guid: ca949a6208ce5b5488e90ea3e2eed6df, type: 2} - - {fileID: 11400000, guid: 5efa934e009bc234e920904b05db3c2f, type: 2} - - {fileID: 11400000, guid: 8819ec8b1f4910a4494755cf043636d1, type: 2} - - {fileID: 11400000, guid: b09b79db8ef15144bb2138ec59f26a9c, type: 2} - - {fileID: 11400000, guid: 8838477f768600848813a215ab6a46fe, type: 2} - - {fileID: 11400000, guid: f0df83df3cff9d84ba9fd4895e5d1b58, type: 2} - - {fileID: 11400000, guid: 4101d48e428899d409df02f24c83571f, type: 2} - - {fileID: 11400000, guid: b01ee8334ee052b4784225337e9a5ece, type: 2} - - {fileID: 11400000, guid: a5d493c2c7c9cf74cab038023b401273, type: 2} - itemsPerPage: 8 + statueOutline: {fileID: 1325274732} gridLayout: {fileID: 699865156} --- !u!1 &483064110 GameObject: @@ -1118,8 +1108,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 86710e43de46f6f4bac7c8e50813a599, type: 3} m_Name: m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.AspectRatioFitter - m_AspectMode: 2 - m_AspectRatio: 0.71428573 + m_AspectMode: 1 + m_AspectRatio: 0.82100594 --- !u!114 &1078270176 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1291,6 +1281,96 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!1 &1325274729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1325274730} + - component: {fileID: 1325274733} + - component: {fileID: 1325274732} + - component: {fileID: 1325274731} + m_Layer: 5 + m_Name: StatueOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1325274730 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325274729} + 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: 65358845} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: -181.98193} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1325274731 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325274729} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 86710e43de46f6f4bac7c8e50813a599, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.AspectRatioFitter + m_AspectMode: 1 + m_AspectRatio: 0.8210059 +--- !u!114 &1325274732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325274729} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: -7424888634701936452, guid: 338c4323de4ff7f4c99e4c10a744e914, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1325274733 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325274729} + m_CullTransparentMesh: 1 --- !u!1 &1443594948 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Core/Settings/SettingsInterfaces.cs b/Assets/Scripts/Core/Settings/SettingsInterfaces.cs index 99f7ae15..4a68006c 100644 --- a/Assets/Scripts/Core/Settings/SettingsInterfaces.cs +++ b/Assets/Scripts/Core/Settings/SettingsInterfaces.cs @@ -168,7 +168,6 @@ namespace AppleHills.Core.Settings public interface IStatueDressupSettings { // Decoration Display - Vector2 DefaultIconSize { get; } Vector2 DefaultAuthoredSize { get; } // Decoration Content diff --git a/Assets/Scripts/Core/Settings/StatueDressupSettings.cs b/Assets/Scripts/Core/Settings/StatueDressupSettings.cs index 9038f218..1310d21b 100644 --- a/Assets/Scripts/Core/Settings/StatueDressupSettings.cs +++ b/Assets/Scripts/Core/Settings/StatueDressupSettings.cs @@ -12,9 +12,6 @@ namespace Core.Settings public class StatueDressupSettings : BaseSettings, IStatueDressupSettings { [Header("Decoration Display")] - [Tooltip("Default icon size for decorations in the menu grid")] - [SerializeField] private Vector2 defaultIconSize = new Vector2(64f, 64f); - [Tooltip("Default full size for decorations when placed on statue")] [SerializeField] private Vector2 defaultAuthoredSize = new Vector2(128f, 128f); @@ -80,7 +77,6 @@ namespace Core.Settings [SerializeField] private int maxSavedDecorations = 50; // IStatueDressupSettings implementation - Decoration Display - public Vector2 DefaultIconSize => defaultIconSize; public Vector2 DefaultAuthoredSize => defaultAuthoredSize; // IStatueDressupSettings implementation - Decoration Content @@ -120,8 +116,6 @@ namespace Core.Settings base.OnValidate(); // Validate decoration display - defaultIconSize.x = Mathf.Max(16f, defaultIconSize.x); - defaultIconSize.y = Mathf.Max(16f, defaultIconSize.y); defaultAuthoredSize.x = Mathf.Max(32f, defaultAuthoredSize.x); defaultAuthoredSize.y = Mathf.Max(32f, defaultAuthoredSize.y); diff --git a/Assets/Scripts/Minigames/StatueDressup/Controllers/DecorationMenuController.cs b/Assets/Scripts/Minigames/StatueDressup/Controllers/DecorationMenuController.cs index f6c93145..df8285a5 100644 --- a/Assets/Scripts/Minigames/StatueDressup/Controllers/DecorationMenuController.cs +++ b/Assets/Scripts/Minigames/StatueDressup/Controllers/DecorationMenuController.cs @@ -3,7 +3,6 @@ using Core; using Core.Lifecycle; using Minigames.StatueDressup.Data; using Minigames.StatueDressup.DragDrop; -using UI.DragAndDrop.Core; using UnityEngine; using UnityEngine.UI; @@ -15,21 +14,21 @@ namespace Minigames.StatueDressup.Controllers public class DecorationMenuController : ManagedBehaviour { [Header("References")] - [SerializeField] private DecorationItem itemPrefab; + [SerializeField] private DecorationGridIcon iconPrefab; + [SerializeField] private DecorationDraggableInstance draggablePrefab; [SerializeField] private Transform itemsContainer; + [SerializeField] private Transform draggableContainer; // Parent for spawned draggables [SerializeField] private Button nextPageButton; [SerializeField] private Button previousPageButton; - [SerializeField] private RectTransform statueArea; // For overlap detection - [SerializeField] private Transform statueParent; // Parent for placed decorations [SerializeField] private StatueDecorationController statueController; // Controller for registration + [SerializeField] private Image statueOutline; // Outline image shown during drag to indicate valid drop area [Header("Layout")] [SerializeField] private GridLayoutGroup gridLayout; private int _currentPage; private int _totalPages; - private List _spawnedItems = new List(); - private Dictionary _itemDataMapping = new Dictionary(); + private List _spawnedIcons = new List(); private AppleHills.Core.Settings.IStatueDressupSettings _settings; // Properties @@ -65,6 +64,12 @@ namespace Minigames.StatueDressup.Controllers return; } + // Ensure outline starts hidden + if (statueOutline != null) + { + statueOutline.gameObject.SetActive(false); + } + var allDecorations = _settings.AllDecorations; int itemsPerPage = _settings.ItemsPerPage; @@ -101,7 +106,7 @@ namespace Minigames.StatueDressup.Controllers } /// - /// Populate the current page with decoration items + /// Populate the current page with decoration icons /// private void PopulateCurrentPage() { @@ -118,19 +123,19 @@ namespace Minigames.StatueDressup.Controllers Logging.Debug($"[DecorationMenuController] Populating page {_currentPage + 1}/{_totalPages}"); - // Clear existing items - ClearItems(); + // Clear existing icons + ClearIcons(); // Calculate range for current page int startIndex = _currentPage * itemsPerPage; int endIndex = Mathf.Min(startIndex + itemsPerPage, allDecorations.Count); - Logging.Debug($"[DecorationMenuController] Spawning items {startIndex} to {endIndex - 1}"); + Logging.Debug($"[DecorationMenuController] Spawning icons {startIndex} to {endIndex - 1}"); - // Spawn items for this page + // Spawn icons for this page for (int i = startIndex; i < endIndex; i++) { - SpawnDecorationItem(allDecorations[i]); + SpawnGridIcon(allDecorations[i]); } // Update button states @@ -138,99 +143,126 @@ namespace Minigames.StatueDressup.Controllers } /// - /// Spawn a decoration item in the menu + /// Spawn a grid icon in the menu /// - private void SpawnDecorationItem(DecorationData data) + private void SpawnGridIcon(DecorationData data) { - if (itemPrefab == null || itemsContainer == null) + if (iconPrefab == null || itemsContainer == null) { - Logging.Warning("[DecorationMenuController] Missing prefab or container"); + Logging.Warning("[DecorationMenuController] Missing icon prefab or container"); return; } - DecorationItem item = Instantiate(itemPrefab, itemsContainer); - item.SetDecorationData(data); + DecorationGridIcon icon = Instantiate(iconPrefab, itemsContainer); + icon.Initialize(data, this); - // Set statue references for overlap detection - item.SetStatueArea(statueArea); - item.SetStatueParent(statueParent); - item.SetMenuParent(itemsContainer); - item.SetController(statueController); + _spawnedIcons.Add(icon); - // Store original position for return animation - if (item.RectTransform != null) - { - // Force layout update to get correct position - Canvas.ForceUpdateCanvases(); - item.SetOriginalMenuPosition(item.RectTransform.anchoredPosition); - } - - // Subscribe to drag events - item.OnDragStarted += HandleItemPickedUp; - item.OnDragEnded += HandleItemDropped; - - _spawnedItems.Add(item); - _itemDataMapping[item] = data; - - Logging.Debug($"[DecorationMenuController] Spawned: {data.DecorationName} at position {item.RectTransform?.anchoredPosition}"); + Logging.Debug($"[DecorationMenuController] Spawned icon: {data.DecorationName}"); } /// - /// Handle item picked up from menu + /// Factory method: Spawn a draggable instance at cursor position + /// Called by DecorationGridIcon when drag starts /// - private void HandleItemPickedUp(DraggableObject draggable) + public DecorationDraggableInstance SpawnDraggableInstance(DecorationData data, Vector3 screenPosition) { - if (draggable is DecorationItem item && _itemDataMapping.ContainsKey(item)) + if (draggablePrefab == null || statueController == null) { - Logging.Debug($"[DecorationMenuController] Item picked up: {item.Data?.DecorationName}"); + Logging.Warning("[DecorationMenuController] Missing draggable prefab or statue controller"); + return null; + } + + // Show statue outline + ShowStatueOutline(); + + // Determine parent - use draggableContainer if set, otherwise itemsContainer's parent + Transform parent = draggableContainer != null ? draggableContainer : itemsContainer.parent; + + // Spawn draggable instance + DecorationDraggableInstance instance = Instantiate(draggablePrefab, parent); + + // Get outline RectTransform for overlap detection + RectTransform outlineRect = statueOutline != null ? statueOutline.rectTransform : null; + + // Initialize with references + instance.Initialize( + data, + outlineRect, + statueController.StatueParent, + statueController, + _settings, + OnDraggableFinished + ); + + // Position at cursor (in local space) + Canvas canvas = GetComponentInParent(); + if (canvas != null) + { + RectTransformUtility.ScreenPointToLocalPointInRectangle( + canvas.transform as RectTransform, + screenPosition, + canvas.worldCamera, + out Vector2 localPoint); - // We'll spawn replacement only if item is actually placed, not on pickup - } - } - - /// - /// Handle item dropped (either placed on statue or returned to menu) - /// - private void HandleItemDropped(DraggableObject draggable) - { - if (draggable is DecorationItem item && _itemDataMapping.ContainsKey(item)) - { - Logging.Debug($"[DecorationMenuController] Item dropped: {item.Data?.DecorationName}, isPlacedOnStatue={item.IsPlacedOnStatue}"); - - // If item was placed on statue, spawn replacement in menu - if (item.IsPlacedOnStatue && !item.IsInMenu) + RectTransform instanceRect = instance.GetComponent(); + if (instanceRect != null) { - DecorationData data = _itemDataMapping[item]; - - // Remove original from tracking - _spawnedItems.Remove(item); - _itemDataMapping.Remove(item); - - // Spawn replacement - SpawnDecorationItem(data); - - Logging.Debug($"[DecorationMenuController] Spawned replacement for: {data.DecorationName}"); - } - } - } - - /// - /// Clear all spawned items - /// - private void ClearItems() - { - foreach (var item in _spawnedItems) - { - if (item != null) - { - item.OnDragStarted -= HandleItemPickedUp; - item.OnDragEnded -= HandleItemDropped; - Destroy(item.gameObject); + instanceRect.localPosition = localPoint; } } - _spawnedItems.Clear(); - _itemDataMapping.Clear(); + Logging.Debug($"[DecorationMenuController] Spawned draggable instance: {data.DecorationName}"); + + return instance; + } + + /// + /// Show the statue outline to indicate valid drop area + /// + private void ShowStatueOutline() + { + if (statueOutline != null) + { + statueOutline.gameObject.SetActive(true); + Logging.Debug("[DecorationMenuController] Statue outline shown"); + } + } + + /// + /// Hide the statue outline after drag ends + /// + private void HideStatueOutline() + { + if (statueOutline != null) + { + statueOutline.gameObject.SetActive(false); + Logging.Debug("[DecorationMenuController] Statue outline hidden"); + } + } + + /// + /// Callback from DecorationDraggableInstance when drag finishes + /// + private void OnDraggableFinished() + { + HideStatueOutline(); + } + + /// + /// Clear all spawned icons + /// + private void ClearIcons() + { + foreach (var icon in _spawnedIcons) + { + if (icon != null) + { + Destroy(icon.gameObject); + } + } + + _spawnedIcons.Clear(); } /// @@ -293,8 +325,8 @@ namespace Minigames.StatueDressup.Controllers previousPageButton.onClick.RemoveListener(OnPreviousPage); } - // Cleanup item listeners - ClearItems(); + // Cleanup icons + ClearIcons(); } } } diff --git a/Assets/Scripts/Minigames/StatueDressup/Controllers/StatueDecorationController.cs b/Assets/Scripts/Minigames/StatueDressup/Controllers/StatueDecorationController.cs index 0dc588d0..abd31db8 100644 --- a/Assets/Scripts/Minigames/StatueDressup/Controllers/StatueDecorationController.cs +++ b/Assets/Scripts/Minigames/StatueDressup/Controllers/StatueDecorationController.cs @@ -27,10 +27,13 @@ namespace Minigames.StatueDressup.Controllers [SerializeField] private RectTransform photoArea; // Area to capture [SerializeField] private string photoSaveKey = "MrCementStatuePhoto"; - private List _placedDecorations = new List(); + private List _placedDecorations = new List(); private bool _minigameCompleted; private AppleHills.Core.Settings.IStatueDressupSettings _settings; + // Public property for menu controller + public Transform StatueParent => statueParent; + /// /// Early initialization - get settings reference /// @@ -72,7 +75,7 @@ namespace Minigames.StatueDressup.Controllers /// /// Register a decoration as placed on statue /// - public void RegisterDecoration(DecorationItem decoration) + public void RegisterDecoration(DecorationDraggableInstance decoration) { if (decoration != null && !_placedDecorations.Contains(decoration)) { @@ -87,7 +90,7 @@ namespace Minigames.StatueDressup.Controllers /// /// Unregister a decoration (when removed) /// - public void UnregisterDecoration(DecorationItem decoration) + public void UnregisterDecoration(DecorationDraggableInstance decoration) { if (decoration != null && _placedDecorations.Contains(decoration)) { diff --git a/Assets/Scripts/Minigames/StatueDressup/Data/DecorationData.cs b/Assets/Scripts/Minigames/StatueDressup/Data/DecorationData.cs index d484106a..1177cffc 100644 --- a/Assets/Scripts/Minigames/StatueDressup/Data/DecorationData.cs +++ b/Assets/Scripts/Minigames/StatueDressup/Data/DecorationData.cs @@ -19,9 +19,6 @@ namespace Minigames.StatueDressup.Data [Tooltip("Full size when placed on statue (actual sprite size)")] [SerializeField] private Vector2 authoredSize = new Vector2(128f, 128f); - [Tooltip("Small size in menu icon")] - [SerializeField] private Vector2 iconSize = new Vector2(64f, 64f); - [Header("Progression (Optional)")] [SerializeField] private bool isUnlocked = true; @@ -30,7 +27,6 @@ namespace Minigames.StatueDressup.Data public string DecorationName => decorationName; public Sprite DecorationSprite => decorationSprite; public Vector2 AuthoredSize => authoredSize; - public Vector2 IconSize => iconSize; public bool IsUnlocked => isUnlocked; private void OnValidate() diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationDraggableInstance.cs b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationDraggableInstance.cs new file mode 100644 index 00000000..e4f2f0fb --- /dev/null +++ b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationDraggableInstance.cs @@ -0,0 +1,242 @@ +using Core; +using Minigames.StatueDressup.Controllers; +using Minigames.StatueDressup.Data; +using Minigames.StatueDressup.Utils; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace Minigames.StatueDressup.DragDrop +{ + /// + /// Draggable instance of a decoration that can be placed on the statue. + /// Created dynamically when dragging from menu or picking up from statue. + /// Destroyed if dropped outside statue area. + /// + public class DecorationDraggableInstance : MonoBehaviour + { + [Header("References")] + [SerializeField] private Image decorationImage; + [SerializeField] private CanvasGroup canvasGroup; + + private DecorationData _decorationData; + private RectTransform _rectTransform; + private Canvas _canvas; + private RectTransform _statueOutline; + private Transform _statueParent; + private StatueDecorationController _controller; + private AppleHills.Core.Settings.IStatueDressupSettings _settings; + private System.Action _onFinishedCallback; + + private bool _isDragging; + private bool _isPlacedOnStatue; + private Vector3 _dragOffset; + + // Properties + public DecorationData Data => _decorationData; + public bool IsPlacedOnStatue => _isPlacedOnStatue; + + private void Awake() + { + _rectTransform = GetComponent(); + _canvas = GetComponentInParent(); + + if (canvasGroup == null) + { + canvasGroup = gameObject.AddComponent(); + } + } + + /// + /// Initialize the draggable instance + /// + public void Initialize(DecorationData data, RectTransform statueOutline, Transform statueParent, + StatueDecorationController controller, AppleHills.Core.Settings.IStatueDressupSettings settings, + System.Action onFinishedCallback) + { + _decorationData = data; + _statueOutline = statueOutline; + _statueParent = statueParent; + _controller = controller; + _settings = settings; + _onFinishedCallback = onFinishedCallback; + + // Set sprite + if (decorationImage != null && data != null && data.DecorationSprite != null) + { + decorationImage.sprite = data.DecorationSprite; + } + + // Set authored size + if (_rectTransform != null && data != null) + { + _rectTransform.sizeDelta = data.AuthoredSize; + } + + Logging.Debug($"[DecorationDraggableInstance] Initialized: {data?.DecorationName}"); + } + + /// + /// Start dragging from icon + /// + public void StartDragFromIcon(PointerEventData eventData) + { + _isDragging = true; + + // Calculate offset from cursor to object center + RectTransformUtility.ScreenPointToLocalPointInRectangle( + _canvas.transform as RectTransform, + eventData.position, + eventData.pressEventCamera, + out Vector2 localPoint); + + _dragOffset = _rectTransform.localPosition - (Vector3)localPoint; + + Logging.Debug($"[DecorationDraggableInstance] Started drag from icon: {_decorationData?.DecorationName}"); + } + + /// + /// Continue dragging + /// + public void ContinueDrag(PointerEventData eventData) + { + if (!_isDragging) return; + + // Update position to follow cursor + RectTransformUtility.ScreenPointToLocalPointInRectangle( + _canvas.transform as RectTransform, + eventData.position, + eventData.pressEventCamera, + out Vector2 localPoint); + + _rectTransform.localPosition = localPoint + (Vector2)_dragOffset; + } + + /// + /// End drag - check placement + /// + public void EndDrag(PointerEventData eventData) + { + _isDragging = false; + + Logging.Debug($"[DecorationDraggableInstance] Drag ended: {_decorationData?.DecorationName}"); + + // Check if overlapping with statue + if (IsOverlappingStatue()) + { + PlaceOnStatue(); + } + else + { + PlayPopOutAndDestroy(); + } + } + + /// + /// Check if item overlaps with statue outline + /// + private bool IsOverlappingStatue() + { + if (_statueOutline == null || _rectTransform == null) + { + Logging.Warning($"[DecorationDraggableInstance] Cannot check overlap - statueOutline or RectTransform is null"); + return false; + } + + // Get bounds of this item in world space + Rect itemRect = GetWorldRect(_rectTransform); + Rect outlineRect = GetWorldRect(_statueOutline); + + // Check for any overlap + bool overlaps = itemRect.Overlaps(outlineRect); + + Logging.Debug($"[DecorationDraggableInstance] Overlap check: {_decorationData?.DecorationName}, overlaps={overlaps}"); + + return overlaps; + } + + /// + /// Get world space rect for a RectTransform + /// + private Rect GetWorldRect(RectTransform rectTransform) + { + Vector3[] corners = new Vector3[4]; + rectTransform.GetWorldCorners(corners); + + Vector3 bottomLeft = corners[0]; + Vector3 topRight = corners[2]; + + return new Rect(bottomLeft.x, bottomLeft.y, topRight.x - bottomLeft.x, topRight.y - bottomLeft.y); + } + + /// + /// Place item on statue at current position + /// + private void PlaceOnStatue() + { + Logging.Debug($"[DecorationDraggableInstance] Placing on statue: {_decorationData?.DecorationName}"); + + _isPlacedOnStatue = true; + + // Move to statue parent if specified + if (_statueParent != null && transform.parent != _statueParent) + { + transform.SetParent(_statueParent, true); // Keep world position + } + + // Register with controller + if (_controller != null) + { + _controller.RegisterDecoration(this); + } + + // Notify menu controller to hide outline + _onFinishedCallback?.Invoke(); + } + + /// + /// Play pop-out animation and destroy + /// + private void PlayPopOutAndDestroy() + { + Logging.Debug($"[DecorationDraggableInstance] Pop-out and destroy: {_decorationData?.DecorationName}"); + + // Notify menu controller to hide outline immediately + _onFinishedCallback?.Invoke(); + + float duration = _settings?.PlacementAnimationDuration ?? 0.3f; + + // Play pop-out with fade animation + TweenAnimationUtility.PopOutWithFade(transform, canvasGroup, duration, () => + { + Destroy(gameObject); + }); + } + + /// + /// Allow picking up from statue for repositioning + /// + public void StartDragFromStatue(Vector3 pointerPosition) + { + if (_controller != null) + { + _controller.UnregisterDecoration(this); + } + + _isPlacedOnStatue = false; + _isDragging = true; + + // Calculate offset + RectTransformUtility.ScreenPointToLocalPointInRectangle( + _canvas.transform as RectTransform, + pointerPosition, + null, + out Vector2 localPoint); + + _dragOffset = _rectTransform.localPosition - (Vector3)localPoint; + + Logging.Debug($"[DecorationDraggableInstance] Started drag from statue: {_decorationData?.DecorationName}"); + } + } +} + diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationDraggableInstance.cs.meta b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationDraggableInstance.cs.meta new file mode 100644 index 00000000..ab89e5a6 --- /dev/null +++ b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationDraggableInstance.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e4659fd035c74a79af0311de9e17f44a +timeCreated: 1763991638 \ No newline at end of file diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationGridIcon.cs b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationGridIcon.cs new file mode 100644 index 00000000..d26874f4 --- /dev/null +++ b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationGridIcon.cs @@ -0,0 +1,100 @@ +using Core; +using Minigames.StatueDressup.Data; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace Minigames.StatueDressup.DragDrop +{ + /// + /// Static grid icon for decorations in the menu. + /// Handles tap and drag initiation, but doesn't move itself. + /// Spawns a draggable instance when drag starts. + /// + public class DecorationGridIcon : MonoBehaviour, IPointerClickHandler, IBeginDragHandler, IDragHandler, IEndDragHandler + { + [Header("References")] + [SerializeField] private Image iconImage; + [SerializeField] private DecorationData decorationData; + + private Controllers.DecorationMenuController _menuController; + private DecorationDraggableInstance _activeDraggableInstance; + + // Properties + public DecorationData Data => decorationData; + + /// + /// Initialize the icon with decoration data + /// + public void Initialize(DecorationData data, Controllers.DecorationMenuController controller) + { + decorationData = data; + _menuController = controller; + + if (iconImage != null && data != null && data.DecorationSprite != null) + { + iconImage.sprite = data.DecorationSprite; + } + } + + /// + /// Handle tap/click on icon + /// + public void OnPointerClick(PointerEventData eventData) + { + // Only process clicks if we're not dragging + if (_activeDraggableInstance == null) + { + Logging.Debug($"[DecorationGridIcon] Item tapped: {decorationData?.DecorationName}"); + // Future: Open detail view, preview, etc. + } + } + + /// + /// Handle drag start - spawn draggable instance + /// + public void OnBeginDrag(PointerEventData eventData) + { + if (_menuController == null || decorationData == null) + { + Logging.Warning("[DecorationGridIcon] Cannot start drag - missing controller or data"); + return; + } + + Logging.Debug($"[DecorationGridIcon] Starting drag for: {decorationData.DecorationName}"); + + // Spawn draggable instance at cursor position + _activeDraggableInstance = _menuController.SpawnDraggableInstance(decorationData, eventData.position); + + // Start the drag on the spawned instance + if (_activeDraggableInstance != null) + { + _activeDraggableInstance.StartDragFromIcon(eventData); + } + } + + /// + /// Forward drag events to the active draggable instance + /// + public void OnDrag(PointerEventData eventData) + { + if (_activeDraggableInstance != null) + { + _activeDraggableInstance.ContinueDrag(eventData); + } + } + + /// + /// Forward drag end to the active draggable instance + /// + public void OnEndDrag(PointerEventData eventData) + { + if (_activeDraggableInstance != null) + { + _activeDraggableInstance.EndDrag(eventData); + _activeDraggableInstance = null; + } + } + } +} + diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationGridIcon.cs.meta b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationGridIcon.cs.meta new file mode 100644 index 00000000..6a273f13 --- /dev/null +++ b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationGridIcon.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9c806d80a321498c9f33f13d7a31065c +timeCreated: 1763991611 \ No newline at end of file diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationItem.cs b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationItem.cs deleted file mode 100644 index 5dbb5fa6..00000000 --- a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationItem.cs +++ /dev/null @@ -1,288 +0,0 @@ -using Core; -using Minigames.StatueDressup.Controllers; -using Minigames.StatueDressup.Data; -using Minigames.StatueDressup.Utils; -using UI.DragAndDrop.Core; -using UnityEngine; -using UnityEngine.UI; - -namespace Minigames.StatueDressup.DragDrop -{ - /// - /// Individual decoration item that can be dragged from menu to statue - /// Uses overlap detection instead of slot-based placement - /// - public class DecorationItem : DraggableObject - { - [Header("Decoration Data")] - [SerializeField] private DecorationData decorationData; - [SerializeField] private Image decorationImage; - - [Header("Placement")] - [SerializeField] private RectTransform statueArea; // Reference to statue area for overlap check - - private Vector2 _iconSize; - private Vector2 _authoredSize; - private Vector2 _originalMenuPosition; - private Vector2 _placedPosition; // Position when placed on statue - private bool _isInMenu = true; - private bool _isPlacedOnStatue = false; - private Transform _menuParent; // Original parent in menu - private Transform _statueParent; // Parent when placed on statue - private StatueDecorationController _controller; // Controller for registration - private AppleHills.Core.Settings.IStatueDressupSettings _settings; // Settings reference - - // Properties - public DecorationData Data => decorationData; - public bool IsInMenu => _isInMenu; - public bool IsPlacedOnStatue => _isPlacedOnStatue; - - protected override void Initialize() - { - base.Initialize(); - - // Get settings - _settings = GameManager.GetSettingsObject(); - - // Store menu parent - _menuParent = transform.parent; - - // Find statue parent (will be set by controller) - // statueParent will be assigned externally - - if (decorationData != null) - { - _iconSize = decorationData.IconSize; - _authoredSize = decorationData.AuthoredSize; - - // Set initial icon size - if (RectTransform != null) - { - RectTransform.sizeDelta = _iconSize; - } - - // Set sprite - if (decorationImage != null && decorationData.DecorationSprite != null) - { - decorationImage.sprite = decorationData.DecorationSprite; - } - } - - // Store original menu position - if (RectTransform != null) - { - _originalMenuPosition = RectTransform.anchoredPosition; - } - } - - /// - /// Set decoration data (for spawned instances) - /// - public void SetDecorationData(DecorationData data) - { - decorationData = data; - - if (data != null) - { - _iconSize = data.IconSize; - _authoredSize = data.AuthoredSize; - - // Update visual - if (decorationImage != null && data.DecorationSprite != null) - { - decorationImage.sprite = data.DecorationSprite; - } - - // Set icon size - if (RectTransform != null) - { - RectTransform.sizeDelta = _iconSize; - } - - Logging.Debug($"[DecorationItem] Set data: {data.DecorationName}, iconSize={_iconSize}, authoredSize={_authoredSize}"); - } - } - - /// - /// Set statue area reference for overlap detection - /// - public void SetStatueArea(RectTransform statue) - { - statueArea = statue; - } - - /// - /// Set statue parent for placing items - /// - public void SetStatueParent(Transform parent) - { - _statueParent = parent; - } - - /// - /// Set controller for registration callbacks - /// - public void SetController(StatueDecorationController controller) - { - _controller = controller; - } - - protected override void OnDragStartedHook() - { - Logging.Debug($"[DecorationItem] OnDragStarted: {decorationData?.DecorationName}"); - - // If picking up from statue, allow re-positioning - if (_isPlacedOnStatue) - { - _isPlacedOnStatue = false; - Logging.Debug($"[DecorationItem] Picking up from statue for re-positioning"); - } - - // Scale to authored size when dragging starts - if (RectTransform != null) - { - // Smoothly transition from icon size to authored size - RectTransform.sizeDelta = _authoredSize; - float duration = _settings?.DragScaleTransitionDuration ?? 0.2f; - TweenAnimationUtility.AnimateScale(transform, Vector3.one, duration); - } - } - - protected override void OnDragEndedHook() - { - Logging.Debug($"[DecorationItem] OnDragEnded: {decorationData?.DecorationName}"); - - // Check if overlapping with statue - if (IsOverlappingStatue()) - { - PlaceOnStatue(); - } - else - { - ReturnToMenu(); - } - } - - /// - /// Check if item overlaps with statue area - /// - private bool IsOverlappingStatue() - { - if (statueArea == null || RectTransform == null) - { - Logging.Warning($"[DecorationItem] Cannot check overlap - statueArea or RectTransform is null"); - return false; - } - - // Get bounds of this item in world space - Rect itemRect = GetWorldRect(RectTransform); - Rect statueRect = GetWorldRect(statueArea); - - // Check for any overlap - bool overlaps = itemRect.Overlaps(statueRect); - - Logging.Debug($"[DecorationItem] Overlap check: {decorationData?.DecorationName}, overlaps={overlaps}"); - Logging.Debug($"[DecorationItem] Item rect: {itemRect}, Statue rect: {statueRect}"); - - return overlaps; - } - - /// - /// Get world space rect for a RectTransform - /// - private Rect GetWorldRect(RectTransform rectTransform) - { - Vector3[] corners = new Vector3[4]; - rectTransform.GetWorldCorners(corners); - - Vector3 bottomLeft = corners[0]; - Vector3 topRight = corners[2]; - - return new Rect(bottomLeft.x, bottomLeft.y, topRight.x - bottomLeft.x, topRight.y - bottomLeft.y); - } - - /// - /// Place item on statue at current position - /// - private void PlaceOnStatue() - { - Logging.Debug($"[DecorationItem] Placing on statue: {decorationData?.DecorationName}"); - - _isInMenu = false; - _isPlacedOnStatue = true; - - // Store current position - if (RectTransform != null) - { - _placedPosition = RectTransform.anchoredPosition; - } - - // Move to statue parent if specified - if (_statueParent != null && transform.parent != _statueParent) - { - transform.SetParent(_statueParent, true); // Keep world position - } - - // Register with controller - if (_controller != null) - { - _controller.RegisterDecoration(this); - } - - // Keep authored size - // Position is already set by drag - } - - /// - /// Return item to menu with animation - /// - private void ReturnToMenu() - { - Logging.Debug($"[DecorationItem] Returning to menu: {decorationData?.DecorationName}"); - - // Unregister from controller if was placed on statue - if (_isPlacedOnStatue && _controller != null) - { - _controller.UnregisterDecoration(this); - } - - _isInMenu = true; - _isPlacedOnStatue = false; - - // Return to menu parent - if (_menuParent != null && transform.parent != _menuParent) - { - transform.SetParent(_menuParent, false); // Use local positioning - } - - if (RectTransform != null) - { - // Animate back to icon size - RectTransform.sizeDelta = _iconSize; - float scaleDuration = _settings?.DragScaleTransitionDuration ?? 0.2f; - TweenAnimationUtility.AnimateScale(transform, Vector3.one, scaleDuration); - - // Animate back to original position - float returnDuration = _settings?.ReturnToMenuDuration ?? 0.3f; - TweenAnimationUtility.AnimateAnchoredPosition(RectTransform, _originalMenuPosition, returnDuration); - } - } - - /// - /// Set original menu position (called by menu controller) - /// - public void SetOriginalMenuPosition(Vector2 position) - { - _originalMenuPosition = position; - } - - /// - /// Set menu parent (called by menu controller) - /// - public void SetMenuParent(Transform parent) - { - _menuParent = parent; - } - } -} - diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationItem.cs.meta b/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationItem.cs.meta deleted file mode 100644 index 49d3682a..00000000 --- a/Assets/Scripts/Minigames/StatueDressup/DragDrop/DecorationItem.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 31a82dde0ffb439e86b79499b9daa92b -timeCreated: 1763745531 \ No newline at end of file diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/StatueDecorationSlot.cs b/Assets/Scripts/Minigames/StatueDressup/DragDrop/StatueDecorationSlot.cs deleted file mode 100644 index 1d5e70a1..00000000 --- a/Assets/Scripts/Minigames/StatueDressup/DragDrop/StatueDecorationSlot.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Core; -using Minigames.StatueDressup.Data; -using Minigames.StatueDressup.Utils; -using UI.DragAndDrop.Core; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace Minigames.StatueDressup.DragDrop -{ - /// - /// Slot on the statue where decorations can be placed - /// - public class StatueDecorationSlot : DraggableSlot, IPointerEnterHandler, IPointerExitHandler - { - [Header("Slot Configuration")] - [SerializeField] private bool isPermanent = true; // Can't remove once placed - - [Header("Glow Effect")] - [SerializeField] private GameObject glowEffect; - [SerializeField] private float glowPulseAmount = 1.1f; - [SerializeField] private float glowPulseDuration = 0.8f; - - private bool _isGlowing; - private Pixelplacement.TweenSystem.TweenBase _glowTween; - - public bool IsPermanent => isPermanent; - - private void Start() - { - // Hide glow effect initially - if (glowEffect != null) - { - glowEffect.SetActive(false); - } - } - - public new void OnPointerEnter(PointerEventData eventData) - { - // Only glow when dragging a matching decoration - if (eventData.pointerDrag != null) - { - var decoration = eventData.pointerDrag.GetComponent(); - if (decoration != null && !IsOccupied) - { - StartGlow(); - } - } - } - - public new void OnPointerExit(PointerEventData eventData) - { - StopGlow(); - } - - /// - /// Start glow effect - /// - private void StartGlow() - { - if (_isGlowing || glowEffect == null) - return; - - _isGlowing = true; - glowEffect.SetActive(true); - - Logging.Debug($"[StatueDecorationSlot] Starting glow on {name}"); - - // Pulse animation - _glowTween = TweenAnimationUtility.StartGlowPulse(glowEffect.transform, glowPulseAmount, glowPulseDuration); - } - - /// - /// Stop glow effect - /// - private void StopGlow() - { - if (!_isGlowing || glowEffect == null) - return; - - _isGlowing = false; - - Logging.Debug($"[StatueDecorationSlot] Stopping glow on {name}"); - - // Stop pulse animation - if (_glowTween != null) - { - TweenAnimationUtility.StopTweens(glowEffect.transform); - _glowTween = null; - } - - glowEffect.SetActive(false); - } - - /// - /// Override to check category matching (uses base CanAccept) - /// - public new bool CanAccept(DraggableObject draggable) - { - // First check base conditions - return base.CanAccept(draggable); - } - - private void OnDisable() - { - // Clean up glow on disable - StopGlow(); - } - } -} - diff --git a/Assets/Scripts/Minigames/StatueDressup/DragDrop/StatueDecorationSlot.cs.meta b/Assets/Scripts/Minigames/StatueDressup/DragDrop/StatueDecorationSlot.cs.meta deleted file mode 100644 index a9fbb317..00000000 --- a/Assets/Scripts/Minigames/StatueDressup/DragDrop/StatueDecorationSlot.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f68e3749518141b6bc818938dd8dc57d -timeCreated: 1763745550 \ No newline at end of file diff --git a/Assets/Scripts/Minigames/StatueDressup/Utils/TweenAnimationUtility.cs b/Assets/Scripts/Minigames/StatueDressup/Utils/TweenAnimationUtility.cs index 2326941c..50699db0 100644 --- a/Assets/Scripts/Minigames/StatueDressup/Utils/TweenAnimationUtility.cs +++ b/Assets/Scripts/Minigames/StatueDressup/Utils/TweenAnimationUtility.cs @@ -145,6 +145,26 @@ namespace Minigames.StatueDressup.Utils return Tween.CanvasGroupAlpha(canvasGroup, targetAlpha, duration, 0f, Tween.EaseInOut, completeCallback: onComplete); } + /// + /// Pop-out with fade - scale to 0 and fade out simultaneously + /// + public static void PopOutWithFade(Transform transform, CanvasGroup canvasGroup, float duration, Action onComplete = null) + { + // Scale to 0 + Tween.LocalScale(transform, Vector3.zero, duration, 0f, Tween.EaseInBack); + + // Fade out simultaneously + if (canvasGroup != null) + { + Tween.CanvasGroupAlpha(canvasGroup, 0f, duration, 0f, Tween.EaseInOut, completeCallback: onComplete); + } + else + { + // If no canvas group, just call complete after scale + Tween.LocalScale(transform, Vector3.zero, duration, 0f, Tween.EaseInBack, completeCallback: onComplete); + } + } + #endregion } }