public Peer(Settings settings, PeerDebug debug) : this(settings) { this.debug = debug; if (debug != null) { netManager.SimulatePacketLoss = debug.settings.simulatePacketLoss; netManager.SimulationPacketLossChance = debug.settings.packetLossChance; } }
public void StartServer(int port, PeerDebug.Settings debugSettings = null) { StatefulWorld.Instance.Initialize(authorityArbiter); PeerDebug debug = null; if (debugSettings != null) { debug = gameObject.AddComponent <PeerDebug>(); debug.Initialize(debugSettings); } server = new Peer(defaultPeerSettings, debug); server.OnReceivePeerId += OnReceivePeerId; server.Listen(port); server.OnPeerConnected += Server_OnPeerConnected; }
public void ConnectClient(string address, int port, PeerDebug.Settings debugSettings = null) { if (Server == null) { StatefulWorld.Instance.Initialize(); } PeerDebug debug = null; if (debugSettings != null && Server == null) { debug = gameObject.AddComponent <PeerDebug>(); debug.Initialize(debugSettings); } Client = new Client(defaultPeerSettings, debug); Client.Connect(address, port, Server != null); }
public void StartServer(int port, PeerDebug.Settings debugSettings = null) { StatefulWorld.Instance.Initialize(); PeerDebug debug = null; if (debugSettings != null) { debug = gameObject.AddComponent <PeerDebug>(); debug.Initialize(debugSettings); } Server = new Server(defaultPeerSettings, debug); Server.Listen(port); Server.OnPeerConnected += Server_OnPeerConnected; OnServerListen?.Invoke(); }
public Peer(PeerDebug debug) { this.debug = debug; listener = new EventBasedNetListener(); listener.NetworkReceiveEvent += Listener_NetworkReceiveEvent; listener.ConnectionRequestEvent += Listener_ConnectionRequestEvent; netManager = new NetManager(listener); netManager.AutoRecycle = false; if (debug != null) { netManager.SimulatePacketLoss = debug.settings.simulatePacketLoss; netManager.SimulationPacketLossChance = debug.settings.packetLossChance; } netDataWriter = new NetDataWriter(); queuedStatePackets = new Queue <NetPacketReader>(); }
public void ConnectClient(string address, int port, PeerDebug.Settings debugSettings = null) { if (server == null) { StatefulWorld.Instance.Initialize(authorityArbiter); } PeerDebug debug = null; if (debugSettings != null && server == null) { debug = gameObject.AddComponent <PeerDebug>(); debug.Initialize(debugSettings); } client = new Peer(defaultPeerSettings, debug); client.OnReceivePeerId += OnReceivePeerId; client.Connect(address, port, server != null); if (server != null) { server.HasListenClient = true; } }
public Server(Settings settings, PeerDebug debug) : base(settings, debug) { }
public Client(Settings settings, PeerDebug debug) : base(settings, debug) { }