123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- using System;
- using UnityEngine;
- namespace Mirror
- {
- // Deprecated 2020-10-06
- [Obsolete("Implement NetworkMessage instead. Use extension methods instead of Serialize/Deserialize, see https://github.com/vis2k/Mirror/pull/2317", true)]
- public interface IMessageBase {}
- // Deprecated 2020-10-06
- [Obsolete("Implement NetworkMessage instead. Use extension methods instead of Serialize/Deserialize, see https://github.com/vis2k/Mirror/pull/2317", true)]
- public class MessageBase : IMessageBase {}
- public struct ReadyMessage : NetworkMessage {}
- public struct NotReadyMessage : NetworkMessage {}
- public struct AddPlayerMessage : NetworkMessage {}
- public struct SceneMessage : NetworkMessage
- {
- public string sceneName;
- // Normal = 0, LoadAdditive = 1, UnloadAdditive = 2
- public SceneOperation sceneOperation;
- public bool customHandling;
- }
- public enum SceneOperation : byte
- {
- Normal,
- LoadAdditive,
- UnloadAdditive
- }
- public struct CommandMessage : NetworkMessage
- {
- public uint netId;
- public int componentIndex;
- public int functionHash;
- // the parameters for the Cmd function
- // -> ArraySegment to avoid unnecessary allocations
- public ArraySegment<byte> payload;
- }
- public struct RpcMessage : NetworkMessage
- {
- public uint netId;
- public int componentIndex;
- public int functionHash;
- // the parameters for the Cmd function
- // -> ArraySegment to avoid unnecessary allocations
- public ArraySegment<byte> payload;
- }
- public struct SpawnMessage : NetworkMessage
- {
- // netId of new or existing object
- public uint netId;
- public bool isLocalPlayer;
- // Sets hasAuthority on the spawned object
- public bool isOwner;
- public ulong sceneId;
- // If sceneId != 0 then it is used instead of assetId
- public Guid assetId;
- // Local position
- public Vector3 position;
- // Local rotation
- public Quaternion rotation;
- // Local scale
- public Vector3 scale;
- // serialized component data
- // ArraySegment to avoid unnecessary allocations
- public ArraySegment<byte> payload;
- }
- public struct ObjectSpawnStartedMessage : NetworkMessage {}
- public struct ObjectSpawnFinishedMessage : NetworkMessage {}
- public struct ObjectDestroyMessage : NetworkMessage
- {
- public uint netId;
- }
- public struct ObjectHideMessage : NetworkMessage
- {
- public uint netId;
- }
- public struct EntityStateMessage : NetworkMessage
- {
- public uint netId;
- // the serialized component data
- // -> ArraySegment to avoid unnecessary allocations
- public ArraySegment<byte> payload;
- }
- // A client sends this message to the server
- // to calculate RTT and synchronize time
- public struct NetworkPingMessage : NetworkMessage
- {
- public double clientTime;
- public NetworkPingMessage(double value)
- {
- clientTime = value;
- }
- }
- // The server responds with this message
- // The client can use this to calculate RTT and sync time
- public struct NetworkPongMessage : NetworkMessage
- {
- public double clientTime;
- public double serverTime;
- }
- }
|