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.
54 lines
1.5 KiB
54 lines
1.5 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.MessageSystem; |
|
using UnityEngine.UI; |
|
using AX.TrackRecord; |
|
|
|
public class LeftShowSprict : MonoBehaviour { |
|
|
|
/// <summary> |
|
/// 用于右下角提示信息 |
|
/// </summary> |
|
private InputField LeftText; |
|
private Button CloseBtn; |
|
|
|
private void Awake() |
|
{ |
|
MessageDispatcher.AddListener("LeftShowEvent", LeftShowEvent); |
|
MessageDispatcher.AddListener("ControlLeftEvent", ControlLeftEvent); |
|
LeftText = this.transform.Find("Scroll View/Viewport/InputField").GetComponent<InputField>(); |
|
CloseBtn = this.transform.Find("Button").GetComponent<Button>(); |
|
CloseBtn.onClick.AddListener(CloseThis); |
|
this.gameObject.SetActive(false); |
|
LeftText.text = ""; |
|
} |
|
public void CloseThis() |
|
{ |
|
this.gameObject.SetActive(false); |
|
} |
|
public void LeftShowEvent(IMessage mess) |
|
{ |
|
ObjAttribute oriObj = (ObjAttribute)mess.Data; |
|
LeftText.text = oriObj.TopName; |
|
this.gameObject.SetActive(true); |
|
if (LeftText.text.Equals("")) |
|
{ |
|
this.gameObject.SetActive(false); |
|
} |
|
} |
|
public void ControlLeftEvent(IMessage mess) |
|
{ |
|
this.gameObject.SetActive(false); |
|
} |
|
|
|
private void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("LeftShowEvent", LeftShowEvent); |
|
MessageDispatcher.RemoveListener("ControlLeftEvent", ControlLeftEvent); |
|
} |
|
|
|
|
|
|
|
|
|
}
|
|
|