Exemplo n.º 1
0
        public bool TestNetworkPacketSerialization()
        {
            Color sourceColor = new Color(.1f, .2f, .3f);
            NetworkMessageStruct networkMessageStruct = new NetworkMessageStruct
            {
                Type    = MessageType.ColorChange,
                Message = SerializeColor(sourceColor)
            };

            byte[] serializeMessage = networkMessageStruct.Serialize();
            NetworkMessageStruct deserializedStruct = NetworkMessageStruct.Deserialize(serializeMessage);

            return(networkMessageStruct.Type == deserializedStruct.Type && VerifyColor(sourceColor, DeserializeColor(deserializedStruct.Message)));
        }
Exemplo n.º 2
0
 protected override void SendMessage(NetworkMessageStruct message)
 {
     Debug.Log("Send message to all friends");
     UnityMCSessionNativeInterface.GetMcSessionNativeInterface().SendToAllPeers(message.Serialize());
 }