예제 #1
0
 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);
 }
예제 #3
0
        public override void OnStopClient()
        {
            VoiceChatNetworkProxy.OnManagerStopClient();

            //if (client != null)
            //    Destroy(GetComponent<VoiceChatUi>());
        }
예제 #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;
        }
    }
예제 #5
0
 public override void OnClientConnect(NetworkConnection connection)
 {
     base.OnClientConnect(connection);
     VoiceChatNetworkProxy.OnManagerClientConnect(connection);
 }
예제 #6
0
        public override void OnStopServer()
        {
            VoiceChatNetworkProxy.OnManagerStopServer();

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

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

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

            gameObject.AddComponent <VoiceChatUi>();
        }
 public override void OnStartClient(NetworkClient client)
 {
     VoiceChatNetworkProxy.OnManagerStartClient(client);
 }
예제 #11
0
 void OnConnectedToServer()
 {
     proxy = VoiceChatUtils.CreateProxy();
 }
예제 #12
0
 void OnConnectedToServer()
 {
     proxy = VoiceChatUtils.CreateProxy();
 }
예제 #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;
        }
    }
예제 #14
0
 public override void OnStopServer()
 {
     VoiceChatNetworkProxy.OnManagerStopServer();
 }
예제 #15
0
 public override void OnStopClient()
 {
     VoiceChatNetworkProxy.OnManagerStopClient();
 }
예제 #16
0
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     Debug.Log("Client Disconnect!");
     base.OnServerDisconnect(conn);
     VoiceChatNetworkProxy.OnManagerServerDisconnect(conn);
 }