62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
|
using DG.Tweening;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class WorkmanUIManager : MonoBehaviour
|
|||
|
{
|
|||
|
public GameObject m_LineGo;
|
|||
|
private Tween m_LineTween;
|
|||
|
private Transform m_LineGoTarget;
|
|||
|
public Vector3 offset;
|
|||
|
// Start is called before the first frame update
|
|||
|
void Start()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
if (m_LineGo.activeSelf && m_LineGoTarget != null)
|
|||
|
{
|
|||
|
Vector3 v = Camera.main.WorldToScreenPoint(m_LineGoTarget.position);
|
|||
|
if (v.z > 0)
|
|||
|
{
|
|||
|
v.z = 0;
|
|||
|
m_LineGo.transform.position = v + offset;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
m_LineGo.transform.position = new Vector3(8888, 8888, 8888);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// չʾ<D5B9><CABE>ǩ
|
|||
|
/// </summary>
|
|||
|
/// <param name="code"></param>
|
|||
|
/// <param name="target"></param>
|
|||
|
/// <param name="isShow"></param>
|
|||
|
public void ShowLineGo(int type,string code, Transform target, bool isShow = true)
|
|||
|
{
|
|||
|
m_LineTween.Kill();
|
|||
|
m_LineGo.transform.GetChild(0).GetComponent<Image>().fillAmount = 0;
|
|||
|
m_LineGo.transform.GetChild(0).GetChild(0).gameObject.SetActive(false);
|
|||
|
m_LineGo.SetActive(false);
|
|||
|
if (!isShow)
|
|||
|
return;
|
|||
|
m_LineGoTarget = target;
|
|||
|
m_LineTween = m_LineGo.transform.GetChild(0).GetComponent<Image>().DOFillAmount(1, 0.5f).OnComplete(() =>
|
|||
|
{
|
|||
|
m_LineGo.transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>().text = type == 0 ? "<22><><EFBFBD><EFBFBD>" : "<22><><EFBFBD><EFBFBD>";
|
|||
|
m_LineGo.transform.GetChild(0).GetChild(0).GetChild(1).GetChild(0).GetChild(0).GetComponent<Text>().text = "\n" + code;//<color=#00000000><3E><><EFBFBD><EFBFBD></color>
|
|||
|
m_LineGo.transform.GetChild(0).GetChild(0).gameObject.SetActive(true);
|
|||
|
});
|
|||
|
m_LineGo.SetActive(isShow);
|
|||
|
}
|
|||
|
}
|