|
@@ -7,7 +7,7 @@ using UnityEngine.EventSystems;
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
-public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
|
|
|
+public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandler,IPointerEnterHandler,IPointerExitHandler
|
|
|
{
|
|
|
public string[] childBtnNames = new string[] {
|
|
|
"ÊÓÆµ¼à¿Ø",
|
|
@@ -46,6 +46,8 @@ public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandle
|
|
|
public float lastTime;
|
|
|
|
|
|
public RectTransform addContent;
|
|
|
+
|
|
|
+ bool isOver;
|
|
|
void Awake() {
|
|
|
|
|
|
// arrow.DOLocalMoveY(-40, 1.0f).SetLoops(-1, LoopType.Yoyo);
|
|
@@ -86,8 +88,6 @@ public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandle
|
|
|
//});
|
|
|
}
|
|
|
public void Refresh(Sprite newIcon) {
|
|
|
- Debug.Log(newIcon);
|
|
|
- Debug.Log(bingObj.name);
|
|
|
icon.sprite = newIcon;
|
|
|
}
|
|
|
public void InitPoint(Sprite newIcon, string name_pri, string newText) {
|
|
@@ -101,15 +101,28 @@ public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandle
|
|
|
// Update is called once per frame
|
|
|
void LateUpdate()
|
|
|
{
|
|
|
- this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
|
|
|
-
|
|
|
- float bi = CameraManager.instance.secondCamera.GetComponent<CameraBirdSec>().currentDistance / 20;
|
|
|
- bi = (float)Math.Clamp(bi, 0.3, 1);
|
|
|
- this.GetComponent<RectTransform>().localScale = Vector3.one / bi;
|
|
|
+ if (CameraManager.instance.secondCamera.enabled)
|
|
|
+ {
|
|
|
+ this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
|
|
|
+ float bi = CameraManager.instance.secondCamera.GetComponent<CameraBirdSec>().currentDistance / 20;
|
|
|
+ bi = (float)Math.Clamp(bi, 0.3, 1);
|
|
|
+ this.GetComponent<RectTransform>().localScale = Vector3.one / bi;
|
|
|
+ if (CameraManager.instance.secondCamera.transform.position.z > -625)
|
|
|
+ {
|
|
|
+ text.gameObject.SetActive(true);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if(isOver)
|
|
|
+ text.gameObject.SetActive(true);
|
|
|
+ else
|
|
|
+ text.gameObject.SetActive(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void OnPointerDown(PointerEventData eventData)
|
|
|
{
|
|
|
+
|
|
|
if (eventData.button == PointerEventData.InputButton.Left)
|
|
|
{
|
|
|
lastTime = Time.time;
|
|
@@ -118,6 +131,7 @@ public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandle
|
|
|
|
|
|
public void OnPointerUp(PointerEventData eventData)
|
|
|
{
|
|
|
+
|
|
|
if (eventData.button == PointerEventData.InputButton.Left)
|
|
|
{
|
|
|
if (Time.time - lastTime < 0.5f)
|
|
@@ -128,7 +142,15 @@ public class RuntimePoint : MonoBehaviour, IPointerDownHandler, IPointerUpHandle
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ public void OnPointerEnter(UnityEngine.EventSystems.PointerEventData eventData)
|
|
|
+ {
|
|
|
+ isOver = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnPointerExit(UnityEngine.EventSystems.PointerEventData eventData)
|
|
|
+ {
|
|
|
+ isOver = false;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
-
|
|
|
}
|