35 lines
791 B
C#
35 lines
791 B
C#
using System;
|
|
using Mono.Event;
|
|
using UnityEngine;
|
|
|
|
namespace UnityTest.ZXL
|
|
{
|
|
public class GoSetActive : MonoBehaviour
|
|
{
|
|
[SerializeField] private GoType _goType;
|
|
|
|
private void Awake()
|
|
{
|
|
EventManager.Instance.Subscribe(GoSetActiveEventArgs.EventId, GoSetActiveEvent);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
EventManager.Instance.Unsubscribe(GoSetActiveEventArgs.EventId, GoSetActiveEvent);
|
|
}
|
|
|
|
private void GoSetActiveEvent(object sender, GameEventArgs e)
|
|
{
|
|
var args = e as GoSetActiveEventArgs;
|
|
if (_goType == args.goType)
|
|
{
|
|
gameObject.SetActive(args.isShow);
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum GoType
|
|
{
|
|
UI_BG,
|
|
}
|
|
} |