1
0
Fork 0
LaboratoryProtection/Assets/UnityTest/ZXL/Scripts/UI/RoleLabel.cs

41 lines
951 B
C#

using System;
using Mono.Event;
using TMPro;
using UnityEngine;
namespace UnityTest.ZXL
{
public class RoleLabel : MonoBehaviour
{
public RoleLabelType roleLabelType;
public TextMeshProUGUI roleName;
public TextMeshProUGUI speakContent;
private void Awake()
{
EventManager.Instance.Subscribe(RoleLabelEventArgs.EventId, RoleLabelEvent);
roleName.text = roleLabelType.ToString();
}
private void RoleLabelEvent(object sender, GameEventArgs e)
{
var args = e as RoleLabelEventArgs;
speakContent.text = args.speakContent;
}
private void OnDestroy()
{
EventManager.Instance.Unsubscribe(RoleLabelEventArgs.EventId, RoleLabelEvent);
}
}
public enum RoleLabelType
{
A,
B,
C,
D,
F,
G,
}
}