mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Finished replacing comment walls with regions. (#558)
This commit is contained in:
parent
17ab8ae30a
commit
896551eb00
@ -304,8 +304,7 @@ public void SetTrigger(int hash)
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------ server message handlers -------------------
|
||||
|
||||
#region server message handlers
|
||||
[Command]
|
||||
void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, byte[] parameters)
|
||||
{
|
||||
@ -331,8 +330,9 @@ void CmdOnAnimationTriggerServerMessage(int hash)
|
||||
HandleAnimTriggerMsg(hash);
|
||||
RpcOnAnimationTriggerClientMessage(hash);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ------------------ client message handlers -------------------
|
||||
#region client message handlers
|
||||
[ClientRpc]
|
||||
void RpcOnAnimationClientMessage(int stateHash, float normalizedTime, byte[] parameters)
|
||||
{
|
||||
@ -351,5 +351,6 @@ void RpcOnAnimationTriggerClientMessage(int hash)
|
||||
{
|
||||
HandleAnimTriggerMsg(hash);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ public virtual void Deserialize(NetworkReader reader) {}
|
||||
public virtual void Serialize(NetworkWriter writer) {}
|
||||
}
|
||||
|
||||
// ---------- General Typed Messages -------------------
|
||||
|
||||
#region General Typed Messages
|
||||
public class StringMessage : MessageBase
|
||||
{
|
||||
public string value;
|
||||
@ -132,9 +131,9 @@ public override void Deserialize(NetworkReader reader) {}
|
||||
|
||||
public override void Serialize(NetworkWriter writer) {}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ---------- Public System Messages -------------------
|
||||
|
||||
#region Public System Messages
|
||||
public class ErrorMessage : ByteMessage {}
|
||||
|
||||
public class ReadyMessage : EmptyMessage {}
|
||||
@ -155,9 +154,9 @@ public SceneMessage(string value) : base(value) {}
|
||||
|
||||
public SceneMessage() {}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ---------- System Messages requried for code gen path -------------------
|
||||
|
||||
#region System Messages requried for code gen path
|
||||
// remote calls like Rpc/Cmd/SyncEvent all use the same message type
|
||||
class RemoteCallMessage : MessageBase
|
||||
{
|
||||
@ -188,9 +187,9 @@ class CommandMessage : RemoteCallMessage {}
|
||||
class RpcMessage : RemoteCallMessage {}
|
||||
|
||||
class SyncEventMessage : RemoteCallMessage {}
|
||||
#endregion
|
||||
|
||||
// ---------- Internal System Messages -------------------
|
||||
|
||||
#region Internal System Messages
|
||||
class SpawnPrefabMessage : MessageBase
|
||||
{
|
||||
public uint netId;
|
||||
@ -279,7 +278,7 @@ public override void Serialize(NetworkWriter writer)
|
||||
}
|
||||
}
|
||||
|
||||
class OwnerMessage : MessageBase
|
||||
class OwnerMessage : MessageBase
|
||||
{
|
||||
public uint netId;
|
||||
|
||||
@ -358,4 +357,5 @@ public override void Serialize(NetworkWriter writer)
|
||||
writer.Write(serverTime);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -69,8 +69,7 @@ protected void InitSyncObject(SyncObject syncObject)
|
||||
m_SyncObjects.Add(syncObject);
|
||||
}
|
||||
|
||||
// ----------------------------- Commands --------------------------------
|
||||
|
||||
#region Commands
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
protected void SendCommandInternal(Type invokeClass, string cmdName, NetworkWriter writer, int channelId)
|
||||
{
|
||||
@ -112,9 +111,9 @@ public virtual bool InvokeCommand(int cmdHash, NetworkReader reader)
|
||||
{
|
||||
return InvokeHandlerDelegate(cmdHash, MirrorInvokeType.Command, reader);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Client RPCs --------------------------------
|
||||
|
||||
#region Client RPCs
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
protected void SendRPCInternal(Type invokeClass, string rpcName, NetworkWriter writer, int channelId)
|
||||
{
|
||||
@ -182,9 +181,9 @@ public virtual bool InvokeRPC(int rpcHash, NetworkReader reader)
|
||||
{
|
||||
return InvokeHandlerDelegate(rpcHash, MirrorInvokeType.ClientRpc, reader);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Sync Events --------------------------------
|
||||
|
||||
#region Sync Events
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
protected void SendEventInternal(Type invokeClass, string eventName, NetworkWriter writer, int channelId)
|
||||
{
|
||||
@ -211,9 +210,9 @@ public virtual bool InvokeSyncEvent(int eventHash, NetworkReader reader)
|
||||
{
|
||||
return InvokeHandlerDelegate(eventHash, MirrorInvokeType.SyncEvent, reader);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Code Gen Path Helpers --------------------------------
|
||||
|
||||
#region Code Gen Path Helpers
|
||||
public delegate void CmdDelegate(NetworkBehaviour obj, NetworkReader reader);
|
||||
|
||||
protected class Invoker
|
||||
@ -298,9 +297,9 @@ internal bool InvokeHandlerDelegate(int cmdHash, MirrorInvokeType invokeType, Ne
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Helpers --------------------------------
|
||||
|
||||
#region Helpers
|
||||
// helper function for [SyncVar] GameObjects.
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
protected void SetSyncVarGameObject(GameObject newGameObject, ref GameObject gameObjectField, ulong dirtyBit, ref uint netIdField)
|
||||
@ -406,6 +405,7 @@ protected void SetSyncVar<T>(T value, ref T fieldValue, ulong dirtyBit)
|
||||
fieldValue = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// these are masks, not bit numbers, ie. 0x004 not 2
|
||||
public void SetDirtyBit(ulong dirtyBit)
|
||||
|
@ -521,8 +521,7 @@ public static void Shutdown()
|
||||
singleton = null;
|
||||
}
|
||||
|
||||
// ----------------------------- Server Internal Message Handlers --------------------------------
|
||||
|
||||
#region Server Internal Message Handlers
|
||||
internal void OnServerConnectInternal(NetworkConnection conn, ConnectMessage connectMsg)
|
||||
{
|
||||
if (LogFilter.Debug) Debug.Log("NetworkManager.OnServerConnectInternal");
|
||||
@ -571,9 +570,9 @@ internal void OnServerErrorInternal(NetworkConnection conn, ErrorMessage msg)
|
||||
if (LogFilter.Debug) Debug.Log("NetworkManager.OnServerErrorInternal");
|
||||
OnServerError(conn, msg.value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Client Internal Message Handlers --------------------------------
|
||||
|
||||
#region Client Internal Message Handlers
|
||||
internal void OnClientConnectInternal(NetworkConnection conn, ConnectMessage message)
|
||||
{
|
||||
if (LogFilter.Debug) Debug.Log("NetworkManager.OnClientConnectInternal");
|
||||
@ -624,9 +623,9 @@ internal void OnClientSceneInternal(NetworkConnection conn, SceneMessage msg)
|
||||
ClientChangeScene(newSceneName, true);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Server System Callbacks --------------------------------
|
||||
|
||||
#region Server System Callbacks
|
||||
public virtual void OnServerConnect(NetworkConnection conn) {}
|
||||
|
||||
public virtual void OnServerDisconnect(NetworkConnection conn)
|
||||
@ -714,9 +713,9 @@ public virtual void OnServerRemovePlayer(NetworkConnection conn, NetworkIdentity
|
||||
public virtual void OnServerError(NetworkConnection conn, int errorCode) {}
|
||||
|
||||
public virtual void OnServerSceneChanged(string sceneName) {}
|
||||
#endregion
|
||||
|
||||
// ----------------------------- Client System Callbacks --------------------------------
|
||||
|
||||
#region Client System Callbacks
|
||||
public virtual void OnClientConnect(NetworkConnection conn)
|
||||
{
|
||||
if (!clientLoadedScene)
|
||||
@ -758,9 +757,9 @@ public virtual void OnClientSceneChanged(NetworkConnection conn)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//------------------------------ Start & Stop callbacks -----------------------------------
|
||||
|
||||
#region Start & Stop callbacks
|
||||
// Since there are multiple versions of StartServer, StartClient and StartHost, to reliably customize
|
||||
// their functionality, users would need override all the versions. Instead these callbacks are invoked
|
||||
// from all versions, so users only need to implement this one case.
|
||||
@ -771,5 +770,6 @@ public virtual void OnStartClient(NetworkClient client) {}
|
||||
public virtual void OnStopServer() {}
|
||||
public virtual void OnStopClient() {}
|
||||
public virtual void OnStopHost() {}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public static bool WriteArguments(ILProcessor worker, MethodDefinition md, strin
|
||||
return true;
|
||||
}
|
||||
|
||||
// mark / check type as processed //////////////////////////////////////
|
||||
#region mark / check type as processed
|
||||
public const string ProcessedFunctionName = "MirrorProcessed";
|
||||
|
||||
// by adding an empty MirrorProcessed() function
|
||||
@ -161,7 +161,7 @@ public static void MarkAsProcessed(TypeDefinition td)
|
||||
td.Methods.Add(versionMethod);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
#endregion
|
||||
|
||||
void GenerateConstants()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user