Created
August 8, 2017 03:46
-
-
Save dimmduh/90460dcf70adc4d930fc1ec50697e587 to your computer and use it in GitHub Desktop.
MNF ProtobufDispatcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using MNF; | |
| using UnityEngine; | |
| public class ProtobufDispatcher : DefaultDispatchHelper<ProtobufSession> | |
| { | |
| public override bool OnInit() | |
| { | |
| if (ExportFunctionFromEnum<ProtobufMessageDefine.ENUM_TCP_MESSAGES>() == false) | |
| return false; | |
| return true; | |
| } | |
| private int onTCP_NEW_ADD_MESSAGE(TCPSession session, object message) | |
| { | |
| // var udpMessageInfo = (UdpMessageInfo)message; | |
| // LogManager.Instance.Write("{0}, {1}, {2}", udpMessageInfo.RemoteIP, udpMessageInfo.UdpMessage, udpMessageInfo.IsSendMe); | |
| var data = (byte[]) message; | |
| Debug.Log("Income22: " + data.Length); | |
| Debug.Log("2: " + data[2]); | |
| return 0; | |
| } | |
| } | |
| public class ProtobufMessageDefine | |
| { | |
| public enum ENUM_TCP_MESSAGES | |
| { | |
| TCP_NEW_ADD_MESSAGE, | |
| TCP_SHOT | |
| } | |
| public class PACK_TCP_NEW_ADD_MESSAGE | |
| { | |
| public PACK_TCP_NEW_ADD_MESSAGE() | |
| { | |
| Debug.Log("PACK_TCP_NEW_ADD_MESSAGE"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment