quantum-space-buddies/QSB/Messaging/MessageHandler.cs
Ricardo Lopes 0de3879998
Wake up sync (#2)
* Add networksync on wake up

* Attempt

* Added log to screen

* Better debug screen logging

* I'm an idiot

* Wake up client when waking up server

* Set initial sector

* Server use OnClientReceiveMessage

* Cleanup

* Prevent server from waking itself

* Pass id values as number

* Woops

* Best I can do sorry

* Revert "Best I can do sorry"

This reverts commit f3f0fbdb2edb72365dd948775e377a3debd56411.

* Ignore a bunch of sectors earlier

* Cleanup

* Message type enum

* Some comments
2020-02-14 22:14:24 +01:00

19 lines
690 B
C#

using UnityEngine;
using UnityEngine.Networking;
namespace QSB {
// 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; }
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);
}
}