예제 #1
0
        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}");
        }
예제 #2
0
 private void OnSetPlayerId(SetPlayerId setPlayerId)
 {
     SetMyPlayerId?.Invoke(setPlayerId);
 }
예제 #3
0
 private void GameClientOnSetMyPlayerId(SetPlayerId setPlayerId)
 {
     _myPlayerId = setPlayerId.PlayerId;
     SetMyPlayerId?.Invoke(_myPlayerId);
 }