You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.7 KiB
55 lines
1.7 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.EventSystems; |
|
|
|
public class SetNodePlane : MonoBehaviour, IPointerEnterHandler,IPointerExitHandler |
|
{ |
|
/// <summary> |
|
/// 用于右侧面板触发显隐 |
|
/// </summary> |
|
|
|
|
|
private Animator Ani; |
|
private Vector3 velocity = Vector3.zero; |
|
void Start () |
|
{ |
|
Ani = this.transform.GetComponent<Animator>(); |
|
} |
|
Vector3 ShowtargetPosition = new Vector3(-190, -495, 0); |
|
Vector3 HidetargetPosition = new Vector3(203, -495, 0); |
|
bool Enter = false; |
|
bool Hide = false; |
|
public void OnPointerEnter(PointerEventData eventData) |
|
{ |
|
Hide = false; |
|
Enter = true; |
|
|
|
|
|
} |
|
public void OnPointerExit(PointerEventData eventData) |
|
{ |
|
Hide = true; |
|
Enter = false; |
|
} |
|
void Update() |
|
{ |
|
if (Enter) |
|
{ |
|
transform.GetComponent<RectTransform>().anchoredPosition = Vector3.SmoothDamp(transform.GetComponent<RectTransform>().anchoredPosition, ShowtargetPosition, ref velocity, 0.1f); |
|
} |
|
if (Hide) |
|
{ |
|
transform.GetComponent<RectTransform>().anchoredPosition = Vector3.SmoothDamp(transform.GetComponent<RectTransform>().anchoredPosition, HidetargetPosition, ref velocity, 0.1f); |
|
} |
|
|
|
//ToolbarObject父对象在移动指挥终端模式下,start里设置隐藏了,但是找不着其他地方哪里又设置成true了,所以在这里特殊处理下 |
|
if (ModeHelper.Mode == Mode.MobileCommunication) |
|
{ |
|
if (transform.parent.gameObject.activeSelf) |
|
{ |
|
transform.parent.gameObject.SetActive(false); |
|
} |
|
} |
|
} |
|
}
|
|
|