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.
41 lines
1.0 KiB
41 lines
1.0 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.MessageSystem; |
|
using UnityEngine.UI; |
|
|
|
public class lineLengthShow : MonoBehaviour { |
|
|
|
// Use this for initialization |
|
void Start () |
|
{ |
|
MessageDispatcher.AddListener("SHOW_LINELENGTH", open); |
|
MessageDispatcher.AddListener("CLOSE_LINELENGTH", Close); |
|
gameObject.SetActive(false); |
|
} |
|
|
|
// Update is called once per frame |
|
void Update () { |
|
|
|
} |
|
void open(IMessage message) |
|
{ |
|
GameObject line = (GameObject)message.Data; |
|
float lineLength = line.transform.parent.GetComponent<lineParentMessage>().lineLength; |
|
gameObject.SetActive(true); |
|
gameObject.transform.Find("Text").GetComponent<Text>().text = lineLength.ToString("0.0")+"米"; |
|
|
|
|
|
} |
|
|
|
void Close(IMessage message) |
|
{ |
|
gameObject.SetActive(false); |
|
} |
|
|
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SHOW_LINELENGTH", open); |
|
MessageDispatcher.RemoveListener("CLOSE_LINELENGTH", Close); |
|
} |
|
}
|
|
|