public static ModPacket GetPacketTo(INetHandler target, Mod mod) { int id; if (!handlersInverse.TryGetValue(target, out id)) { throw new ArgumentException(); } ModPacket packet = mod.GetPacket(); if (prefix != 0) { packet.Write(prefix); } if (bigIds) { packet.Write((UInt16)id); } else { packet.Write((byte)id); } return(packet); }
public static void AddHandler(INetHandler handler) { if (inited) { throw new InvalidOperationException(); } loadList.Add(handler); }
internal NetClient(INetHandler netHandler) { if (netHandler == null) { throw new JKClientException(new ArgumentNullException(nameof(netHandler))); } this.net = new NetSystem(); this.NetHandler = netHandler; this.packetReceived = new byte[this.NetHandler.MaxMessageLength]; }
public static void DispatchResponse(INetHandler NetHandler, byte[] Buffer, int Size) { ushort ResponseID = BitConverter.ToUInt16(Buffer, 0); switch ((ERecvMsgType)ResponseID) { case ERecvMsgType.T_TURN: NetHandler.Message(new CRecvMsgTurn(Buffer)); return; case ERecvMsgType.T_WELCOME: NetHandler.Message(new CRecvMsgWelcome(Buffer)); return; default: Debug.LogError("Network Response " + ResponseID + " unknown"); return; } ; }
public CNet() { // TODO: The net class needs a way to interact with GameSession or something? _netHandler = null; }
//--------------------------------------- public UDPClient(INetHandler handler) { m_Handler = handler; }
public TCPClient(INetHandler cmd) { m_Handler = cmd; }
public TcpNetChannel(INetHandler handler) { this._handler = handler; this._handler.OnEventRaised += _handler_OnMessageRaised; this.ct = tokenSource.Token; }
public TCPClient(INetHandler handle) { _mHandler = handle; }