mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-04 03:39:55 +00:00
22 lines
716 B
C#
22 lines
716 B
C#
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
|
|
namespace QSB.Messaging
|
|
{
|
|
// Extend this to create new message handlers.
|
|
// You'll also need to create a new message type (add it to the enum).
|
|
public abstract class MessageHandler : MonoBehaviour
|
|
{
|
|
protected abstract MessageType Type { get; }
|
|
|
|
private void Awake()
|
|
{
|
|
NetworkServer.RegisterHandler((short)Type, OnServerReceiveMessage);
|
|
NetworkManager.singleton.client.RegisterHandler((short)Type, OnClientReceiveMessage);
|
|
}
|
|
|
|
protected abstract void OnClientReceiveMessage(NetworkMessage netMsg);
|
|
protected abstract void OnServerReceiveMessage(NetworkMessage netMsg);
|
|
}
|
|
}
|