Commit 94a9b12d authored by 16이진형's avatar 16이진형

ui 클릭되면 double click 무시

parent 833ef0ae
......@@ -829,7 +829,7 @@ GameObject:
- component: {fileID: 502908128}
m_Layer: 5
m_Name: DoubleClickPanel
m_TagString: Untagged
m_TagString: panel
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......
......@@ -68,65 +68,32 @@ public class UIManager : MonoBehaviour
ped.position = Input.mousePosition;
List<RaycastResult> results = new List<RaycastResult>();
gr.Raycast(ped, results);
if (results.Count != 0)
{
GameObject obj = results[0].gameObject;
if(obj.tag == "VelocitySlider")
bool isIgnored = true;
//ui 클릭시.
foreach (RaycastResult re in results)
{
GameObject obj = re.gameObject;
//panel만 있는지 검사.
isIgnored &= (obj.tag == "ignored");
//Debug.Log(obj);
//슬라이더일때
if (obj.tag == "VelocitySlider")
{
sliderflag = 1;
if (_pathUI.activeSelf == true && prevSelectPathNum != -1)
{
square.pathVelocity[prevSelectPathNum + 1] = velocityslider.GetLogScaleValue();
pathVelocity.text = "Velocity: " + square.GetPathVelocity(prevSelectPathNum).ToString() + "c";
break;
}
}
}
else
if (isIgnored)
{
RaycastHit hit1;
RaycastHit hit2;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit1))
{
ray = playercamera.ViewportPointToRay(hit1.textureCoord);
if (Physics.Raycast(ray, out hit2))
{
var obj = hit2.collider.gameObject;
if (obj.tag == "path")
{
int pathNum = int.Parse(obj.name.Substring(13));
if (pathNum != prevSelectPathNum)
{
updatePathInfo(obj, pathNum);
var mouseClickPosition = getMouseClickPosition(hit1);
var v = getDestVector(mouseClickPosition - middlePoint, new Vector3(hit2.point.x, hit2.point.z, 0.0f), pathNum);
_pathUI.transform.position = mouseClickPosition + v;
_pathUI.SetActive(true);
prevSelectPathNum = pathNum;
}
else
{
_pathUI.SetActive(false);
prevSelectPathNum = -1;
sliderflag = 0;
}
}
else
{
_pathUI.SetActive(false);
prevSelectPathNum = -1;
sliderflag = 0;
}
}
}
//클릭된 ui가 패널만 있을때.
TryFIndPath();
}
}
else if(sliderflag == 1 && Input.GetMouseButton(0))
......@@ -208,6 +175,52 @@ public class UIManager : MonoBehaviour
velocityslider.UpdateValuebyVelocity(square.GetPathVelocity(pathNum));
}
private void TryFIndPath()
{
RaycastHit hit1;
RaycastHit hit2;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit1))
{
ray = playercamera.ViewportPointToRay(hit1.textureCoord);
if (Physics.Raycast(ray, out hit2))
{
var obj = hit2.collider.gameObject;
Debug.Log(obj.tag);
if (obj.tag == "path")
{
int pathNum = int.Parse(obj.name.Substring(13));
if (pathNum != prevSelectPathNum)
{
updatePathInfo(obj, pathNum);
var mouseClickPosition = getMouseClickPosition(hit1);
var v = getDestVector(mouseClickPosition - middlePoint, new Vector3(hit2.point.x, hit2.point.z, 0.0f), pathNum);
_pathUI.transform.position = mouseClickPosition + v;
_pathUI.SetActive(true);
prevSelectPathNum = pathNum;
}
else
{
_pathUI.SetActive(false);
prevSelectPathNum = -1;
sliderflag = 0;
}
}
else
{
_pathUI.SetActive(false);
prevSelectPathNum = -1;
sliderflag = 0;
}
}
}
}
/// <summary>
/// 현재 지정된 path를 시작합니다.
/// </summary>
......
......@@ -7,6 +7,8 @@ TagManager:
- path
- pathui
- VelocitySlider
- doubleclick
- panel
layers:
- Default
- TransparentFX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment