Commit 8864b943 authored by 17김현학's avatar 17김현학

PathUI is placed at destination of path regardless of screensize

parent 2e620bee
......@@ -1290,9 +1290,9 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1988874618}
- {fileID: 1843084269}
- {fileID: 1749798926}
- {fileID: 1988874618}
m_Father: {fileID: 219938175}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -3288,7 +3288,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 699256181}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
......@@ -3655,7 +3655,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 699256181}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
......@@ -3813,12 +3813,12 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 699256181}
m_RootOrder: 2
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.000011921, y: 27.1}
m_SizeDelta: {x: 86.75, y: 30}
m_AnchoredPosition: {x: 0.000002861, y: 30.6}
m_SizeDelta: {x: 99.82, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1988874619
MonoBehaviour:
......
......@@ -21,8 +21,8 @@ public class Square : FlatLandObject
return v.y / v.x;
}
public Vector3 GetMiddlePoint(int st, int en)
public Vector3 GetDestPoint(int n)
{
return (pathList[en] - pathList[st]) / 2;
return pathList[n + 1];
}
}
\ No newline at end of file
......@@ -20,11 +20,17 @@ public class UIManager : MonoBehaviour
public GameObject _pathUI;
public LevelManager Levelmanager;
private int prevSelectPathNum = -1;
private Text pathName;
private Vector3 middlePoint;
private float Screenfactor;
// Start is called before the first frame update
void Start()
{
pathName = _pathUI.transform.GetComponentInChildren<Text>();
_pathUI.SetActive(false);
middlePoint = _pathUI.transform.position;
Screenfactor = Screen.width / 862.0f * 2.5f;
}
// Update is called once per frame
......@@ -52,7 +58,8 @@ public class UIManager : MonoBehaviour
if (pathNum != prevSelectPathNum)
{
_pathUI.transform.Find("Name").GetComponent<Text>().text = obj.name;
pathName.text = obj.name;
_pathUI.transform.position = middlePoint + (square.GetDestPoint(pathNum) + new Vector3(0, 300, 0)) * Screenfactor;
_pathUI.SetActive(true);
prevSelectPathNum = pathNum;
}
......
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