void OnConnectedToServer()
 {
     Debug.Log("OnConnectedToServer");
     proxy = VoiceChatNetworkUtils.CreateProxy();
     gameObject.AddComponent <VoiceChatUi>();
     isConnected = true;
 }
 public override void OnStopClient()
 {
     VoiceChatNetworkProxy.OnManagerStopClient();
     VoiceChatRecorder.Instance.AutoDetectSpeech = false;
     VoiceChatRecorder.Instance.StopRecording();
     fsm.StateTrans(FSM.State.Unconnected);
 }
Exemple #3
0
        public override void OnStopClient()
        {
            VoiceChatNetworkProxy.OnManagerStopClient();

            //if (client != null)
            //    Destroy(GetComponent<VoiceChatUi>());
        }
Exemple #4
0
    //void OnGUI () {
    void Update()
    {
        // When the server is started then issue a "LoadLevel" RPC call for the local GS client to load his own level
        // then also buffer the LoadLevel request so any new client that connects will also receive the "LoadLevel"
        if (Network.peerType != NetworkPeerType.Disconnected &&
            mgs.gamemenustate == NetworkMasterServer.menustate.networklobby &&
            Network.isServer)
        {
            // Make sure no old RPC calls are buffered and then send load level command
            Network.RemoveRPCsInGroup(0);
            Network.RemoveRPCsInGroup(1);
            // Load level with incremented level prefix (for view IDs)
            // NOTE: The RPCMode.AllBuffered sends the request to all clients, including the client sending the
            //       request.  Also, the Buffered command tells the game server to hold onto the RPC command and also
            //       send it to any new clients that connect.  This is important for level loading or player instantiation
            //       so we make sure all objects are correctly created on all clients, but would not be used for example
            //       to indicate a death as the new client would never have seen the player in the first place and
            //       therefore doesn't need to see the death.

            /* This is the network call that every player who starts/joins a server.
             * Change "DefaultChatroom" to the name of the scene you want the player to load at first */
            networkView.RPC("LoadLevel", RPCMode.AllBuffered, "DefaultChatroom", lastLevelPrefix + 1);
        }

        else if (Network.peerType != NetworkPeerType.Disconnected && !hasCreatedProxy)
        {
            proxy           = VoiceChatUtils.CreateProxy();
            hasCreatedProxy = true;
        }
    }
Exemple #5
0
 public override void OnClientConnect(NetworkConnection connection)
 {
     base.OnClientConnect(connection);
     VoiceChatNetworkProxy.OnManagerClientConnect(connection);
 }
Exemple #6
0
        public override void OnStopServer()
        {
            VoiceChatNetworkProxy.OnManagerStopServer();

            Destroy(GetComponent <VoiceChatServerUi>());
        }
Exemple #7
0
        public override void OnStartServer()
        {
            VoiceChatNetworkProxy.OnManagerStartServer();

            gameObject.AddComponent <VoiceChatServerUi>();
        }
Exemple #8
0
        public override void OnServerDisconnect(NetworkConnection conn)
        {
            base.OnServerDisconnect(conn);

            VoiceChatNetworkProxy.OnManagerServerDisconnect(conn);
        }
Exemple #9
0
        public override void OnStartClient(NetworkClient client)
        {
            VoiceChatNetworkProxy.OnManagerStartClient(client);

            gameObject.AddComponent <VoiceChatUi>();
        }
 public override void OnStartClient(NetworkClient client)
 {
     VoiceChatNetworkProxy.OnManagerStartClient(client);
 }
 void OnConnectedToServer()
 {
     proxy = VoiceChatUtils.CreateProxy();
 }
 void OnConnectedToServer()
 {
     proxy = VoiceChatUtils.CreateProxy();
 }
Exemple #13
0
    //void OnGUI () {
    void Update()
    {
        // When the server is started then issue a "LoadLevel" RPC call for the local GS client to load his own level
        // then also buffer the LoadLevel request so any new client that connects will also receive the "LoadLevel"
        if (Network.peerType != NetworkPeerType.Disconnected &&
            mgs.gamemenustate == NetworkMasterServer.menustate.networklobby &&
            Network.isServer )
        {
            // Make sure no old RPC calls are buffered and then send load level command
            Network.RemoveRPCsInGroup(0);
            Network.RemoveRPCsInGroup(1);
            // Load level with incremented level prefix (for view IDs)
            // NOTE: The RPCMode.AllBuffered sends the request to all clients, including the client sending the
            //       request.  Also, the Buffered command tells the game server to hold onto the RPC command and also
            //       send it to any new clients that connect.  This is important for level loading or player instantiation
            //       so we make sure all objects are correctly created on all clients, but would not be used for example
            //       to indicate a death as the new client would never have seen the player in the first place and
            //       therefore doesn't need to see the death.

            /* This is the network call that every player who starts/joins a server.
             * Change "DefaultChatroom" to the name of the scene you want the player to load at first */
            networkView.RPC( "LoadLevel", RPCMode.AllBuffered, "DefaultChatroom", lastLevelPrefix + 1);
        }

        else if (Network.peerType != NetworkPeerType.Disconnected && !hasCreatedProxy) {
            proxy = VoiceChatUtils.CreateProxy();
            hasCreatedProxy = true;
        }
    }
Exemple #14
0
 public override void OnStopServer()
 {
     VoiceChatNetworkProxy.OnManagerStopServer();
 }
Exemple #15
0
 public override void OnStopClient()
 {
     VoiceChatNetworkProxy.OnManagerStopClient();
 }
Exemple #16
0
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     Debug.Log("Client Disconnect!");
     base.OnServerDisconnect(conn);
     VoiceChatNetworkProxy.OnManagerServerDisconnect(conn);
 }