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.
43 lines
952 B
43 lines
952 B
3 years ago
|
using UnityEngine;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
/// <summary>
|
||
|
/// 隐藏名称,挂载在预设物体上
|
||
|
/// </summary>
|
||
|
public class YinCangMingCheng : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
GameObject showName;
|
||
|
void Start()
|
||
|
{
|
||
|
MessageDispatcher.AddListener("NameControl", NameControl);
|
||
|
showName = this.gameObject.transform.Find("info").gameObject;
|
||
|
if (!gameObject.name.Contains("nametext"))
|
||
|
{
|
||
|
showName.SetActive(false);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public static bool HasName = true;
|
||
|
void NameControl(IMessage message)
|
||
|
{
|
||
|
bool show = (bool)message.Data;
|
||
|
|
||
|
if (show)
|
||
|
{
|
||
|
showName.SetActive(true);
|
||
|
HasName = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
showName.SetActive(false);
|
||
|
HasName = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("NameControl", NameControl);
|
||
|
}
|
||
|
|
||
|
}
|