public void Init() { PlayerManager = new vxNetPlayerManager(this.Engine); var config = new NetPeerConfiguration(this.Engine.GameName) { //SimulatedMinimumLatency = 0.2f, // SimulatedLoss = 0.1f }; config.EnableMessageType(NetIncomingMessageType.WarningMessage); config.EnableMessageType(NetIncomingMessageType.VerboseDebugMessage); config.EnableMessageType(NetIncomingMessageType.ErrorMessage); config.EnableMessageType(NetIncomingMessageType.Error); config.EnableMessageType(NetIncomingMessageType.DebugMessage); config.EnableMessageType(NetIncomingMessageType.ConnectionApproval); config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); //config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated); this.netClient = new NetClient(config); this.netClient.Start(); PlayerInfo = new vxNetPlayerInfo(netClient.UniqueIdentifier, UserName, vxEnumNetPlayerStatus.None); ClientCallBackLoop = new SendOrPostCallback(ClientMsgCallback); this.netClient.RegisterReceivedCallback(ClientCallBackLoop); }
public vxNetworkServerManager(vxEngine engine, int defaultPort) { this.Engine = engine; this.defaultPort = defaultPort; PlayerManager = new vxNetPlayerManager(engine); //Why? Bc Linux hates me. if (SynchronizationContext.Current == null) { SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); } }