From a7c2f5bc4faa74b3dfcae67cf5280b2e29096e5c Mon Sep 17 00:00:00 2001 From: klemek Date: Wed, 16 Dec 2020 15:45:44 +0100 Subject: [PATCH] trash tool --- Assets/SVG Assets/Cursor.meta | 8 + Assets/SVG Assets/Cursor/cursor-default.svg | 1 + .../SVG Assets/Cursor/cursor-default.svg.meta | 55 ++++++ Assets/SVG Assets/Cursor/cursor-move.svg | 1 + Assets/SVG Assets/Cursor/cursor-move.svg.meta | 55 ++++++ Assets/SVG Assets/Cursor/cursor-pointer.svg | 1 + .../SVG Assets/Cursor/cursor-pointer.svg.meta | 55 ++++++ Assets/SVG Assets/Gates.meta | 8 + Assets/SVG Assets/{ => Gates}/and.svg | 0 Assets/SVG Assets/{ => Gates}/and.svg.meta | 0 Assets/SVG Assets/{ => Gates}/buffer.svg | 0 Assets/SVG Assets/{ => Gates}/buffer.svg.meta | 0 Assets/SVG Assets/{ => Gates}/nand.svg | 0 Assets/SVG Assets/{ => Gates}/nand.svg.meta | 0 Assets/SVG Assets/{ => Gates}/nor.svg | 0 Assets/SVG Assets/{ => Gates}/nor.svg.meta | 0 Assets/SVG Assets/{ => Gates}/not.svg | 0 Assets/SVG Assets/{ => Gates}/not.svg.meta | 0 Assets/SVG Assets/{ => Gates}/or.svg | 0 Assets/SVG Assets/{ => Gates}/or.svg.meta | 0 Assets/SVG Assets/{ => Gates}/xnor.svg | 0 Assets/SVG Assets/{ => Gates}/xnor.svg.meta | 0 Assets/SVG Assets/{ => Gates}/xor.svg | 0 Assets/SVG Assets/{ => Gates}/xor.svg.meta | 0 Assets/SVG Assets/UI.meta | 8 + Assets/SVG Assets/UI/delete-empty.svg | 1 + Assets/SVG Assets/UI/delete-empty.svg.meta | 55 ++++++ Assets/SVG Assets/UI/delete.svg | 1 + Assets/SVG Assets/UI/delete.svg.meta | 55 ++++++ Assets/Scenes/Workspace.unity | 168 +++++++++++++++++- Assets/Scripts/Cable.cs | 2 +- Assets/Scripts/DefaultScript.cs | 31 ++++ Assets/Scripts/DefaultScript.cs.meta | 11 ++ Assets/Scripts/GameManager.cs | 6 +- .../{MouseManager.cs => PointerManager.cs} | 92 +++++++--- ...Manager.cs.meta => PointerManager.cs.meta} | 0 Assets/Scripts/UI/UIDelete.cs | 58 ++++++ Assets/Scripts/UI/UIDelete.cs.meta | 11 ++ Assets/Scripts/UI/UIManager.cs | 11 +- TODO.txt | 2 - 40 files changed, 662 insertions(+), 34 deletions(-) create mode 100755 Assets/SVG Assets/Cursor.meta create mode 100755 Assets/SVG Assets/Cursor/cursor-default.svg create mode 100755 Assets/SVG Assets/Cursor/cursor-default.svg.meta create mode 100755 Assets/SVG Assets/Cursor/cursor-move.svg create mode 100755 Assets/SVG Assets/Cursor/cursor-move.svg.meta create mode 100755 Assets/SVG Assets/Cursor/cursor-pointer.svg create mode 100755 Assets/SVG Assets/Cursor/cursor-pointer.svg.meta create mode 100755 Assets/SVG Assets/Gates.meta rename Assets/SVG Assets/{ => Gates}/and.svg (100%) rename Assets/SVG Assets/{ => Gates}/and.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/buffer.svg (100%) rename Assets/SVG Assets/{ => Gates}/buffer.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/nand.svg (100%) rename Assets/SVG Assets/{ => Gates}/nand.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/nor.svg (100%) rename Assets/SVG Assets/{ => Gates}/nor.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/not.svg (100%) rename Assets/SVG Assets/{ => Gates}/not.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/or.svg (100%) rename Assets/SVG Assets/{ => Gates}/or.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/xnor.svg (100%) rename Assets/SVG Assets/{ => Gates}/xnor.svg.meta (100%) rename Assets/SVG Assets/{ => Gates}/xor.svg (100%) rename Assets/SVG Assets/{ => Gates}/xor.svg.meta (100%) create mode 100755 Assets/SVG Assets/UI.meta create mode 100755 Assets/SVG Assets/UI/delete-empty.svg create mode 100755 Assets/SVG Assets/UI/delete-empty.svg.meta create mode 100755 Assets/SVG Assets/UI/delete.svg create mode 100755 Assets/SVG Assets/UI/delete.svg.meta create mode 100755 Assets/Scripts/DefaultScript.cs create mode 100755 Assets/Scripts/DefaultScript.cs.meta rename Assets/Scripts/{MouseManager.cs => PointerManager.cs} (50%) rename Assets/Scripts/{MouseManager.cs.meta => PointerManager.cs.meta} (100%) create mode 100755 Assets/Scripts/UI/UIDelete.cs create mode 100755 Assets/Scripts/UI/UIDelete.cs.meta diff --git a/Assets/SVG Assets/Cursor.meta b/Assets/SVG Assets/Cursor.meta new file mode 100755 index 0000000..1ea867a --- /dev/null +++ b/Assets/SVG Assets/Cursor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3bd7ed08f7b7d64f93259e5db1e007d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SVG Assets/Cursor/cursor-default.svg b/Assets/SVG Assets/Cursor/cursor-default.svg new file mode 100755 index 0000000..0c24ed6 --- /dev/null +++ b/Assets/SVG Assets/Cursor/cursor-default.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Assets/SVG Assets/Cursor/cursor-default.svg.meta b/Assets/SVG Assets/Cursor/cursor-default.svg.meta new file mode 100755 index 0000000..593bfe0 --- /dev/null +++ b/Assets/SVG Assets/Cursor/cursor-default.svg.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: d0f05a0b5d7c9b241a26dbe09b647c63 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: a57477913897c46af95d590f580878bd, type: 3} + svgType: 2 + texturedSpriteMeshType: 0 + svgPixelsPerUnit: 100 + gradientResolution: 64 + alignment: 1 + customPivot: {x: 0, y: 0} + generatePhysicsShape: 0 + viewportOptions: 1 + preserveViewport: 0 + advancedMode: 0 + predefinedResolutionIndex: 1 + targetResolution: 1080 + resolutionMultiplier: 1 + stepDistance: 10 + samplingStepDistance: 100 + maxCordDeviationEnabled: 0 + maxCordDeviation: 1 + maxTangentAngleEnabled: 0 + maxTangentAngle: 5 + keepTextureAspectRatio: 1 + textureSize: 256 + textureWidth: 256 + textureHeight: 256 + wrapMode: 0 + filterMode: 1 + sampleCount: 4 + preserveSVGImageAspect: 0 + useSVGPixelsPerUnit: 0 + spriteData: + TessellationDetail: 0 + SpriteRect: + name: + originalName: + pivot: {x: 0, y: 0} + alignment: 0 + border: {x: 0, y: 0, z: 0, w: 0} + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + spriteID: 49bd17e9096cd0a429dde482a8537ac2 + internalID: 0 + PhysicsOutlines: [] diff --git a/Assets/SVG Assets/Cursor/cursor-move.svg b/Assets/SVG Assets/Cursor/cursor-move.svg new file mode 100755 index 0000000..066153d --- /dev/null +++ b/Assets/SVG Assets/Cursor/cursor-move.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Assets/SVG Assets/Cursor/cursor-move.svg.meta b/Assets/SVG Assets/Cursor/cursor-move.svg.meta new file mode 100755 index 0000000..b3efdd0 --- /dev/null +++ b/Assets/SVG Assets/Cursor/cursor-move.svg.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 41b6be3f02726104888f2c62cdc89fdf +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: a57477913897c46af95d590f580878bd, type: 3} + svgType: 2 + texturedSpriteMeshType: 0 + svgPixelsPerUnit: 100 + gradientResolution: 64 + alignment: 0 + customPivot: {x: 0, y: 0} + generatePhysicsShape: 0 + viewportOptions: 1 + preserveViewport: 0 + advancedMode: 0 + predefinedResolutionIndex: 1 + targetResolution: 1080 + resolutionMultiplier: 1 + stepDistance: 10 + samplingStepDistance: 100 + maxCordDeviationEnabled: 0 + maxCordDeviation: 1 + maxTangentAngleEnabled: 0 + maxTangentAngle: 5 + keepTextureAspectRatio: 1 + textureSize: 256 + textureWidth: 256 + textureHeight: 256 + wrapMode: 0 + filterMode: 1 + sampleCount: 4 + preserveSVGImageAspect: 0 + useSVGPixelsPerUnit: 0 + spriteData: + TessellationDetail: 0 + SpriteRect: + name: + originalName: + pivot: {x: 0, y: 0} + alignment: 0 + border: {x: 0, y: 0, z: 0, w: 0} + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + spriteID: 7ac0cef56711db84da3043e2df1db919 + internalID: 0 + PhysicsOutlines: [] diff --git a/Assets/SVG Assets/Cursor/cursor-pointer.svg b/Assets/SVG Assets/Cursor/cursor-pointer.svg new file mode 100755 index 0000000..b6b3d10 --- /dev/null +++ b/Assets/SVG Assets/Cursor/cursor-pointer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Assets/SVG Assets/Cursor/cursor-pointer.svg.meta b/Assets/SVG Assets/Cursor/cursor-pointer.svg.meta new file mode 100755 index 0000000..0ea8dd0 --- /dev/null +++ b/Assets/SVG Assets/Cursor/cursor-pointer.svg.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: d14431ce61c8d5748b32f4a3bcfd2994 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: a57477913897c46af95d590f580878bd, type: 3} + svgType: 2 + texturedSpriteMeshType: 0 + svgPixelsPerUnit: 100 + gradientResolution: 64 + alignment: 1 + customPivot: {x: 0, y: 0} + generatePhysicsShape: 0 + viewportOptions: 1 + preserveViewport: 0 + advancedMode: 0 + predefinedResolutionIndex: 1 + targetResolution: 1080 + resolutionMultiplier: 1 + stepDistance: 10 + samplingStepDistance: 100 + maxCordDeviationEnabled: 0 + maxCordDeviation: 1 + maxTangentAngleEnabled: 0 + maxTangentAngle: 5 + keepTextureAspectRatio: 1 + textureSize: 256 + textureWidth: 256 + textureHeight: 256 + wrapMode: 0 + filterMode: 1 + sampleCount: 4 + preserveSVGImageAspect: 0 + useSVGPixelsPerUnit: 0 + spriteData: + TessellationDetail: 0 + SpriteRect: + name: + originalName: + pivot: {x: 0, y: 0} + alignment: 0 + border: {x: 0, y: 0, z: 0, w: 0} + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + spriteID: edc7c3ad2b0d33d4ea0f92be66f1c3ac + internalID: 0 + PhysicsOutlines: [] diff --git a/Assets/SVG Assets/Gates.meta b/Assets/SVG Assets/Gates.meta new file mode 100755 index 0000000..41b4f7c --- /dev/null +++ b/Assets/SVG Assets/Gates.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06136048e487def4dab770f595af7ac0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SVG Assets/and.svg b/Assets/SVG Assets/Gates/and.svg similarity index 100% rename from Assets/SVG Assets/and.svg rename to Assets/SVG Assets/Gates/and.svg diff --git a/Assets/SVG Assets/and.svg.meta b/Assets/SVG Assets/Gates/and.svg.meta similarity index 100% rename from Assets/SVG Assets/and.svg.meta rename to Assets/SVG Assets/Gates/and.svg.meta diff --git a/Assets/SVG Assets/buffer.svg b/Assets/SVG Assets/Gates/buffer.svg similarity index 100% rename from Assets/SVG Assets/buffer.svg rename to Assets/SVG Assets/Gates/buffer.svg diff --git a/Assets/SVG Assets/buffer.svg.meta b/Assets/SVG Assets/Gates/buffer.svg.meta similarity index 100% rename from Assets/SVG Assets/buffer.svg.meta rename to Assets/SVG Assets/Gates/buffer.svg.meta diff --git a/Assets/SVG Assets/nand.svg b/Assets/SVG Assets/Gates/nand.svg similarity index 100% rename from Assets/SVG Assets/nand.svg rename to Assets/SVG Assets/Gates/nand.svg diff --git a/Assets/SVG Assets/nand.svg.meta b/Assets/SVG Assets/Gates/nand.svg.meta similarity index 100% rename from Assets/SVG Assets/nand.svg.meta rename to Assets/SVG Assets/Gates/nand.svg.meta diff --git a/Assets/SVG Assets/nor.svg b/Assets/SVG Assets/Gates/nor.svg similarity index 100% rename from Assets/SVG Assets/nor.svg rename to Assets/SVG Assets/Gates/nor.svg diff --git a/Assets/SVG Assets/nor.svg.meta b/Assets/SVG Assets/Gates/nor.svg.meta similarity index 100% rename from Assets/SVG Assets/nor.svg.meta rename to Assets/SVG Assets/Gates/nor.svg.meta diff --git a/Assets/SVG Assets/not.svg b/Assets/SVG Assets/Gates/not.svg similarity index 100% rename from Assets/SVG Assets/not.svg rename to Assets/SVG Assets/Gates/not.svg diff --git a/Assets/SVG Assets/not.svg.meta b/Assets/SVG Assets/Gates/not.svg.meta similarity index 100% rename from Assets/SVG Assets/not.svg.meta rename to Assets/SVG Assets/Gates/not.svg.meta diff --git a/Assets/SVG Assets/or.svg b/Assets/SVG Assets/Gates/or.svg similarity index 100% rename from Assets/SVG Assets/or.svg rename to Assets/SVG Assets/Gates/or.svg diff --git a/Assets/SVG Assets/or.svg.meta b/Assets/SVG Assets/Gates/or.svg.meta similarity index 100% rename from Assets/SVG Assets/or.svg.meta rename to Assets/SVG Assets/Gates/or.svg.meta diff --git a/Assets/SVG Assets/xnor.svg b/Assets/SVG Assets/Gates/xnor.svg similarity index 100% rename from Assets/SVG Assets/xnor.svg rename to Assets/SVG Assets/Gates/xnor.svg diff --git a/Assets/SVG Assets/xnor.svg.meta b/Assets/SVG Assets/Gates/xnor.svg.meta similarity index 100% rename from Assets/SVG Assets/xnor.svg.meta rename to Assets/SVG Assets/Gates/xnor.svg.meta diff --git a/Assets/SVG Assets/xor.svg b/Assets/SVG Assets/Gates/xor.svg similarity index 100% rename from Assets/SVG Assets/xor.svg rename to Assets/SVG Assets/Gates/xor.svg diff --git a/Assets/SVG Assets/xor.svg.meta b/Assets/SVG Assets/Gates/xor.svg.meta similarity index 100% rename from Assets/SVG Assets/xor.svg.meta rename to Assets/SVG Assets/Gates/xor.svg.meta diff --git a/Assets/SVG Assets/UI.meta b/Assets/SVG Assets/UI.meta new file mode 100755 index 0000000..c02b4ab --- /dev/null +++ b/Assets/SVG Assets/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7482c04d338ec1540a95ac19a43b5f41 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SVG Assets/UI/delete-empty.svg b/Assets/SVG Assets/UI/delete-empty.svg new file mode 100755 index 0000000..4b6246b --- /dev/null +++ b/Assets/SVG Assets/UI/delete-empty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Assets/SVG Assets/UI/delete-empty.svg.meta b/Assets/SVG Assets/UI/delete-empty.svg.meta new file mode 100755 index 0000000..db525f6 --- /dev/null +++ b/Assets/SVG Assets/UI/delete-empty.svg.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 2b0bec83cb4bdfa4082ea5a275e8ae55 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: a57477913897c46af95d590f580878bd, type: 3} + svgType: 4 + texturedSpriteMeshType: 0 + svgPixelsPerUnit: 100 + gradientResolution: 64 + alignment: 0 + customPivot: {x: 0, y: 0} + generatePhysicsShape: 0 + viewportOptions: 1 + preserveViewport: 0 + advancedMode: 0 + predefinedResolutionIndex: 1 + targetResolution: 1080 + resolutionMultiplier: 1 + stepDistance: 10 + samplingStepDistance: 100 + maxCordDeviationEnabled: 0 + maxCordDeviation: 1 + maxTangentAngleEnabled: 0 + maxTangentAngle: 5 + keepTextureAspectRatio: 1 + textureSize: 256 + textureWidth: 256 + textureHeight: 256 + wrapMode: 0 + filterMode: 1 + sampleCount: 4 + preserveSVGImageAspect: 1 + useSVGPixelsPerUnit: 0 + spriteData: + TessellationDetail: 0 + SpriteRect: + name: + originalName: + pivot: {x: 0, y: 0} + alignment: 0 + border: {x: 0, y: 0, z: 0, w: 0} + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + spriteID: 988cec3c3f3761a408fe798361b0becf + internalID: 0 + PhysicsOutlines: [] diff --git a/Assets/SVG Assets/UI/delete.svg b/Assets/SVG Assets/UI/delete.svg new file mode 100755 index 0000000..af4d951 --- /dev/null +++ b/Assets/SVG Assets/UI/delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Assets/SVG Assets/UI/delete.svg.meta b/Assets/SVG Assets/UI/delete.svg.meta new file mode 100755 index 0000000..834f319 --- /dev/null +++ b/Assets/SVG Assets/UI/delete.svg.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: ac6a92b2185049c489e96cdddf0efb50 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: a57477913897c46af95d590f580878bd, type: 3} + svgType: 4 + texturedSpriteMeshType: 0 + svgPixelsPerUnit: 100 + gradientResolution: 64 + alignment: 0 + customPivot: {x: 0, y: 0} + generatePhysicsShape: 0 + viewportOptions: 1 + preserveViewport: 0 + advancedMode: 0 + predefinedResolutionIndex: 1 + targetResolution: 1080 + resolutionMultiplier: 1 + stepDistance: 10 + samplingStepDistance: 100 + maxCordDeviationEnabled: 0 + maxCordDeviation: 1 + maxTangentAngleEnabled: 0 + maxTangentAngle: 5 + keepTextureAspectRatio: 1 + textureSize: 256 + textureWidth: 256 + textureHeight: 256 + wrapMode: 0 + filterMode: 1 + sampleCount: 4 + preserveSVGImageAspect: 1 + useSVGPixelsPerUnit: 0 + spriteData: + TessellationDetail: 0 + SpriteRect: + name: + originalName: + pivot: {x: 0, y: 0} + alignment: 0 + border: {x: 0, y: 0, z: 0, w: 0} + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 0 + height: 0 + spriteID: e2b516498d021984ea60cc316456b398 + internalID: 0 + PhysicsOutlines: [] diff --git a/Assets/Scenes/Workspace.unity b/Assets/Scenes/Workspace.unity index 872d485..40fda8d 100755 --- a/Assets/Scenes/Workspace.unity +++ b/Assets/Scenes/Workspace.unity @@ -205,6 +205,42 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &186568831 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 186568832} + m_Layer: 5 + m_Name: Moving Bar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &186568832 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 186568831} + 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: + - {fileID: 8894090343327815917} + m_Father: {fileID: 431027840} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 0} --- !u!1 &297330683 GameObject: m_ObjectHideFlags: 0 @@ -327,6 +363,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 881209085} + - {fileID: 186568832} m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -348,6 +385,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: GateBar: {fileID: 881209084} + MovingBar: {fileID: 186568831} UIGatePrefab: {fileID: 7325205278540948175, guid: eccdec2d2494caa4ba1b906d71a760f8, type: 3} --- !u!1 &519420028 GameObject: @@ -518,6 +556,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 11e573998e532eb42bdb43b80953d23f, type: 3} m_Name: m_EditorClassIdentifier: + DefaultCursor: {fileID: 6192944022281365145, guid: d0f05a0b5d7c9b241a26dbe09b647c63, type: 3} + PointerCursor: {fileID: 6192944022281365145, guid: d14431ce61c8d5748b32f4a3bcfd2994, type: 3} + MoveCursor: {fileID: 6192944022281365145, guid: 41b6be3f02726104888f2c62cdc89fdf, type: 3} --- !u!1 &543161298 GameObject: m_ObjectHideFlags: 0 @@ -670,7 +711,7 @@ GameObject: - component: {fileID: 881209087} - component: {fileID: 881209086} m_Layer: 5 - m_Name: GateBar + m_Name: Gate Bar m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -827,3 +868,128 @@ Transform: m_Father: {fileID: 1741727034} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &3254705316304510337 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8894090343327815917} + - component: {fileID: 8982662505155081090} + - component: {fileID: 5045999820264220717} + - component: {fileID: 3254705316304510339} + - component: {fileID: 3254705316304510338} + m_Layer: 0 + m_Name: DeleteTool + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &3254705316304510338 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3254705316304510337} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 07b6ed78fbbf4124794530c3e8451329, type: 3} + m_Name: + m_EditorClassIdentifier: + openImage: {fileID: 1718401066980627502, guid: 2b0bec83cb4bdfa4082ea5a275e8ae55, type: 3} +--- !u!114 &3254705316304510339 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3254705316304510337} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 5045999820264220717} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &5045999820264220717 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3254705316304510337} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ef8b96895a0ec4ba685178a052544251, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: 8d66e65c66e29504199ed664979682cd, type: 2} + 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: 3286163911610860551, guid: ac6a92b2185049c489e96cdddf0efb50, type: 3} + m_PreserveAspect: 1 +--- !u!224 &8894090343327815917 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3254705316304510337} + 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: 186568832} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 0} + m_Pivot: {x: 1, y: 0.5} +--- !u!222 &8982662505155081090 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3254705316304510337} + m_CullTransparentMesh: 0 diff --git a/Assets/Scripts/Cable.cs b/Assets/Scripts/Cable.cs index 55dbaea..51c6d12 100755 --- a/Assets/Scripts/Cable.cs +++ b/Assets/Scripts/Cable.cs @@ -94,7 +94,7 @@ namespace UntitledLogicGame { _line.positionCount = 2; _line.SetPosition(0, StartAnchor.transform.position); - _line.SetPosition(1, MouseManager.MousePos); + _line.SetPosition(1, PointerManager.MousePos); } else { diff --git a/Assets/Scripts/DefaultScript.cs b/Assets/Scripts/DefaultScript.cs new file mode 100755 index 0000000..b2d8d9e --- /dev/null +++ b/Assets/Scripts/DefaultScript.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace UntitledLogicGame +{ + //public class TODO : MonoBehaviour + //{ + // #region Unity Properties + + // #endregion + + // #region Public Properties + + // #endregion + + // #region Unity Methods + + // #endregion + + // #region Public Methods + + // #endregion + + // #region Private Methods + + // #endregion + //} + +} diff --git a/Assets/Scripts/DefaultScript.cs.meta b/Assets/Scripts/DefaultScript.cs.meta new file mode 100755 index 0000000..609a3b2 --- /dev/null +++ b/Assets/Scripts/DefaultScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1c4ef9ac47ea5c04ca839d0f92831e52 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index fef4b77..1fdc756 100755 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -38,7 +38,7 @@ namespace UntitledLogicGame public Gate CurrentGate { get; set; } - public MouseManager MouseManager { get; private set; } + public PointerManager MouseManager { get; private set; } #endregion @@ -54,7 +54,7 @@ namespace UntitledLogicGame if (Instance != null) throw new InvalidOperationException("More than one GameManager in scene"); Instance = this; - MouseManager = GetComponent(); + MouseManager = GetComponent(); } // Update is called once per frame @@ -70,7 +70,7 @@ namespace UntitledLogicGame public void CreateGate(Gate gatePrefab, Vector3 position) { var gate = Instantiate(gatePrefab, GatesGroup); - gate.transform.position = MouseManager.MousePos - gate.Box.transform.position; + gate.transform.position = PointerManager.MousePos - gate.Box.transform.position; MouseManager.DragGate(gate, true); } diff --git a/Assets/Scripts/MouseManager.cs b/Assets/Scripts/PointerManager.cs similarity index 50% rename from Assets/Scripts/MouseManager.cs rename to Assets/Scripts/PointerManager.cs index 27f50d3..e69729a 100755 --- a/Assets/Scripts/MouseManager.cs +++ b/Assets/Scripts/PointerManager.cs @@ -1,20 +1,25 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using Unity.VectorGraphics; using UnityEngine; namespace UntitledLogicGame { - public class MouseManager : MonoBehaviour + public class PointerManager : MonoBehaviour { #region Static Properties - public static MouseManager Instance => GameManager.Instance.MouseManager; + public static PointerManager Instance => GameManager.Instance.MouseManager; #endregion #region Unity Properties + public Texture2D DefaultCursor; + public Texture2D PointerCursor; + public Texture2D MoveCursor; + #endregion #region Public Properties @@ -23,26 +28,26 @@ namespace UntitledLogicGame public bool Interacting => _currentCable != null || _currentGate != null; + public bool MovingObject => _currentGate != null; + public static bool Clicking => Input.GetButton("Fire1"); + public bool DeleteOnRelease { get; set; } + #endregion #region Private Properties private Cable _currentCable; private Gate _currentGate; - private Vector3 _currentGateInitialPos; + private Vector3? _currentGateInitialPos; private Vector3 _currentGateDelta; + private Texture2D _currentCursor; #endregion #region Unity Methods - private void Start() - { - - } - private void FixedUpdate() { var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); @@ -82,29 +87,39 @@ namespace UntitledLogicGame } else if(_currentGate != null) { - foreach (var renderer in _currentGate.GetComponentsInChildren()) + if (DeleteOnRelease) { - renderer.sortingLayerName = "default"; + Destroy(_currentGate.gameObject); } - _currentGate.transform.position = _currentGate.transform.position.Round(); - var currentBox = _currentGate.Box; - if (FindObjectsOfType() - .Where(g => !g.Equals(_currentGate)) - .Select(g => g.Box) - .Any(b => currentBox.IsTouching(b))) + else { - // Collision with another gate - if(_currentGateInitialPos == null) + foreach (var renderer in _currentGate.GetComponentsInChildren()) { - Destroy(_currentGate.gameObject); + renderer.sortingLayerName = "default"; } - else + _currentGate.transform.position = _currentGate.transform.position.Round(); + var currentBox = _currentGate.Box; + if (FindObjectsOfType() + .Where(g => !g.Equals(_currentGate)) + .Select(g => g.Box) + .Any(b => currentBox.IsTouching(b))) { - _currentGate.transform.position = _currentGateInitialPos; // Reset pos + // Collision with another gate + if (_currentGateInitialPos == null) + { + Destroy(_currentGate.gameObject); + } + else + { + _currentGate.transform.position = _currentGateInitialPos.Value; // Reset pos + } } } _currentGate = null; + DeleteOnRelease = false; } + + SetCursor(); } #endregion @@ -115,18 +130,49 @@ namespace UntitledLogicGame { _currentGate = gate; _currentGateDelta = MousePos - _currentGate.transform.position; - if(!created) - _currentGateInitialPos = _currentGate.transform.position; + _currentGateInitialPos = created ? (Vector3?)null : _currentGate.transform.position; foreach (var renderer in _currentGate.GetComponentsInChildren()) { renderer.sortingLayerName = "moving"; } } + public void RequestDelete() + { + if (_currentGate != null) + { + Destroy(_currentGate.gameObject); + _currentGate = null; + } + } + #endregion #region Private Methods + private void SetCursor() + { + Texture2D cursor = DefaultCursor; + Vector2 position = Vector2.zero; + + if(!Interacting && GameManager.Instance.CurrentAnchor != null || Interacting && _currentCable != null) + { + cursor = PointerCursor; + position = new Vector2(cursor.width / 2f, 0f); + } + else if (!Interacting && GameManager.Instance.CurrentGate != null || Interacting && _currentGate != null) + { + cursor = MoveCursor; + position = new Vector2(cursor.width / 2f, cursor.height / 2f); + } + + if(_currentCursor != cursor) + { + Cursor.SetCursor(cursor, position, CursorMode.Auto); + _currentCursor = cursor; + } + } + #endregion } } \ No newline at end of file diff --git a/Assets/Scripts/MouseManager.cs.meta b/Assets/Scripts/PointerManager.cs.meta similarity index 100% rename from Assets/Scripts/MouseManager.cs.meta rename to Assets/Scripts/PointerManager.cs.meta diff --git a/Assets/Scripts/UI/UIDelete.cs b/Assets/Scripts/UI/UIDelete.cs new file mode 100755 index 0000000..c63e1e6 --- /dev/null +++ b/Assets/Scripts/UI/UIDelete.cs @@ -0,0 +1,58 @@ +using System.Collections; +using System.Collections.Generic; +using Unity.VectorGraphics; +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UntitledLogicGame.UI +{ + public class UIDelete : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler + { + #region Unity Properties + + public SVGImage openImage; + + #endregion + + #region Public Properties + + #endregion + + #region Private Properties + + private SVGImage _image; + private Sprite _closedSprite; + + #endregion + + #region Unity Methods + + private void Start() + { + _image = GetComponent(); + _closedSprite = _image.sprite; + } + + public void OnPointerEnter(PointerEventData eventData) + { + _image.sprite = openImage.sprite; + PointerManager.Instance.DeleteOnRelease = true; + } + + public void OnPointerExit(PointerEventData eventData) + { + _image.sprite = _closedSprite; + PointerManager.Instance.DeleteOnRelease = false; + } + + #endregion + + #region Public Methods + + #endregion + + #region Private Methods + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/UIDelete.cs.meta b/Assets/Scripts/UI/UIDelete.cs.meta new file mode 100755 index 0000000..267e0d7 --- /dev/null +++ b/Assets/Scripts/UI/UIDelete.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07b6ed78fbbf4124794530c3e8451329 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/UIManager.cs b/Assets/Scripts/UI/UIManager.cs index 94ad5d5..626ccb3 100755 --- a/Assets/Scripts/UI/UIManager.cs +++ b/Assets/Scripts/UI/UIManager.cs @@ -11,6 +11,7 @@ namespace UntitledLogicGame.UI [Header("Components")] public GameObject GateBar; + public GameObject MovingBar; [Header("Prefabs")] public UIGate UIGatePrefab; @@ -41,16 +42,18 @@ namespace UntitledLogicGame.UI uiGate.RectTransform.anchoredPosition = new Vector2(currentPos, 0); currentPos += uiGate.RectTransform.sizeDelta.x; } - + + MovingBar.SetActive(false); } private void FixedUpdate() { - if(MouseManager.Instance.Interacting != _lastMouseInteracting) + if(PointerManager.Instance.Interacting != _lastMouseInteracting) { //TODO animate go down - GateBar.SetActive(!MouseManager.Instance.Interacting); - _lastMouseInteracting = MouseManager.Instance.Interacting; + GateBar.SetActive(!PointerManager.Instance.Interacting); + MovingBar.SetActive(PointerManager.Instance.MovingObject); + _lastMouseInteracting = PointerManager.Instance.Interacting; } } diff --git a/TODO.txt b/TODO.txt index f98f66f..2bea966 100755 --- a/TODO.txt +++ b/TODO.txt @@ -3,8 +3,6 @@ TODO -(1) button gates -(1) led gates -(2) named anchors --(3) overlay to drag &drop new gates --(3) same but to destroy gates -(3) generic rect gates -(3) state gates -(5) cable management