using DG.Tweening; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class RuntimePoint : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler { public Button btn; public Image textBase; public Text text; public Image icon; public StaticImportant staticImp; public List layerIDs = new List(); public RectTransform arrow; public GameObject bingObj; void Awake() { arrow.DOLocalMoveY(-40, 1.0f).SetLoops(-1, LoopType.Yoyo); } // Start is called before the first frame update void Start() { } public void InitPoint(Sprite newIcon, string name_pri, string newText) { text.text = newText; textBase.gameObject.SetActive(false); staticImp = StaticLod.instance.staticImportantsDic[name_pri]; icon.sprite = newIcon; } // Update is called once per frame void Update() { this.GetComponent().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width; } public void OnPointerEnter(PointerEventData eventData) { ((IPointerEnterHandler)btn).OnPointerEnter(eventData); textBase.gameObject.SetActive(true); textBase.fillAmount = 0; text.color = Color.clear; DOTween.To(() => textBase.fillAmount, x => textBase.fillAmount = x, 1, 0.25f).onComplete = ()=> { text.DOColor(Color.white, 0.25f); }; } public void OnPointerExit(PointerEventData eventData) { ((IPointerExitHandler)btn).OnPointerExit(eventData); textBase.gameObject.SetActive(false); } }