大连中石油电子沙盘
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.
 
 
 
 

28 lines
625 B

using UnityEngine;
using System.Collections;
using AX.MessageSystem;
public abstract class MessageBehaviour : MonoBehaviour
{
public virtual string MessageType
{
get { return this.GetType().Name; }
}
protected virtual void OnDestroy()
{
MessageDispatcher.RemoveListener(MessageType, Execute);
}
protected virtual void OnEnable()
{
MessageDispatcher.AddListener(MessageType, Execute);
}
protected virtual void OnDisable()
{
MessageDispatcher.RemoveListener(MessageType, Execute);
}
protected abstract void Execute(IMessage message);
}