드래그 드롭 기능 추가
This commit is contained in:
8
Assets/Image/Icon_Models.meta
Normal file
8
Assets/Image/Icon_Models.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c05a99d8cf1b4b84ab2c9c2b0f221c46
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Image/Icon_Models/20250509_094549.png
Normal file
BIN
Assets/Image/Icon_Models/20250509_094549.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
156
Assets/Image/Icon_Models/20250509_094549.png.meta
Normal file
156
Assets/Image/Icon_Models/20250509_094549.png.meta
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 139199fe692cbf5438e88cba88a4ddff
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: WindowsStoreApps
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
customData:
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spriteCustomMetadata:
|
||||||
|
entries: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
96
Assets/Model/Prefab/RoboArm.prefab
Normal file
96
Assets/Model/Prefab/RoboArm.prefab
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &7878818223652967094
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1439687411083752964}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: RoboArm
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1439687411083752964
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7878818223652967094}
|
||||||
|
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:
|
||||||
|
- {fileID: 3620657965575071337}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1001 &1391276699247169683
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 1439687411083752964}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 0.7071068
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: -0.7071068
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3830498635656615575, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: SK_RoboArm
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
--- !u!4 &3620657965575071337 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2409962319127623418, guid: e2907fa722608cd48b6862704dc147f3, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1391276699247169683}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
7
Assets/Model/Prefab/RoboArm.prefab.meta
Normal file
7
Assets/Model/Prefab/RoboArm.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: aa03919166c49844b80fa473ca7f6074
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
24
Assets/Scripts/UI/UIButtonToggle.cs
Normal file
24
Assets/Scripts/UI/UIButtonToggle.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UIButtonToggle : MonoBehaviour
|
||||||
|
{
|
||||||
|
public bool isPressed = false;
|
||||||
|
public UnityEvent onPressed;
|
||||||
|
public UnityEvent onReleased;
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
Button button = GetComponent<Button>();
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
|
button.onClick.AddListener(
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
isPressed = !isPressed;
|
||||||
|
if (isPressed) onPressed?.Invoke();
|
||||||
|
else onReleased?.Invoke();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/UI/UIButtonToggle.cs.meta
Normal file
2
Assets/Scripts/UI/UIButtonToggle.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e97dd21b324d80a468a071d9171b5f77
|
||||||
@@ -4,16 +4,14 @@ using UnityEngine.EventSystems;
|
|||||||
|
|
||||||
public class UIDragSpawner : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
|
public class UIDragSpawner : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
|
||||||
{
|
{
|
||||||
|
public RectTransform rectTransform;
|
||||||
public GameObject prefabToSpawn;
|
public GameObject prefabToSpawn;
|
||||||
public Canvas canvas;
|
public LayerMask mask;
|
||||||
private RectTransform rectTransform;
|
|
||||||
private CanvasGroup canvasGroup;
|
|
||||||
private GameObject dragPreview;
|
private GameObject dragPreview;
|
||||||
|
private CanvasGroup canvasGroup;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
rectTransform = GetComponent<RectTransform>();
|
|
||||||
//canvasGroup = gameObject.AddComponent<CanvasGroup>();
|
|
||||||
canvasGroup = gameObject.GetOrAddComponent<CanvasGroup>();
|
canvasGroup = gameObject.GetOrAddComponent<CanvasGroup>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,15 +22,18 @@ public class UIDragSpawner : MonoBehaviour, IBeginDragHandler, IDragHandler, IEn
|
|||||||
canvasGroup.alpha = 0.6f;
|
canvasGroup.alpha = 0.6f;
|
||||||
canvasGroup.blocksRaycasts = false;
|
canvasGroup.blocksRaycasts = false;
|
||||||
|
|
||||||
dragPreview = Instantiate(gameObject, canvas.transform);
|
dragPreview = Instantiate(prefabToSpawn);
|
||||||
dragPreview.GetComponent<CanvasGroup>().blocksRaycasts = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDrag(PointerEventData eventData)
|
public void OnDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
if (dragPreview)
|
if (dragPreview)
|
||||||
{
|
{
|
||||||
dragPreview.GetComponent<RectTransform>().position = eventData.position;
|
Ray ray = Camera.main.ScreenPointToRay(eventData.position);
|
||||||
|
if (Physics.Raycast(ray, out RaycastHit hit, 100.0f, mask))
|
||||||
|
{
|
||||||
|
dragPreview.transform.position = hit.point;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,13 +42,14 @@ public class UIDragSpawner : MonoBehaviour, IBeginDragHandler, IDragHandler, IEn
|
|||||||
canvasGroup.alpha = 1f;
|
canvasGroup.alpha = 1f;
|
||||||
canvasGroup.blocksRaycasts = true;
|
canvasGroup.blocksRaycasts = true;
|
||||||
|
|
||||||
if (dragPreview)
|
if (IsPointerOverScrollRect(rectTransform))
|
||||||
Destroy(dragPreview);
|
|
||||||
|
|
||||||
Ray ray = Camera.main.ScreenPointToRay(eventData.position);
|
|
||||||
if (Physics.Raycast(ray, out RaycastHit hit))
|
|
||||||
{
|
{
|
||||||
Instantiate(prefabToSpawn, hit.point, Quaternion.identity);
|
Destroy(dragPreview);
|
||||||
|
dragPreview = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool IsPointerOverScrollRect(RectTransform rt)
|
||||||
|
{
|
||||||
|
return RectTransformUtility.RectangleContainsScreenPoint(rt, Input.mousePosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
--- !u!78 &1
|
--- !u!78 &1
|
||||||
TagManager:
|
TagManager:
|
||||||
serializedVersion: 2
|
serializedVersion: 3
|
||||||
tags: []
|
tags: []
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
@@ -11,7 +11,7 @@ TagManager:
|
|||||||
-
|
-
|
||||||
- Water
|
- Water
|
||||||
- UI
|
- UI
|
||||||
-
|
- Ground
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
@@ -50,27 +50,3 @@ TagManager:
|
|||||||
- Light Layer 5
|
- Light Layer 5
|
||||||
- Light Layer 6
|
- Light Layer 6
|
||||||
- Light Layer 7
|
- Light Layer 7
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
|
|||||||
Reference in New Issue
Block a user