From 9b265f786013398a092b97e00d6c9d4e6fa009a7 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Fri, 21 Nov 2014 17:06:25 +0000 Subject: [PATCH] Added clickable and draggable prefabs and menu items --- Assets/Examples/DragAndDrop/DragAndDrop.unity | 449 +++++++++++++++--- .../Fungus/Sprite/Editor/SpriteMenuItems.cs | 26 +- .../Sprite/Prefabs/ClickableSprite.prefab | 8 +- .../Prefabs/ClickableSprite.prefab.meta | 2 +- .../Sprite/Prefabs/DragTargetSprite.prefab | 76 +++ .../Prefabs/DragTargetSprite.prefab.meta | 4 + .../Sprite/Prefabs/DraggableSprite.prefab | 107 +++++ .../Prefabs/DraggableSprite.prefab.meta | 4 + 8 files changed, 604 insertions(+), 72 deletions(-) create mode 100644 Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab create mode 100644 Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab.meta create mode 100644 Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab create mode 100644 Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab.meta diff --git a/Assets/Examples/DragAndDrop/DragAndDrop.unity b/Assets/Examples/DragAndDrop/DragAndDrop.unity index 3cc0d3f3..5db209b2 100644 --- a/Assets/Examples/DragAndDrop/DragAndDrop.unity +++ b/Assets/Examples/DragAndDrop/DragAndDrop.unity @@ -74,6 +74,54 @@ NavMeshSettings: widthInaccuracy: 16.666666 heightInaccuracy: 10 m_NavMesh: {fileID: 0} +--- !u!1001 &228925351 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalPosition.x + value: -2.5 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalPosition.y + value: -3.25 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_Name + value: ClickableSprite1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + m_RootGameObject: {fileID: 1637100245} + m_IsPrefabParent: 0 + m_IsExploded: 1 --- !u!1 &268187667 GameObject: m_ObjectHideFlags: 0 @@ -153,7 +201,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 268187667} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalPosition: {x: -.0500000007, y: -.540000021, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -198,18 +246,140 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 +--- !u!1001 &442175927 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalPosition.x + value: 2.99000001 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalPosition.y + value: 1.87 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + m_RootGameObject: {fileID: 606394391} + m_IsPrefabParent: 0 + m_IsExploded: 1 +--- !u!1 &591590528 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + m_PrefabInternal: {fileID: 1373034542} + serializedVersion: 4 + m_Component: + - 4: {fileID: 591590532} + - 212: {fileID: 591590531} + - 61: {fileID: 591590530} + - 114: {fileID: 591590529} + m_Layer: 0 + m_Name: ClickableSprite2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &591590529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177, + type: 2} + m_PrefabInternal: {fileID: 1373034542} + m_GameObject: {fileID: 591590528} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc03961113fa349c09cb06ef2911013d, type: 3} + m_Name: + m_EditorClassIdentifier: + clickEnabled: 1 +--- !u!61 &591590530 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 6100000, guid: 0e6bcf37a2876432fa58eff8888bf177, + type: 2} + m_PrefabInternal: {fileID: 1373034542} + m_GameObject: {fileID: 591590528} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Size: {x: 3, y: 3} + m_Center: {x: 0, y: 0} +--- !u!212 &591590531 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 21200000, guid: 0e6bcf37a2876432fa58eff8888bf177, + type: 2} + m_PrefabInternal: {fileID: 1373034542} + m_GameObject: {fileID: 591590528} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!4 &591590532 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + m_PrefabInternal: {fileID: 1373034542} + m_GameObject: {fileID: 591590528} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3.18000007, y: -3.1500001, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 --- !u!1 &606394391 GameObject: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 100000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + m_PrefabInternal: {fileID: 442175927} serializedVersion: 4 m_Component: - 4: {fileID: 606394394} - 212: {fileID: 606394393} - 58: {fileID: 606394392} m_Layer: 0 - m_Name: DragTarget + m_Name: DragTargetSprite m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -218,8 +388,9 @@ GameObject: --- !u!58 &606394392 CircleCollider2D: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 5800000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, + type: 2} + m_PrefabInternal: {fileID: 442175927} m_GameObject: {fileID: 606394391} m_Enabled: 1 m_Material: {fileID: 0} @@ -229,8 +400,9 @@ CircleCollider2D: --- !u!212 &606394393 SpriteRenderer: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 21200000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, + type: 2} + m_PrefabInternal: {fileID: 442175927} m_GameObject: {fileID: 606394391} m_Enabled: 1 m_CastShadows: 0 @@ -251,20 +423,20 @@ SpriteRenderer: --- !u!4 &606394394 Transform: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} + m_PrefabInternal: {fileID: 442175927} m_GameObject: {fileID: 606394391} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 3.0999999, y: .370000005, z: 0} + m_LocalPosition: {x: 2.99000001, y: 1.87, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 2 --- !u!1 &1081858233 GameObject: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + m_PrefabInternal: {fileID: 2135880372} serializedVersion: 4 m_Component: - 4: {fileID: 1081858238} @@ -273,7 +445,7 @@ GameObject: - 50: {fileID: 1081858234} - 114: {fileID: 1081858236} m_Layer: 0 - m_Name: Draggable + m_Name: DraggableSprite m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -282,8 +454,9 @@ GameObject: --- !u!50 &1081858234 Rigidbody2D: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 5000000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, + type: 2} + m_PrefabInternal: {fileID: 2135880372} m_GameObject: {fileID: 1081858233} m_Mass: 1 m_LinearDrag: 0 @@ -297,8 +470,9 @@ Rigidbody2D: --- !u!61 &1081858235 BoxCollider2D: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 6100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, + type: 2} + m_PrefabInternal: {fileID: 2135880372} m_GameObject: {fileID: 1081858233} m_Enabled: 1 m_Material: {fileID: 0} @@ -308,8 +482,9 @@ BoxCollider2D: --- !u!114 &1081858236 MonoBehaviour: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 11400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, + type: 2} + m_PrefabInternal: {fileID: 2135880372} m_GameObject: {fileID: 1081858233} m_Enabled: 1 m_EditorHideFlags: 0 @@ -322,8 +497,9 @@ MonoBehaviour: --- !u!212 &1081858237 SpriteRenderer: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 21200000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, + type: 2} + m_PrefabInternal: {fileID: 2135880372} m_GameObject: {fileID: 1081858233} m_Enabled: 1 m_CastShadows: 0 @@ -344,15 +520,63 @@ SpriteRenderer: --- !u!4 &1081858238 Transform: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + m_PrefabInternal: {fileID: 2135880372} m_GameObject: {fileID: 1081858233} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -.730000019, y: .360000014, z: 0} + m_LocalPosition: {x: -2.54999995, y: 1.90999997, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 1 +--- !u!1001 &1373034542 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalPosition.x + value: 3.18000007 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalPosition.y + value: -3.1500001 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + propertyPath: m_Name + value: ClickableSprite2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + m_RootGameObject: {fileID: 591590528} + m_IsPrefabParent: 0 + m_IsExploded: 1 --- !u!115 &1447151998 MonoScript: m_ObjectHideFlags: 0 @@ -372,8 +596,8 @@ MonoScript: --- !u!1 &1637100245 GameObject: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + m_PrefabInternal: {fileID: 228925351} serializedVersion: 4 m_Component: - 4: {fileID: 1637100250} @@ -381,7 +605,7 @@ GameObject: - 61: {fileID: 1637100248} - 114: {fileID: 1637100246} m_Layer: 0 - m_Name: Clickable + m_Name: ClickableSprite1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -390,8 +614,9 @@ GameObject: --- !u!114 &1637100246 MonoBehaviour: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177, + type: 2} + m_PrefabInternal: {fileID: 228925351} m_GameObject: {fileID: 1637100245} m_Enabled: 1 m_EditorHideFlags: 0 @@ -402,8 +627,9 @@ MonoBehaviour: --- !u!61 &1637100248 BoxCollider2D: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 6100000, guid: 0e6bcf37a2876432fa58eff8888bf177, + type: 2} + m_PrefabInternal: {fileID: 228925351} m_GameObject: {fileID: 1637100245} m_Enabled: 1 m_Material: {fileID: 0} @@ -413,8 +639,9 @@ BoxCollider2D: --- !u!212 &1637100249 SpriteRenderer: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 21200000, guid: 0e6bcf37a2876432fa58eff8888bf177, + type: 2} + m_PrefabInternal: {fileID: 228925351} m_GameObject: {fileID: 1637100245} m_Enabled: 1 m_CastShadows: 0 @@ -435,15 +662,15 @@ SpriteRenderer: --- !u!4 &1637100250 Transform: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabParentObject: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2} + m_PrefabInternal: {fileID: 228925351} m_GameObject: {fileID: 1637100245} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.67999983, y: .370000005, z: 0} + m_LocalPosition: {x: -2.5, y: -3.25, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 3 --- !u!1 &2019116667 GameObject: m_ObjectHideFlags: 0 @@ -477,6 +704,9 @@ GameObject: - 114: {fileID: 2019116692} - 114: {fileID: 2019116688} - 114: {fileID: 2019116678} + - 114: {fileID: 2019116694} + - 114: {fileID: 2019116696} + - 114: {fileID: 2019116695} m_Layer: 0 m_Name: FungusScript m_TagString: Untagged @@ -495,17 +725,17 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - scrollPos: {x: 241, y: -25} + scrollPos: {x: 227, y: 20} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 zoom: 1 scrollViewRect: serializedVersion: 2 x: -591 - y: -353 + y: -391 width: 1887 - height: 970 - selectedSequence: {fileID: 2019116680} + height: 1008 + selectedSequence: {fileID: 0} selectedCommands: [] variables: [] runSlowDuration: .25 @@ -524,8 +754,8 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: 141 - y: 86 + x: -31 + y: 99 width: 120 height: 30 sequenceName: Drag Completed @@ -675,7 +905,7 @@ MonoBehaviour: offset: {x: .25, y: .25, z: 0} --- !u!114 &2019116678 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 2019116667} @@ -714,8 +944,8 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: 306 - y: 142 + x: -35 + y: 182 width: 120 height: 30 sequenceName: Drag Exited @@ -766,8 +996,8 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: 306 - y: 87 + x: -33 + y: 141 width: 120 height: 30 sequenceName: Drag Entered @@ -803,8 +1033,8 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: -33 - y: 142 + x: -32 + y: 57 width: 120 height: 30 sequenceName: Drag Cancelled @@ -840,8 +1070,8 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: -35 - y: 86 + x: -33 + y: 14 width: 120 height: 30 sequenceName: Drag Start @@ -885,7 +1115,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 --- !u!114 &2019116690 MonoBehaviour: m_ObjectHideFlags: 2 @@ -958,12 +1188,113 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: 142 - y: 142 + x: 184 + y: 14 width: 120 height: 30 - sequenceName: New Sequence + sequenceName: Object Clicked 1 runSlowInEditor: 0 eventHandler: {fileID: 2019116692} commandList: - {fileID: 2019116688} +--- !u!114 &2019116694 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2019116667} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 185 + y: 56 + width: 120 + height: 30 + sequenceName: Object Clicked 2 + runSlowInEditor: 0 + eventHandler: {fileID: 2019116696} + commandList: + - {fileID: 2019116695} +--- !u!114 &2019116695 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2019116667} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e61780d2ea956492a8f59308dae6f12c, type: 3} + m_Name: + m_EditorClassIdentifier: + errorMessage: + indentLevel: 0 + targetObject: + targetType: 1 + otherGameObject: {fileID: 591590528} + tweenName: + duration: 1 + easeType: 2 + loopType: 0 + waitUntilFinished: 1 + amount: {x: .5, y: .5, z: 0} +--- !u!114 &2019116696 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2019116667} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a49012bdc794e429686c1eff7d9ced90, type: 3} + m_Name: + m_EditorClassIdentifier: + parentSequence: {fileID: 2019116694} + clickableObject: {fileID: 591590529} +--- !u!1001 &2135880372 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalPosition.x + value: -2.54999995 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalPosition.y + value: 1.90999997 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} + m_RootGameObject: {fileID: 1081858233} + m_IsPrefabParent: 0 + m_IsExploded: 1 diff --git a/Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs b/Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs index 117946a6..945c68e9 100644 --- a/Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs +++ b/Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs @@ -7,18 +7,30 @@ namespace Fungus public class SpriteMenuItems { - [MenuItem("GameObject/Fungus/Sprite/ParallaxSprite")] - static void CreateParallaxSprite() - { - InstantiatePrefab("ParallaxSprite"); - } - [MenuItem("GameObject/Fungus/Sprite/ClickableSprite")] static void CreateClickableSprite() { InstantiatePrefab("ClickableSprite"); } + [MenuItem("GameObject/Fungus/Sprite/DraggableSprite")] + static void CreateDraggableSprite() + { + InstantiatePrefab("DraggableSprite"); + } + + [MenuItem("GameObject/Fungus/Sprite/DragTargetSprite")] + static void CreateDragTargetSprite() + { + InstantiatePrefab("DragTargetSprite"); + } + + [MenuItem("GameObject/Fungus/Sprite/ParallaxSprite")] + static void CreateParallaxSprite() + { + InstantiatePrefab("ParallaxSprite"); + } + static void InstantiatePrefab(string prefabName) { GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Sprite/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject; @@ -26,6 +38,8 @@ namespace Fungus { GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject; go.name = prefabName; + Undo.RegisterCreatedObjectUndo(go, go.name); + Selection.activeGameObject = go; } } diff --git a/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab b/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab index 1cd5ffab..a758bacf 100644 --- a/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab +++ b/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab @@ -52,11 +52,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cc03961113fa349c09cb06ef2911013d, type: 3} m_Name: m_EditorClassIdentifier: - onSpriteClick: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral, - PublicKeyToken=null + clickEnabled: 1 --- !u!212 &21200000 SpriteRenderer: m_ObjectHideFlags: 1 @@ -76,7 +72,7 @@ SpriteRenderer: m_LightProbeAnchor: {fileID: 0} m_ScaleInLightmap: 1 m_SortingLayerID: 0 - m_SortingOrder: 10 + m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} --- !u!1001 &100100000 diff --git a/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta b/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta index b9ea6589..aa41afac 100644 --- a/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta +++ b/Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: 7dd53f3f0a79d441fb32e055767a1b17 +guid: 0e6bcf37a2876432fa58eff8888bf177 NativeFormatImporter: userData: diff --git a/Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab b/Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab new file mode 100644 index 00000000..e5c2de8b --- /dev/null +++ b/Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &100000 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 400000} + - 212: {fileID: 21200000} + - 58: {fileID: 5800000} + m_Layer: 0 + m_Name: DragTargetSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &400000 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + 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_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!58 &5800000 +CircleCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Radius: 1.5 + m_Center: {x: 0, y: 0} +--- !u!212 &21200000 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: .368627459} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 100000} + m_IsPrefabParent: 1 + m_IsExploded: 1 diff --git a/Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab.meta b/Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab.meta new file mode 100644 index 00000000..5b09e830 --- /dev/null +++ b/Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b +NativeFormatImporter: + userData: diff --git a/Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab b/Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab new file mode 100644 index 00000000..444f18eb --- /dev/null +++ b/Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab @@ -0,0 +1,107 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &100000 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 400000} + - 212: {fileID: 21200000} + - 61: {fileID: 6100000} + - 50: {fileID: 5000000} + - 114: {fileID: 11400000} + m_Layer: 0 + m_Name: DraggableSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &400000 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -.730000019, y: .360000014, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!50 &5000000 +Rigidbody2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: .0500000007 + m_GravityScale: 1 + m_FixedAngle: 0 + m_IsKinematic: 1 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 +--- !u!61 &6100000 +BoxCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_Size: {x: 3, y: 3} + m_Center: {x: 0, y: 0} +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 18a0e492e94664ec0ac44d252c40e3a7, type: 3} + m_Name: + m_EditorClassIdentifier: + dragEnabled: 1 + returnToStartPos: 1 + returnDuration: 1 +--- !u!212 &21200000 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 100000} + m_IsPrefabParent: 1 + m_IsExploded: 1 diff --git a/Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab.meta b/Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab.meta new file mode 100644 index 00000000..4ab928fb --- /dev/null +++ b/Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4d55f86cf3b124c8fb1158da26ffa96d +NativeFormatImporter: + userData: