Finalize the cursed work
This commit is contained in:
@@ -15,6 +15,6 @@ MonoBehaviour:
|
||||
targetLevelSceneName: StatueDecoration
|
||||
targetMinigameSceneName:
|
||||
description: Level loading for Quarry
|
||||
mapSprite: {fileID: 3001265211797695019, guid: afdc182c0c32e8f4c9ab04187ea11042, type: 3}
|
||||
mapSprite: {fileID: -9176826819293939900, guid: 7b00cd0000ef4424985cd21fb4f197ee, type: 3}
|
||||
menuSprite: {fileID: 6629659431539980573, guid: 965b29ed7760d9442b031ee4190b49d4, type: 3}
|
||||
minigameMenuSprite: {fileID: 6629659431539980573, guid: 965b29ed7760d9442b031ee4190b49d4, type: 3}
|
||||
|
||||
@@ -34,8 +34,8 @@ RectTransform:
|
||||
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_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
|
||||
@@ -1976,6 +1976,96 @@ BoxCollider2D:
|
||||
m_AutoTiling: 0
|
||||
m_Size: {x: 20.1, y: 10.9}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!1 &831113524
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 831113525}
|
||||
- component: {fileID: 831113526}
|
||||
m_Layer: 10
|
||||
m_Name: MinigameIcon
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &831113525
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 831113524}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -2.83, z: 0}
|
||||
m_LocalScale: {x: 1.9999999, y: 1.9999999, z: 1.9999999}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1460027142}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &831113526
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 831113524}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: -9176826819293939900, guid: 7b00cd0000ef4424985cd21fb4f197ee, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 5.55, y: 6.76}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &948124904
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2890,37 +2980,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1292467736
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1292467737}
|
||||
m_Layer: 10
|
||||
m_Name: DecorationsRoot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1292467737
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1292467736}
|
||||
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: 1460027142}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &1298174946 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5179840719513743426, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
@@ -3026,6 +3085,10 @@ PrefabInstance:
|
||||
propertyPath: switchData
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: f2a2529c094015a4f974b2ec0c12cc70, type: 2}
|
||||
- target: {fileID: 634188539509474598, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: iconRenderer
|
||||
value:
|
||||
objectReference: {fileID: 831113526}
|
||||
- target: {fileID: 634188539509474598, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: startUnlocked
|
||||
value: 1
|
||||
@@ -3033,22 +3096,22 @@ PrefabInstance:
|
||||
- target: {fileID: 4080194752436190636, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 3001265211797695019, guid: afdc182c0c32e8f4c9ab04187ea11042, type: 3}
|
||||
objectReference: {fileID: -9176826819293939900, guid: 7b00cd0000ef4424985cd21fb4f197ee, type: 3}
|
||||
- target: {fileID: 4080194752436190636, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1.19
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.19
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1.19
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -3094,26 +3157,31 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: StatueDecoration
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8766058064105819536, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_SpriteTilingProperty.pivot.y
|
||||
value: 0.25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8766058064105819536, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_SpriteTilingProperty.oldSize.x
|
||||
value: 9.62
|
||||
value: 5.55
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8766058064105819536, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
propertyPath: m_SpriteTilingProperty.oldSize.y
|
||||
value: 11.09
|
||||
value: 6.76
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedComponents:
|
||||
- {fileID: 4080194752436190636, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 831113525}
|
||||
- targetCorrespondingSourceObject: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 2011577938}
|
||||
- targetCorrespondingSourceObject: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1253055066}
|
||||
- targetCorrespondingSourceObject: {fileID: 5727794563305583620, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1292467737}
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 7404622075362872657, guid: f44866deaba5f5c4a90f0330dd9957f0, type: 3}
|
||||
insertIndex: -1
|
||||
@@ -3136,8 +3204,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 50d0f4591bbd40fc81dc615fa465e0c5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Minigames.StatueDressup.Display.StatueDecorationLoader
|
||||
decorationDataLabel: StatueDecorations
|
||||
decorationRoot: {fileID: 1292467737}
|
||||
statueSpriteRenderer: {fileID: 831113526}
|
||||
specificPhotoId:
|
||||
showDebugInfo: 1
|
||||
--- !u!4 &1572710089 stripped
|
||||
@@ -4328,15 +4395,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1.27
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.27
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1.27
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -4382,9 +4449,17 @@ PrefabInstance:
|
||||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8998003315986923927, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8998003315986923927, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8998003315986923927, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -4708,10 +4783,18 @@ PrefabInstance:
|
||||
propertyPath: m_SpriteSortPoint
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1206042899194397164, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1206042899194397164, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1206042899194397164, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1206042899194397164, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SpriteSortPoint
|
||||
value: 1
|
||||
@@ -4868,6 +4951,18 @@ PrefabInstance:
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 79.258865
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2074821438325188578, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.9999619
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2074821438325188578, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0.008727774
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2074821438325188578, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2081598347110629021, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
@@ -4912,6 +5007,14 @@ PrefabInstance:
|
||||
propertyPath: m_SpriteSortPoint
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2186954516187312013, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2186954516187312013, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2210348022821117290, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
@@ -4920,10 +5023,18 @@ PrefabInstance:
|
||||
propertyPath: m_SortingOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2221055336274118641, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2221055336274118641, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2221055336274118641, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2254105400590012662, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -36.830997
|
||||
@@ -5100,9 +5211,17 @@ PrefabInstance:
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -3.255498
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3320920075436016561, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3320920075436016561, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3320920075436016561, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3322923094593524188, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
@@ -5248,10 +5367,18 @@ PrefabInstance:
|
||||
propertyPath: m_SpriteSortPoint
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3897832075439863271, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3897832075439863271, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3897832075439863271, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3897832075439863271, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SpriteSortPoint
|
||||
value: 1
|
||||
@@ -5300,10 +5427,18 @@ PrefabInstance:
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -7.760247
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4153523515925215521, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4153523515925215521, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4153523515925215521, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4162192578336450225, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
@@ -5860,10 +5995,18 @@ PrefabInstance:
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6961455400696245873, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6961455400696245873, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6961455400696245873, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SortingLayerID
|
||||
value: 622133659
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6961455400696245873, guid: 4c8aa6e55c410284aaa57c461eba5bdf, type: 3}
|
||||
propertyPath: m_SpriteSortPoint
|
||||
value: 1
|
||||
|
||||
@@ -552,14 +552,13 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1078270174}
|
||||
- {fileID: 1325274730}
|
||||
- {fileID: 166400579}
|
||||
- {fileID: 2147347253}
|
||||
m_Father: {fileID: 1443594949}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 500, y: -327}
|
||||
m_SizeDelta: {x: 1000, y: 1400}
|
||||
m_SizeDelta: {x: 1000, y: 1218}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &65358847
|
||||
CanvasRenderer:
|
||||
@@ -780,17 +779,17 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 166400578}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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_Father: {fileID: 1078270174}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &167351357
|
||||
GameObject:
|
||||
@@ -1500,11 +1499,6 @@ MonoBehaviour:
|
||||
previousPageButton: {fileID: 0}
|
||||
nextPageButton: {fileID: 0}
|
||||
pageStatusText: {fileID: 0}
|
||||
itemsPerPage: 20
|
||||
thumbnailSize: 256
|
||||
maxCachedThumbnails: 50
|
||||
enlargedScale: 2.5
|
||||
animationDuration: 0.3
|
||||
--- !u!1 &699865154
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1915,7 +1909,8 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 166400579}
|
||||
m_Father: {fileID: 65358845}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -2747,15 +2742,12 @@ MonoBehaviour:
|
||||
menuController: {fileID: 403667980}
|
||||
takePhotoButton: {fileID: 37633367}
|
||||
statue: {fileID: 1078270173}
|
||||
draggablePrefab: {fileID: 8998709565229564215, guid: 064cd4d021ea13e47860a59bbe8224aa, type: 3}
|
||||
playAreaPage: {fileID: 0}
|
||||
photoGalleryPage: {fileID: 0}
|
||||
openGalleryButton: {fileID: 0}
|
||||
uiElementsToHideForPhoto: []
|
||||
additionalElementsToHideForCutout:
|
||||
- {fileID: 483064110}
|
||||
- {fileID: 403667977}
|
||||
photoArea: {fileID: 65358845}
|
||||
photoSaveKey: MrCementStatuePhoto
|
||||
--- !u!4 &1647993459
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Levels
|
||||
/// </summary>
|
||||
[SerializeField] private bool startUnlocked = false;
|
||||
|
||||
private SpriteRenderer iconRenderer;
|
||||
[SerializeField] private SpriteRenderer iconRenderer;
|
||||
private IInteractionSettings interactionSettings;
|
||||
private bool isUnlocked;
|
||||
|
||||
|
||||
@@ -315,6 +315,7 @@ namespace Minigames.StatueDressup.Controllers
|
||||
{
|
||||
if (decoration == null || decoration.Data == null) continue;
|
||||
|
||||
RectTransform rectTransform = decoration.GetComponent<RectTransform>();
|
||||
SpriteRenderer spriteRenderer = decoration.GetComponent<SpriteRenderer>();
|
||||
|
||||
DecorationPlacement placement = new DecorationPlacement
|
||||
@@ -322,6 +323,7 @@ namespace Minigames.StatueDressup.Controllers
|
||||
decorationId = decoration.Data.DecorationId,
|
||||
localPosition = decoration.transform.localPosition,
|
||||
localScale = decoration.transform.localScale,
|
||||
sizeDelta = rectTransform != null ? rectTransform.sizeDelta : Vector2.zero,
|
||||
rotation = decoration.transform.eulerAngles.z,
|
||||
sortingOrder = spriteRenderer != null ? spriteRenderer.sortingOrder : 0
|
||||
};
|
||||
@@ -430,6 +432,16 @@ namespace Minigames.StatueDressup.Controllers
|
||||
instance.transform.localScale = placement.localScale;
|
||||
instance.transform.localEulerAngles = new Vector3(0, 0, placement.rotation);
|
||||
|
||||
// Apply saved sizeDelta if available (overrides AuthoredSize from InitializeAsPlaced)
|
||||
if (placement.sizeDelta != Vector2.zero)
|
||||
{
|
||||
RectTransform rectTransform = instance.GetComponent<RectTransform>();
|
||||
if (rectTransform != null)
|
||||
{
|
||||
rectTransform.sizeDelta = placement.sizeDelta;
|
||||
}
|
||||
}
|
||||
|
||||
// Set sorting order if has SpriteRenderer
|
||||
SpriteRenderer spriteRenderer = instance.GetComponent<SpriteRenderer>();
|
||||
if (spriteRenderer != null)
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Minigames.StatueDressup.Data
|
||||
public string decorationId; // Unique ID to load decoration
|
||||
public Vector2 localPosition; // Position relative to statue
|
||||
public Vector2 localScale; // Scale relative to statue
|
||||
public Vector2 sizeDelta; // UI RectTransform size (for UI decorations)
|
||||
public float rotation; // Z rotation in degrees
|
||||
public int sortingOrder; // Sprite sorting order
|
||||
}
|
||||
|
||||
@@ -13,45 +13,39 @@ namespace Minigames.StatueDressup.Display
|
||||
/// Place this component on a GameObject with a SpriteRenderer showing the statue.
|
||||
/// On Start, loads all DecorationData via Addressables label, then spawns decorations from metadata.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(SpriteRenderer))]
|
||||
public class StatueDecorationLoader : ManagedBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
[Tooltip("Root GameObject for spawning decorations (clears only this, not statue children)")]
|
||||
[SerializeField] private Transform decorationRoot;
|
||||
[SerializeField] private SpriteRenderer statueSpriteRenderer;
|
||||
|
||||
[Tooltip("Load specific photo ID, or leave empty to load latest")]
|
||||
[SerializeField] private string specificPhotoId = "";
|
||||
|
||||
[Tooltip("Apply pivot offset to position decorations relative to sprite's visual center instead of pivot point")]
|
||||
[SerializeField] private bool applyPivotOffset = true;
|
||||
|
||||
[Header("Debug")]
|
||||
[SerializeField] private bool showDebugInfo = true;
|
||||
|
||||
private SpriteRenderer _statueSpriteRenderer;
|
||||
private Dictionary<string, DecorationData> _decorationDataDict;
|
||||
private AsyncOperationHandle<IList<DecorationData>> _decorationDataHandle;
|
||||
private AppleHills.Core.Settings.IStatueDressupSettings _settings;
|
||||
private Dictionary<string, DecorationData> decorationDataDict;
|
||||
private AsyncOperationHandle<IList<DecorationData>> decorationDataHandle;
|
||||
private AppleHills.Core.Settings.IStatueDressupSettings settings;
|
||||
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
base.OnManagedStart();
|
||||
|
||||
_statueSpriteRenderer = GetComponent<SpriteRenderer>();
|
||||
if (statueSpriteRenderer == null)
|
||||
statueSpriteRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
if (statueSpriteRenderer == null)
|
||||
{
|
||||
Logging.Error("[StatueDecorationLoader] No SpriteRenderer found! Please assign statueSpriteRenderer.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get settings
|
||||
_settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IStatueDressupSettings>();
|
||||
|
||||
// Ensure decoration root exists
|
||||
if (decorationRoot == null)
|
||||
{
|
||||
GameObject rootObj = new GameObject("DecorationRoot");
|
||||
rootObj.transform.SetParent(transform, false);
|
||||
decorationRoot = rootObj.transform;
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug("[StatueDecorationLoader] Created decoration root automatically");
|
||||
}
|
||||
}
|
||||
settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IStatueDressupSettings>();
|
||||
|
||||
// Start async loading via coroutine wrapper
|
||||
StartCoroutine(LoadAndDisplayDecorationsCoroutine());
|
||||
@@ -87,7 +81,7 @@ namespace Minigames.StatueDressup.Display
|
||||
/// </summary>
|
||||
private async System.Threading.Tasks.Task LoadDecorationDataAsync()
|
||||
{
|
||||
string label = _settings?.DecorationDataLabel;
|
||||
string label = settings?.DecorationDataLabel;
|
||||
|
||||
if (string.IsNullOrEmpty(label))
|
||||
{
|
||||
@@ -107,12 +101,12 @@ namespace Minigames.StatueDressup.Display
|
||||
progress => { /* Optional: could show loading bar */ }
|
||||
);
|
||||
|
||||
_decorationDataDict = result.dictionary;
|
||||
_decorationDataHandle = result.handle;
|
||||
decorationDataDict = result.dictionary;
|
||||
decorationDataHandle = result.handle;
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] Loaded {_decorationDataDict.Count} DecorationData assets");
|
||||
Logging.Debug($"[StatueDecorationLoader] Loaded {decorationDataDict.Count} DecorationData assets");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +116,7 @@ namespace Minigames.StatueDressup.Display
|
||||
public void LoadAndDisplayDecorations()
|
||||
{
|
||||
// Check if DecorationData is loaded
|
||||
if (_decorationDataDict == null || _decorationDataDict.Count == 0)
|
||||
if (decorationDataDict == null || decorationDataDict.Count == 0)
|
||||
{
|
||||
Logging.Warning("[StatueDecorationLoader] DecorationData not loaded yet. Cannot display decorations.");
|
||||
return;
|
||||
@@ -149,13 +143,13 @@ namespace Minigames.StatueDressup.Display
|
||||
ClearDecorations();
|
||||
|
||||
// Calculate coordinate conversion factor if needed
|
||||
float conversionFactor = CalculateCoordinateConversion(data);
|
||||
float conversionFactor = CalculateCoordinateConversion(data, out Vector2 targetStatueWorldSize);
|
||||
|
||||
// Spawn each decoration synchronously (data already loaded)
|
||||
int successCount = 0;
|
||||
foreach (var placement in data.placements)
|
||||
{
|
||||
if (SpawnDecoration(placement, conversionFactor))
|
||||
if (SpawnDecoration(placement, conversionFactor, data.sourceStatueSize, targetStatueWorldSize))
|
||||
{
|
||||
successCount++;
|
||||
}
|
||||
@@ -170,7 +164,7 @@ namespace Minigames.StatueDressup.Display
|
||||
/// <summary>
|
||||
/// Calculate coordinate conversion factor between source and target coordinate systems
|
||||
/// </summary>
|
||||
private float CalculateCoordinateConversion(StatueDecorationData data)
|
||||
private float CalculateCoordinateConversion(StatueDecorationData data, out Vector2 targetStatueWorldSize)
|
||||
{
|
||||
// If source was world space and we're also world space, no conversion needed
|
||||
if (data.coordinateSystem == CoordinateSystemType.WorldSpace)
|
||||
@@ -179,29 +173,32 @@ namespace Minigames.StatueDressup.Display
|
||||
{
|
||||
Logging.Debug("[StatueDecorationLoader] No coordinate conversion needed (WorldSpace → WorldSpace)");
|
||||
}
|
||||
targetStatueWorldSize = Vector2.one;
|
||||
return 1f;
|
||||
}
|
||||
|
||||
// Source was UI RectTransform (pixels), target is WorldSpace (units)
|
||||
// Need to convert from source statue pixel size to target statue world size
|
||||
// Need to convert from source statue pixel size to target statue VISUAL world size
|
||||
|
||||
// Get target statue size (world units)
|
||||
Vector2 targetStatueSize = Vector2.one;
|
||||
if (_statueSpriteRenderer != null && _statueSpriteRenderer.sprite != null)
|
||||
{
|
||||
targetStatueSize = _statueSpriteRenderer.sprite.bounds.size;
|
||||
}
|
||||
// Get target statue VISUAL size (including transform scale)
|
||||
Vector2 spriteNativeSize = statueSpriteRenderer.sprite.bounds.size;
|
||||
Vector3 spriteScale = statueSpriteRenderer.transform.localScale;
|
||||
targetStatueWorldSize = new Vector2(
|
||||
spriteNativeSize.x * spriteScale.x,
|
||||
spriteNativeSize.y * spriteScale.y
|
||||
);
|
||||
|
||||
// Calculate conversion factor (target size / source size)
|
||||
float conversionX = targetStatueSize.x / data.sourceStatueSize.x;
|
||||
float conversionY = targetStatueSize.y / data.sourceStatueSize.y;
|
||||
float conversionX = targetStatueWorldSize.x / data.sourceStatueSize.x;
|
||||
float conversionY = targetStatueWorldSize.y / data.sourceStatueSize.y;
|
||||
|
||||
// Use average of X and Y for uniform scaling (or could use separate X/Y)
|
||||
float conversionFactor = (conversionX + conversionY) / 2f;
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] Coordinate conversion: UI({data.sourceStatueSize}) → World({targetStatueSize}) = factor {conversionFactor:F3}");
|
||||
Logging.Debug($"[StatueDecorationLoader] Coordinate conversion: UI({data.sourceStatueSize}px) → World({targetStatueWorldSize}units)");
|
||||
Logging.Debug($"[StatueDecorationLoader] Sprite native: {spriteNativeSize}, scale: {spriteScale}, conversion factor: {conversionFactor:F3}");
|
||||
}
|
||||
|
||||
return conversionFactor;
|
||||
@@ -211,10 +208,10 @@ namespace Minigames.StatueDressup.Display
|
||||
/// Spawn a single decoration from placement data
|
||||
/// Looks up DecorationData from pre-loaded dictionary and applies coordinate conversion
|
||||
/// </summary>
|
||||
private bool SpawnDecoration(DecorationPlacement placement, float conversionFactor)
|
||||
private bool SpawnDecoration(DecorationPlacement placement, float conversionFactor, Vector2 sourceStatueSize, Vector2 targetStatueWorldSize)
|
||||
{
|
||||
// Look up DecorationData from dictionary
|
||||
if (!_decorationDataDict.TryGetValue(placement.decorationId, out DecorationData decorationData))
|
||||
if (!decorationDataDict.TryGetValue(placement.decorationId, out DecorationData decorationData))
|
||||
{
|
||||
Logging.Warning($"[StatueDecorationLoader] DecorationData not found for ID: {placement.decorationId}");
|
||||
return false;
|
||||
@@ -229,47 +226,151 @@ namespace Minigames.StatueDressup.Display
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create GameObject for decoration
|
||||
// Create GameObject for decoration as child of statue sprite renderer
|
||||
GameObject decorationObj = new GameObject($"Decoration_{placement.decorationId}");
|
||||
decorationObj.transform.SetParent(decorationRoot, false); // false = keep local position
|
||||
decorationObj.transform.SetParent(statueSpriteRenderer.transform, false);
|
||||
|
||||
// Add SpriteRenderer
|
||||
SpriteRenderer spriteRenderer = decorationObj.AddComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = decorationSprite;
|
||||
spriteRenderer.sortingLayerName = "Foreground";
|
||||
spriteRenderer.sortingOrder = _statueSpriteRenderer.sortingOrder + placement.sortingOrder;
|
||||
spriteRenderer.sortingOrder = statueSpriteRenderer.sortingOrder + placement.sortingOrder;
|
||||
|
||||
// Apply transform with coordinate conversion
|
||||
Vector3 convertedPosition = placement.localPosition * conversionFactor;
|
||||
decorationObj.transform.localPosition = convertedPosition;
|
||||
decorationObj.transform.localScale = placement.localScale;
|
||||
// ===== POSITION CALCULATION =====
|
||||
// Calculate pivot offset - decorations should be positioned relative to sprite's visual center, not pivot
|
||||
Sprite statueSprite = statueSpriteRenderer.sprite;
|
||||
Bounds spriteBounds = statueSprite.bounds;
|
||||
|
||||
// Sprite.bounds.center gives us the offset from pivot to visual center in local space
|
||||
Vector2 pivotToCenterOffset = spriteBounds.center;
|
||||
|
||||
// Convert UI pixel position to world space position
|
||||
Vector3 worldPosition = placement.localPosition * conversionFactor;
|
||||
|
||||
// Convert world position to local position (accounting for parent scale)
|
||||
Vector3 parentScale = statueSpriteRenderer.transform.localScale;
|
||||
Vector3 localPosition = new Vector3(
|
||||
worldPosition.x / parentScale.x,
|
||||
worldPosition.y / parentScale.y,
|
||||
worldPosition.z
|
||||
);
|
||||
|
||||
// Apply pivot offset IN LOCAL SPACE (after conversion from world to local)
|
||||
// This ensures both values are in the same coordinate system
|
||||
if (applyPivotOffset)
|
||||
{
|
||||
localPosition += new Vector3(pivotToCenterOffset.x, pivotToCenterOffset.y, 0f);
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] Pivot offset APPLIED: {pivotToCenterOffset} (bounds center: {spriteBounds.center}, pivot normalized: {statueSprite.pivot / statueSprite.rect.size})");
|
||||
}
|
||||
}
|
||||
else if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] Pivot offset SKIPPED (applyPivotOffset = false)");
|
||||
}
|
||||
|
||||
// ===== SCALE CALCULATION =====
|
||||
Vector3 localScale = placement.localScale;
|
||||
|
||||
if (placement.sizeDelta != Vector2.zero)
|
||||
{
|
||||
// Calculate relative size in UI (decoration size / statue size)
|
||||
Vector2 relativeSizeUI = new Vector2(
|
||||
placement.sizeDelta.x / sourceStatueSize.x,
|
||||
placement.sizeDelta.y / sourceStatueSize.y
|
||||
);
|
||||
|
||||
// Calculate target world size for decoration (relative size × statue world size)
|
||||
Vector2 targetDecorationWorldSize = new Vector2(
|
||||
relativeSizeUI.x * targetStatueWorldSize.x,
|
||||
relativeSizeUI.y * targetStatueWorldSize.y
|
||||
);
|
||||
|
||||
// Get decoration sprite's native world size
|
||||
Vector2 decorationNativeWorldSize = decorationSprite.bounds.size;
|
||||
|
||||
// Calculate world scale needed to achieve target size
|
||||
Vector2 worldScaleNeeded = new Vector2(
|
||||
targetDecorationWorldSize.x / decorationNativeWorldSize.x,
|
||||
targetDecorationWorldSize.y / decorationNativeWorldSize.y
|
||||
);
|
||||
|
||||
// Apply saved scale multiplier
|
||||
worldScaleNeeded = new Vector2(
|
||||
worldScaleNeeded.x * placement.localScale.x,
|
||||
worldScaleNeeded.y * placement.localScale.y
|
||||
);
|
||||
|
||||
// Convert world scale to local scale (accounting for parent scale)
|
||||
localScale = new Vector3(
|
||||
worldScaleNeeded.x / parentScale.x,
|
||||
worldScaleNeeded.y / parentScale.y,
|
||||
1f
|
||||
);
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] Size calc: UI sizeDelta={placement.sizeDelta}, relativeUI={relativeSizeUI}");
|
||||
Logging.Debug($"[StatueDecorationLoader] Target world size={targetDecorationWorldSize}, native={decorationNativeWorldSize}, worldScale={worldScaleNeeded}, localScale={localScale}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No sizeDelta saved, just apply saved scale divided by parent scale
|
||||
localScale = new Vector3(
|
||||
placement.localScale.x / parentScale.x,
|
||||
placement.localScale.y / parentScale.y,
|
||||
1f
|
||||
);
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] No sizeDelta saved, using scale directly (compensated): {localScale}");
|
||||
}
|
||||
}
|
||||
|
||||
// Apply transform
|
||||
decorationObj.transform.localPosition = localPosition;
|
||||
decorationObj.transform.localScale = localScale;
|
||||
decorationObj.transform.localEulerAngles = new Vector3(0, 0, placement.rotation);
|
||||
|
||||
if (showDebugInfo)
|
||||
{
|
||||
Logging.Debug($"[StatueDecorationLoader] Spawned: {placement.decorationId} at {convertedPosition} (original: {placement.localPosition}, factor: {conversionFactor:F3})");
|
||||
Logging.Debug($"[StatueDecorationLoader] Spawned: {placement.decorationId}");
|
||||
Logging.Debug($"[StatueDecorationLoader] Position: UI={placement.localPosition} → world={worldPosition} → local={localPosition}");
|
||||
Logging.Debug($"[StatueDecorationLoader] Parent scale: {parentScale}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear all existing decorations from decorationRoot
|
||||
/// Clear all existing decorations (children of statue sprite renderer that are decorations)
|
||||
/// </summary>
|
||||
public void ClearDecorations()
|
||||
{
|
||||
if (decorationRoot == null) return;
|
||||
if (statueSpriteRenderer == null) return;
|
||||
|
||||
// Remove all children from decoration root only
|
||||
for (int i = decorationRoot.childCount - 1; i >= 0; i--)
|
||||
Transform parent = statueSpriteRenderer.transform;
|
||||
|
||||
// Remove all children that are decorations (identified by name pattern)
|
||||
for (int i = parent.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
GameObject child = parent.GetChild(i).gameObject;
|
||||
|
||||
// Only destroy objects that look like decorations (by name pattern)
|
||||
if (child.name.StartsWith("Decoration_"))
|
||||
{
|
||||
Destroy(decorationRoot.GetChild(i).gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyImmediate(decorationRoot.GetChild(i).gameObject);
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Destroy(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyImmediate(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +381,7 @@ namespace Minigames.StatueDressup.Display
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Release DecorationData handle
|
||||
AddressablesUtility.ReleaseHandle(_decorationDataHandle);
|
||||
AddressablesUtility.ReleaseHandle(decorationDataHandle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe03648f638e4872abafaf49234a3f55
|
||||
timeCreated: 1763745490
|
||||
@@ -1,393 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
using SDev;
|
||||
using ScreenUtils = Utils.ScreenSpaceUtility;
|
||||
|
||||
namespace Minigames.StatueDressup.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages statue photo capture, storage, and retrieval.
|
||||
/// Supports area-limited screenshots, persistent file storage (mobile + PC),
|
||||
/// and optimized gallery loading with pagination.
|
||||
/// </summary>
|
||||
public static class StatuePhotoManager
|
||||
{
|
||||
private const string PhotoFolder = "StatuePhotos";
|
||||
private const string PhotoPrefix = "MrCementStatue_";
|
||||
private const string MetadataKeyPrefix = "StatuePhoto_Meta_";
|
||||
private const string PhotoIndexKey = "StatuePhoto_Index";
|
||||
|
||||
/// <summary>
|
||||
/// Photo metadata stored in PlayerPrefs
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PhotoMetadata
|
||||
{
|
||||
public string photoId;
|
||||
public string timestamp;
|
||||
public int decorationCount;
|
||||
public long fileSizeBytes;
|
||||
}
|
||||
|
||||
#region Capture
|
||||
|
||||
/// <summary>
|
||||
/// Capture a specific area of the screen using Screenshot Helper
|
||||
/// </summary>
|
||||
/// <param name="captureArea">RectTransform defining the capture region</param>
|
||||
/// <param name="onComplete">Callback with captured Texture2D</param>
|
||||
/// <param name="mainCamera">Camera used for coordinate conversion (null = Camera.main)</param>
|
||||
/// <param name="clampToScreenBounds">If true, clamps capture area to visible screen bounds</param>
|
||||
public static void CaptureAreaPhoto(
|
||||
RectTransform captureArea,
|
||||
Action<Texture2D> onComplete,
|
||||
Camera mainCamera = null,
|
||||
bool clampToScreenBounds = true)
|
||||
{
|
||||
if (captureArea == null)
|
||||
{
|
||||
Logging.Error("[StatuePhotoManager] CaptureArea RectTransform is null!");
|
||||
onComplete?.Invoke(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainCamera == null) mainCamera = Camera.main;
|
||||
|
||||
// Use ScreenSpaceUtility to convert RectTransform to screen rect
|
||||
// returnCenterPosition = true because ScreenshotHelper expects center position
|
||||
Rect screenRect = ScreenUtils.RectTransformToScreenRect(
|
||||
captureArea,
|
||||
mainCamera,
|
||||
clampToScreenBounds,
|
||||
returnCenterPosition: true
|
||||
);
|
||||
|
||||
Logging.Debug($"[StatuePhotoManager] Capturing area: pos={screenRect.position}, size={screenRect.size}");
|
||||
|
||||
// Use Screenshot Helper's Capture method
|
||||
ScreenshotHelper.Instance.Capture(
|
||||
screenRect.position,
|
||||
screenRect.size,
|
||||
(texture) =>
|
||||
{
|
||||
if (texture != null)
|
||||
{
|
||||
Logging.Debug($"[StatuePhotoManager] Photo captured: {texture.width}x{texture.height}");
|
||||
onComplete?.Invoke(texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Error("[StatuePhotoManager] Screenshot Helper returned null texture!");
|
||||
onComplete?.Invoke(null);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Save/Load
|
||||
|
||||
/// <summary>
|
||||
/// Save photo to persistent storage with metadata
|
||||
/// </summary>
|
||||
/// <param name="photo">Texture2D to save</param>
|
||||
/// <param name="decorationCount">Number of decorations placed (for metadata)</param>
|
||||
/// <returns>Photo ID if successful, null if failed</returns>
|
||||
public static string SavePhoto(Texture2D photo, int decorationCount = 0)
|
||||
{
|
||||
if (photo == null)
|
||||
{
|
||||
Logging.Error("[StatuePhotoManager] Cannot save null photo");
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Generate unique photo ID
|
||||
string photoId = $"{PhotoPrefix}{DateTime.Now.Ticks}";
|
||||
|
||||
// Save texture using FileSaveUtil
|
||||
string savedPath = FileSaveUtil.Instance.SaveTextureAsPNG(
|
||||
photo,
|
||||
FileSaveUtil.AppPath.PersistentDataPath,
|
||||
PhotoFolder,
|
||||
photoId
|
||||
);
|
||||
|
||||
// Calculate file size
|
||||
FileInfo fileInfo = new FileInfo(savedPath);
|
||||
long fileSize = fileInfo.Exists ? fileInfo.Length : 0;
|
||||
|
||||
// Save metadata
|
||||
PhotoMetadata metadata = new PhotoMetadata
|
||||
{
|
||||
photoId = photoId,
|
||||
timestamp = DateTime.Now.ToString("o"),
|
||||
decorationCount = decorationCount,
|
||||
fileSizeBytes = fileSize
|
||||
};
|
||||
|
||||
SaveMetadata(metadata);
|
||||
AddToPhotoIndex(photoId);
|
||||
|
||||
Logging.Debug($"[StatuePhotoManager] Photo saved: {savedPath} ({fileSize} bytes)");
|
||||
return photoId;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Error($"[StatuePhotoManager] Failed to save photo: {e.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load photo texture from storage
|
||||
/// </summary>
|
||||
public static Texture2D LoadPhoto(string photoId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(photoId))
|
||||
{
|
||||
Logging.Warning("[StatuePhotoManager] PhotoId is null or empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string filePath = GetPhotoFilePath(photoId);
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
Logging.Warning($"[StatuePhotoManager] Photo not found: {filePath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] fileData = File.ReadAllBytes(filePath);
|
||||
Texture2D texture = new Texture2D(2, 2, TextureFormat.RGBA32, false);
|
||||
|
||||
if (texture.LoadImage(fileData))
|
||||
{
|
||||
Logging.Debug($"[StatuePhotoManager] Photo loaded: {photoId} ({texture.width}x{texture.height})");
|
||||
return texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Error($"[StatuePhotoManager] Failed to decode image: {photoId}");
|
||||
UnityEngine.Object.Destroy(texture);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Error($"[StatuePhotoManager] Failed to load photo {photoId}: {e.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete photo and its metadata
|
||||
/// </summary>
|
||||
public static bool DeletePhoto(string photoId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(photoId)) return false;
|
||||
|
||||
try
|
||||
{
|
||||
string filePath = GetPhotoFilePath(photoId);
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
|
||||
DeleteMetadata(photoId);
|
||||
RemoveFromPhotoIndex(photoId);
|
||||
|
||||
Logging.Debug($"[StatuePhotoManager] Photo deleted: {photoId}");
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Error($"[StatuePhotoManager] Failed to delete photo {photoId}: {e.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Gallery Support
|
||||
|
||||
/// <summary>
|
||||
/// Get all photo IDs sorted by timestamp (newest first)
|
||||
/// </summary>
|
||||
public static List<string> GetAllPhotoIds()
|
||||
{
|
||||
string indexJson = PlayerPrefs.GetString(PhotoIndexKey, "[]");
|
||||
List<string> photoIds = JsonUtility.FromJson<PhotoIdList>(WrapJsonArray(indexJson))?.ids ?? new List<string>();
|
||||
|
||||
// Sort by timestamp descending (newest first)
|
||||
photoIds.Sort((a, b) =>
|
||||
{
|
||||
PhotoMetadata metaA = LoadMetadata(a);
|
||||
PhotoMetadata metaB = LoadMetadata(b);
|
||||
|
||||
DateTime dateA = DateTime.Parse(metaA?.timestamp ?? DateTime.MinValue.ToString("o"));
|
||||
DateTime dateB = DateTime.Parse(metaB?.timestamp ?? DateTime.MinValue.ToString("o"));
|
||||
|
||||
return dateB.CompareTo(dateA);
|
||||
});
|
||||
|
||||
return photoIds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated photo IDs for optimized gallery loading
|
||||
/// </summary>
|
||||
/// <param name="page">Page number (0-indexed)</param>
|
||||
/// <param name="pageSize">Number of items per page</param>
|
||||
public static List<string> GetPhotoIdsPage(int page, int pageSize)
|
||||
{
|
||||
List<string> allIds = GetAllPhotoIds();
|
||||
int startIndex = page * pageSize;
|
||||
|
||||
if (startIndex >= allIds.Count) return new List<string>();
|
||||
|
||||
int count = Mathf.Min(pageSize, allIds.Count - startIndex);
|
||||
return allIds.GetRange(startIndex, count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get total number of saved photos
|
||||
/// </summary>
|
||||
public static int GetPhotoCount()
|
||||
{
|
||||
return GetAllPhotoIds().Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get latest photo ID (most recent)
|
||||
/// </summary>
|
||||
public static string GetLatestPhotoId()
|
||||
{
|
||||
List<string> allIds = GetAllPhotoIds();
|
||||
return allIds.Count > 0 ? allIds[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load photo metadata
|
||||
/// </summary>
|
||||
public static PhotoMetadata GetPhotoMetadata(string photoId)
|
||||
{
|
||||
return LoadMetadata(photoId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create thumbnail from full-size photo (for gallery preview)
|
||||
/// </summary>
|
||||
public static Texture2D CreateThumbnail(Texture2D fullSizePhoto, int maxSize = 256)
|
||||
{
|
||||
if (fullSizePhoto == null) return null;
|
||||
|
||||
int width = fullSizePhoto.width;
|
||||
int height = fullSizePhoto.height;
|
||||
|
||||
// Calculate thumbnail size maintaining aspect ratio
|
||||
float scale = Mathf.Min((float)maxSize / width, (float)maxSize / height);
|
||||
int thumbWidth = Mathf.RoundToInt(width * scale);
|
||||
int thumbHeight = Mathf.RoundToInt(height * scale);
|
||||
|
||||
// Create thumbnail using bilinear filtering
|
||||
RenderTexture rt = RenderTexture.GetTemporary(thumbWidth, thumbHeight, 0, RenderTextureFormat.ARGB32);
|
||||
RenderTexture.active = rt;
|
||||
|
||||
Graphics.Blit(fullSizePhoto, rt);
|
||||
|
||||
Texture2D thumbnail = new Texture2D(thumbWidth, thumbHeight, TextureFormat.RGB24, false);
|
||||
thumbnail.ReadPixels(new Rect(0, 0, thumbWidth, thumbHeight), 0, 0);
|
||||
thumbnail.Apply();
|
||||
|
||||
RenderTexture.active = null;
|
||||
RenderTexture.ReleaseTemporary(rt);
|
||||
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Helpers
|
||||
|
||||
public static string GetPhotoDirectory()
|
||||
{
|
||||
return Path.Combine(Application.persistentDataPath, PhotoFolder);
|
||||
}
|
||||
|
||||
private static string GetPhotoFilePath(string photoId)
|
||||
{
|
||||
return Path.Combine(GetPhotoDirectory(), $"{photoId}.png");
|
||||
}
|
||||
|
||||
private static void SaveMetadata(PhotoMetadata metadata)
|
||||
{
|
||||
string json = JsonUtility.ToJson(metadata);
|
||||
PlayerPrefs.SetString(MetadataKeyPrefix + metadata.photoId, json);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
private static PhotoMetadata LoadMetadata(string photoId)
|
||||
{
|
||||
string json = PlayerPrefs.GetString(MetadataKeyPrefix + photoId, null);
|
||||
return string.IsNullOrEmpty(json) ? null : JsonUtility.FromJson<PhotoMetadata>(json);
|
||||
}
|
||||
|
||||
private static void DeleteMetadata(string photoId)
|
||||
{
|
||||
PlayerPrefs.DeleteKey(MetadataKeyPrefix + photoId);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
private static void AddToPhotoIndex(string photoId)
|
||||
{
|
||||
List<string> photoIds = GetAllPhotoIds();
|
||||
if (!photoIds.Contains(photoId))
|
||||
{
|
||||
photoIds.Add(photoId);
|
||||
SavePhotoIndex(photoIds);
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveFromPhotoIndex(string photoId)
|
||||
{
|
||||
List<string> photoIds = GetAllPhotoIds();
|
||||
if (photoIds.Remove(photoId))
|
||||
{
|
||||
SavePhotoIndex(photoIds);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SavePhotoIndex(List<string> photoIds)
|
||||
{
|
||||
string json = JsonUtility.ToJson(new PhotoIdList { ids = photoIds });
|
||||
PlayerPrefs.SetString(PhotoIndexKey, json);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
private static string WrapJsonArray(string json)
|
||||
{
|
||||
if (json.StartsWith("[")) return "{\"ids\":" + json + "}";
|
||||
return json;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
private class PhotoIdList
|
||||
{
|
||||
public List<string> ids = new List<string>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f3e9a2b4c5d6e7f8a9b0c1d2e3f4a5b
|
||||
Reference in New Issue
Block a user