Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class ReceiveableMonobehaviour : RegisterableMonobehaviour {
- /// <summary>
- /// Should return the accepted CMD for packets.
- /// </summary>
- /// <returns></returns>
- protected virtual String validCMD() { return "null"; }
- /// <summary>
- /// Should return the valid message/key in the receiving packet.
- /// </summary>
- /// <returns></returns>
- protected virtual String validMessage() { return "null"; }
- }
- public abstract class MultiReceivableMonobehaviour : ReceiveableMonobehaviour {
- /// <summary>
- /// This method overrides the original Receiver.received(); method to make it execute the actions instead of the process method.
- /// </summary>
- /// <param name="cmd"></param>
- /// <param name="msg"></param>
- /// <param name="packet"></param>
- protected override void received(String cmd, ISFSObject packet) {
- UnityEngine.Debug.Log("<INCOMING : CMD -> "+cmd+" CMD 2 -> "+validCMD()+ " Packet -> "+inPacket(packet));
- if (!validCMD().Equals(cmd)) return;
- if (!inPacket(packet)) return;
- string msg = getFromPacket(packet);
- if (bypass(msg)) {
- // DO Stuff
- }
- // DO OTHER STUFF
- }
- protected override string validMessage() { throw new System.NotImplementedException(); }
- }
- public abstract class GameScreen : MultiReceivableMonobehaviour, Transferable { // MORE STUFF }
- public class LeaderboardsScreen : GameScreen {
- // THIS never gets overriden somehow... calling this.received(cmd, packet) calls validCMD(); which return "null"...
- protected override String validCMD() { return "LeaderboardManager_Fire"; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement