Пример #1
0
        public override void Connected(BoltConnection connection)
        {
            var joinToken = (JoinToken)connection.ConnectToken;

            if (BoltNetwork.IsServer)
            {
                var playerCount = 1 + SWMatchmaking.GetCurrentLobbyPlayerCount();
                LobbyPlayerJoined lobbyPlayerJoinedEvent = LobbyPlayerJoined.Create();
                lobbyPlayerJoinedEvent.LobbyPlayerCount = playerCount;
                lobbyPlayerJoinedEvent.PlayerID         = (int)connection.ConnectionId;
                lobbyPlayerJoinedEvent.PlayerNickname   = joinToken.Nickname;
                lobbyPlayerJoinedEvent.Send();
            }
        }
Пример #2
0
 public override void OnEvent(LobbyPlayerJoined evnt)
 {
     CreatePlayerEntry(evnt.PlayerNickname);
     UpdateCurrentPlayerCount(evnt.LobbyPlayerCount);
 }