static void stop(string name, string message, NetEndpoint enpoint) { watches[name].Stop(); switch (enpoint) { case NetEndpoint.CLIENT: Client.print("info", string.Format("{0} : {1} ms", message, watches[name].ElapsedMilliseconds)); break; case NetEndpoint.SERVER: Server.print("info", string.Format("{0} : {1} ms", message, watches[name].ElapsedMilliseconds)); break; } watches.Remove(name); }
public static void handle(NetIncomingMessage message, NetEndpoint endpoint) { PacketID id = (PacketID)message.ReadInt32(); switch (endpoint) { case NetEndpoint.NONE: break; case NetEndpoint.CLIENT: handlers[id].onclientrecieve(message); break; case NetEndpoint.SERVER: handlers[id].onserverrecieve(message); break; } }
static void start(string name, string message, NetEndpoint endpoint) { Stopwatch w = new Stopwatch(); w.Start(); watches.Add(name, w); switch (endpoint) { case NetEndpoint.CLIENT: Client.print("info", message); break; case NetEndpoint.SERVER: Server.print("info", message); break; } }
public static T write <T>(NetEndpoint endpoint) where T : Packet, new() { T t = new T(); t.endpoint = endpoint; switch (endpoint) { case NetEndpoint.NONE: break; case NetEndpoint.CLIENT: t.outgoingmessage = Client.net.CreateMessage(); break; case NetEndpoint.SERVER: t.outgoingmessage = Server.net.CreateMessage(); break; } t.writedefault(); return(t); }