From 9dc5ab96a00d24e97b7f96c9c5f6660d59d781cf Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 1 Jan 2019 00:12:50 +0100 Subject: [PATCH] MonoBehaviourProcessor - switch (#211) --- .../Processors/MonoBehaviourProcessor.cs | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs b/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs index 51510f869..3bcb4ad82 100644 --- a/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs +++ b/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs @@ -67,28 +67,27 @@ void ProcessMethods() var attrName = ca.Constructor.DeclaringType.ToString(); - if (attrName == "Mirror.ServerAttribute") + switch (attrName) { - Log.Error("Script " + m_td.FullName + " uses the attribute [Server] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; - } - else if (attrName == "Mirror.ServerCallbackAttribute") - { - Log.Error("Script " + m_td.FullName + " uses the attribute [ServerCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; - } - else if (attrName == "Mirror.ClientAttribute") - { - Log.Error("Script " + m_td.FullName + " uses the attribute [Client] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; - } - else if (attrName == "Mirror.ClientCallbackAttribute") - { - Log.Error("Script " + m_td.FullName + " uses the attribute [ClientCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; + case "Mirror.ServerAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [Server] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; + case "Mirror.ServerCallbackAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [ServerCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; + case "Mirror.ClientAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [Client] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; + case "Mirror.ClientCallbackAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [ClientCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; } } } } } -} +} \ No newline at end of file