Header 가려져도 입력 받는 버그 수정 -> IPointer로 변경
@@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acc4b1e5f93cd4a4aa6d3bd4079f0edd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -47,7 +47,7 @@ GameObject:
|
||||
- component: {fileID: 9204995643987852086}
|
||||
- component: {fileID: 209865376421846872}
|
||||
- component: {fileID: 2793802434066311975}
|
||||
- component: {fileID: 2197936757255736108}
|
||||
- component: {fileID: 6645463022349938702}
|
||||
m_Layer: 0
|
||||
m_Name: Panel_PropertyViewer
|
||||
m_TagString: Untagged
|
||||
@@ -97,7 +97,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: fb1e19639613a2047b9d9e30dbbc4bda, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &2197936757255736108
|
||||
--- !u!114 &6645463022349938702
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -109,16 +109,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: f9c6f8c6f0c462a4ab09d615c0d0db6c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
header: {fileID: 6397375499865491079}
|
||||
cursor_Up: {fileID: 2800000, guid: 40a8ef17dc9780c4085eb2001e1c9ac1, type: 3}
|
||||
cursor_Down: {fileID: 2800000, guid: 40a8ef17dc9780c4085eb2001e1c9ac1, type: 3}
|
||||
cursor_Left: {fileID: 2800000, guid: 5704ce039ab9a4d41bce815832591a2f, type: 3}
|
||||
cursor_Right: {fileID: 2800000, guid: 5704ce039ab9a4d41bce815832591a2f, type: 3}
|
||||
cursor_UpLeft: {fileID: 2800000, guid: 5b69212126b91114ea8f0a926d77c519, type: 3}
|
||||
cursor_UpRight: {fileID: 2800000, guid: 2b62059c6b03f004db5a180b61188820, type: 3}
|
||||
cursor_DownLeft: {fileID: 2800000, guid: 2b62059c6b03f004db5a180b61188820, type: 3}
|
||||
cursor_DownRight: {fileID: 2800000, guid: 5b69212126b91114ea8f0a926d77c519, type: 3}
|
||||
handleThickness: 20
|
||||
header: {fileID: 0}
|
||||
handleThickness: 5
|
||||
minWidth: 100
|
||||
minHeight: 100
|
||||
--- !u!1 &2890558069500370452
|
||||
@@ -813,6 +805,7 @@ GameObject:
|
||||
- component: {fileID: 6397375499865491079}
|
||||
- component: {fileID: 5628262866029505794}
|
||||
- component: {fileID: 6358404172700766806}
|
||||
- component: {fileID: 6294065871480346027}
|
||||
m_Layer: 0
|
||||
m_Name: header
|
||||
m_TagString: Untagged
|
||||
@@ -863,7 +856,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.6399964, g: 0.7080321, b: 0.8867924, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
@@ -879,6 +872,18 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &6294065871480346027
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9159401479681750991}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fa81ed666c3432441a47113a8812fc7c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &9199202964201904026
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
8
Assets/Resources/Images.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf13f4beefc9b5a4d97fcce1a2e1dafa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
79
Assets/Scripts/Studio/Managers/CursorManager.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XED.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class CursorManager : MonoBehaviour
|
||||
{
|
||||
Texture2D cursor_Up;
|
||||
Texture2D cursor_Down;
|
||||
Texture2D cursor_Left;
|
||||
Texture2D cursor_Right;
|
||||
Texture2D cursor_UpLeft;
|
||||
Texture2D cursor_UpRight;
|
||||
Texture2D cursor_DownLeft;
|
||||
Texture2D cursor_DownRight;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
cursor_Up = Resources.Load<Texture2D>("Images/cursor_vertical");
|
||||
cursor_Down = Resources.Load<Texture2D>("Images/cursor_vertical");
|
||||
cursor_Left = Resources.Load<Texture2D>("Images/cursor_horizontal");
|
||||
cursor_Right = Resources.Load<Texture2D>("Images/cursor_horizontal");
|
||||
cursor_UpLeft = Resources.Load<Texture2D>("Images/cursor_diag_a");
|
||||
cursor_UpRight = Resources.Load<Texture2D>("Images/cursor_diag_b");
|
||||
cursor_DownLeft = Resources.Load<Texture2D>("Images/cursor_diag_b");
|
||||
cursor_DownRight = Resources.Load<Texture2D>("Images/cursor_diag_a");
|
||||
}
|
||||
/*
|
||||
public void ChangeMouseCursor()
|
||||
{
|
||||
if (state == GUIState.Resize)
|
||||
return;
|
||||
|
||||
switch (GetHandleDirection())
|
||||
{
|
||||
case Direction.Up:
|
||||
ChangeCursor(cursor_Up);
|
||||
break;
|
||||
case Direction.Down:
|
||||
ChangeCursor(cursor_Down);
|
||||
break;
|
||||
case Direction.Left:
|
||||
ChangeCursor(cursor_Left);
|
||||
break;
|
||||
case Direction.Right:
|
||||
ChangeCursor(cursor_Right);
|
||||
break;
|
||||
case Direction.UpLeft:
|
||||
ChangeCursor(cursor_UpLeft);
|
||||
break;
|
||||
case Direction.UpRight:
|
||||
ChangeCursor(cursor_UpRight);
|
||||
break;
|
||||
case Direction.DownLeft:
|
||||
ChangeCursor(cursor_DownLeft);
|
||||
break;
|
||||
case Direction.DownRight:
|
||||
ChangeCursor(cursor_DownRight);
|
||||
break;
|
||||
case Direction.None:
|
||||
ChangeCursor(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
public void ChangeCursor(Texture2D cursorTexture)
|
||||
{
|
||||
Vector2 hotspot = new Vector2(16, 16);
|
||||
|
||||
if (cursorTexture == null)
|
||||
{
|
||||
hotspot = Vector2.zero;
|
||||
}
|
||||
|
||||
Cursor.SetCursor(cursorTexture, hotspot, CursorMode.Auto);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Studio/Managers/CursorManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23783baffd622ff438e68f32651014a5
|
||||
@@ -35,21 +35,13 @@ namespace XED.UI
|
||||
[SerializeField]
|
||||
RectTransform header;
|
||||
|
||||
[SerializeField]
|
||||
Texture2D cursor_Up;
|
||||
[SerializeField]
|
||||
Texture2D cursor_Down;
|
||||
[SerializeField]
|
||||
Texture2D cursor_Left;
|
||||
[SerializeField]
|
||||
Texture2D cursor_Right;
|
||||
[SerializeField]
|
||||
Texture2D cursor_UpLeft;
|
||||
[SerializeField]
|
||||
Texture2D cursor_UpRight;
|
||||
[SerializeField]
|
||||
Texture2D cursor_DownLeft;
|
||||
[SerializeField]
|
||||
Texture2D cursor_DownRight;
|
||||
|
||||
Vector2 mousePos;
|
||||
@@ -60,7 +52,7 @@ namespace XED.UI
|
||||
Vector2 initialSize;
|
||||
Vector2 initialPivot;
|
||||
|
||||
public float handleThickness = 20f;
|
||||
public float handleThickness = 5f;
|
||||
public float minWidth = 100;
|
||||
public float minHeight = 100;
|
||||
|
||||
@@ -75,6 +67,15 @@ namespace XED.UI
|
||||
{
|
||||
gameObject.AddComponent<RectMask2D>();
|
||||
}
|
||||
|
||||
cursor_Up = Resources.Load<Texture2D>("Images/cursor_vertical");
|
||||
cursor_Down = Resources.Load<Texture2D>("Images/cursor_vertical");
|
||||
cursor_Left = Resources.Load<Texture2D>("Images/cursor_horizontal");
|
||||
cursor_Right = Resources.Load<Texture2D>("Images/cursor_horizontal");
|
||||
cursor_UpLeft = Resources.Load<Texture2D>("Images/cursor_diag_a");
|
||||
cursor_UpRight = Resources.Load<Texture2D>("Images/cursor_diag_b");
|
||||
cursor_DownLeft = Resources.Load<Texture2D>("Images/cursor_diag_b");
|
||||
cursor_DownRight = Resources.Load<Texture2D>("Images/cursor_diag_a");
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -106,10 +107,6 @@ namespace XED.UI
|
||||
{
|
||||
SetResizeState(handleDirection);
|
||||
}
|
||||
else if (mouseDown && IsRectContainsMouse(header))
|
||||
{
|
||||
SetMoveState();
|
||||
}
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@@ -122,14 +119,6 @@ namespace XED.UI
|
||||
}
|
||||
}
|
||||
|
||||
bool IsRectContainsMouse(RectTransform range)
|
||||
{
|
||||
Vector2 localPoint;
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(range, mousePos, null, out localPoint);
|
||||
|
||||
return header.rect.Contains(localPoint);
|
||||
}
|
||||
|
||||
Direction GetHandleDirection()
|
||||
{
|
||||
Vector2 localPoint;
|
||||
@@ -161,7 +150,7 @@ namespace XED.UI
|
||||
else return Direction.None;
|
||||
}
|
||||
|
||||
void SetMoveState()
|
||||
public void SetMoveState()
|
||||
{
|
||||
mouseOffset = transform.position - Input.mousePosition;
|
||||
state = GUIState.Move;
|
||||
@@ -212,9 +201,7 @@ namespace XED.UI
|
||||
void Move()
|
||||
{
|
||||
Vector2 mousePos = Input.mousePosition;
|
||||
Vector2 panelPos = transform.position;
|
||||
Vector2 headerPos = transform.position;
|
||||
Vector2 panelMovePos = mousePos - (headerPos - panelPos) + mouseOffset;
|
||||
Vector2 panelMovePos = mousePos + mouseOffset;
|
||||
|
||||
transform.position = panelMovePos;
|
||||
}
|
||||
@@ -332,7 +319,7 @@ namespace XED.UI
|
||||
Cursor.SetCursor(cursorTexture, hotspot, CursorMode.Auto);
|
||||
}
|
||||
|
||||
void InitializeState()
|
||||
public void InitializeState()
|
||||
{
|
||||
state = GUIState.None;
|
||||
SetPanelPivot(initialPivot);
|
||||
|
||||
44
Assets/Scripts/Studio/UI/Tag/UI_GUIWindowHeader.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class UI_GUIWindowHeader : UIBase, IPointerDownHandler, IPointerUpHandler
|
||||
{
|
||||
UI_GUIWindow parentGUIWindow;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
parentGUIWindow = GetParentGUIWindow();
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
parentGUIWindow.SetMoveState();
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
parentGUIWindow.InitializeState();
|
||||
}
|
||||
|
||||
UI_GUIWindow GetParentGUIWindow()
|
||||
{
|
||||
Transform parent = transform;
|
||||
|
||||
while (parent != null)
|
||||
{
|
||||
UI_GUIWindow guiWindow = parent.GetComponent<UI_GUIWindow>();
|
||||
if (guiWindow != null)
|
||||
{
|
||||
return guiWindow;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
Debug.LogError("Header°¡ GUIWindow°¡ ¾Æ´Ñ °÷¿¡ ÀÖÀ½: " + gameObject.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Studio/UI/Tag/UI_GUIWindowHeader.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa81ed666c3432441a47113a8812fc7c
|
||||