示例#1
0
 private void OnConnected(NetworkMessage netMsg)
 {
     if (client.isConnected)
     {
         lobbyController.ActivePublicLobby();
         client.RegisterHandler(MyMsgType.ChatMsg, OnChatMessage);
         client.RegisterHandler(MyMsgType.JoinMsg, OnJoinMessage);
         LobbyInfo packet = new LobbyInfo();
         packet.sender = MyGameManager.user.Name;
         packet.currentActivePlayers = NetworkServer.connections.Count;
         client.Send(MyMsgType.JoinMsg, packet);
     }
 }
示例#2
0
    private void JoinMatch()
    {
        MyNetworkManager networkManager = FindObjectOfType <MyNetworkManager>();

        networkManager.JoinMatch(match);
        if (networkManager.IsClientConnected() && !ClientScene.ready)
        {
            ClientScene.Ready(networkManager.client.connection);
            if (ClientScene.localPlayers.Count == 0)
            {
                ClientScene.AddPlayer((short)0);
            }
        }
        manager.ActivePublicLobby();
    }