public void StartLobby(string playerName, int port) { if (_server != null) { return; } _server = new Server(port, new IdJsonSerialization()); _server.OnClientConnected += ServerOnOnClientConnected; _server.OnClientDisonnected += ServerOnOnClientDisonnected; _server.Start(); _hostPlayer = new LobbyPlayer(1, playerName, Color.Blue, PlayerPosition.Position1); SetMyPlayerId?.Invoke(1); LobbyPlayersUpdate(); ServerChatSendMessage($"Initialization založeno hráčem {playerName} a naslouchá na portu: {port}"); }
private void OnSetPlayerId(SetPlayerId setPlayerId) { SetMyPlayerId?.Invoke(setPlayerId); }
private void GameClientOnSetMyPlayerId(SetPlayerId setPlayerId) { _myPlayerId = setPlayerId.PlayerId; SetMyPlayerId?.Invoke(_myPlayerId); }