public ListenerSession(int port, NetworkPool pool) { endpoint = new IPEndPoint(IPAddress.Loopback, port); client = pool.New(); client.Bind(); }
public void Execute(PeerConnectorContext context) { NetworkPool pool = context.Dependencies.Network; NetworkConnection connection = pool.Create(socket, NetworkDirection.Outgoing, endpoint); context.Hooks.CallConnectionEstablished(connection); }
public static void SaveJSON(NetworkPool pool) { string SavePath = System.IO.Directory.GetCurrentDirectory().ToString() + "//" + "NetworkPool//White//"; string output = JsonConvert.SerializeObject(pool); File.WriteAllText(SavePath + ".json", output); Console.ForegroundColor = ConsoleColor.DarkGreen; }
public HandshakeNegotiatorPassive(NetworkPool pool, NetworkConnection connection, HandshakeNegotiatorPassiveContext context, HandshakeNegotiatorHooks hooks) { this.context = context; this.hooks = hooks; this.connection = new HandshakeConnection(pool, connection, hooks); this.credentials = HandshakeCryptography.Generate(); this.keys = new HandshakeKeyContainer(); }
public ConnectorSession(NetworkPool pool, PeerConnector connector) { int?port; this.connector = connector; this.server = pool.New(); server.Bind(out port); server.Listen(1); endpoint = new IPEndPoint(IPAddress.Loopback, port.Value); }
/// <summary> /// Creates a networked object pool. Can only be called from the server /// </summary> /// <param name="poolName">Name of the pool</param> /// <param name="spawnablePrefabIndex">The index of the prefab to use in the spawnablePrefabs array</param> /// <param name="size">The amount of objects in the pool</param> public static void CreatePool(string poolName, int spawnablePrefabIndex, uint size = 16) { if (!NetworkingManager.singleton.isServer) { Debug.LogWarning("MLAPI: Pools can only be created on the server"); return; } NetworkPool pool = new NetworkPool(spawnablePrefabIndex, size, PoolIndex); PoolNamesToIndexes.Add(poolName, PoolIndex); PoolIndex++; }
/// <summary> /// Creates a networked object pool. Can only be called from the server /// </summary> /// <param name="poolName">Name of the pool</param> /// <param name="spawnablePrefabIndex">The index of the prefab to use in the spawnablePrefabs array</param> /// <param name="size">The amount of objects in the pool</param> public static void CreatePool(string poolName, int spawnablePrefabIndex, uint size = 16) { if (!NetworkingManager.singleton.isServer) { if (LogHelper.CurrentLogLevel <= LogLevel.Normal) { LogHelper.LogWarning("Pools can only be created on the server"); } return; } NetworkPool pool = new NetworkPool(spawnablePrefabIndex, size, PoolIndex); PoolNamesToIndexes.Add(poolName, PoolIndex); PoolIndex++; }
public void RpcCreateCard() { // Spawn player card object _PlayerCardGO = NetworkPool.ServerSpawn(MenuCardPrefab, Vector3.zero, Quaternion.identity); _PlayerCardGO.transform.SetParent(NetworkingMenuManager.Instance.FolderPlayerCards); // Set position in 2D space RectTransform rect = _PlayerCardGO.GetComponent <RectTransform>(); rect.localPosition = new Vector2(0f, 0f); rect.anchoredPosition = new Vector2(0, -40 - (NetworkingMenuManager.Instance.numPlayers - 1) * 80); rect.sizeDelta = new Vector2(0, 80); //rect.rect.Set(0f, 0f, rect.rect.width, rect.rect.height); //rect.rect.position.Set(rect.rect.position.x, -40 - (NetworkingMenuManager.Instance.numPlayers - 1) * 80); }
public ConnectorFixture() { pipeline = new LeakPipeline(); pipeline.Start(); worker = new CompletionThread(); worker.Start(); pool = new NetworkPoolBuilder() .WithPipeline(pipeline) .WithWorker(worker) .WithMemory(new ConnectorMemory()) .Build(); pool.Start(); hooks = new PeerConnectorHooks(); }
public LoopFixture() { pipeline = new LeakPipeline(); pipeline.Start(); worker = new CompletionThread(); worker.Start(); pool = new NetworkPoolBuilder() .WithPipeline(pipeline) .WithWorker(worker) .WithMemory(new LoopMemory()) .Build(); pool.Start(); hooks = new ReceiverHooks(); samples = new LoopSamples(); }
public NegotiatorFixture() { pipeline = new LeakPipeline(); pipeline.Start(); worker = new CompletionThread(); worker.Start(); pool = new NetworkPoolBuilder() .WithPipeline(pipeline) .WithWorker(worker) .WithMemory(new NegotiatorMemory()) .Build(); pool.Start(); hooks = new HandshakeNegotiatorHooks(); negotiator = new HandshakeNegotiatorBuilder() .WithNetwork(pool) .Build(hooks); }
public HandshakeNegotiatorBuilder WithNetwork(NetworkPool network) { dependencies.Network = network; return(this); }
public PeerListenerBuilder WithNetwork(NetworkPool network) { dependencies.Network = network; return(this); }
public HandshakeConnection(NetworkPool pool, NetworkConnection connection, HandshakeNegotiatorHooks hooks) { this.pool = pool; this.connection = connection; this.hooks = hooks; }
public PeerConnectorBuilder WithNetwork(NetworkPool network) { dependencies.Network = network; return(this); }