Exemple #1
0
 // Token: 0x06000025 RID: 37 RVA: 0x00002A18 File Offset: 0x00000C18
 private static bool FallbackSendAckThread()
 {
     if (PhotonVoiceHandler.sendThreadShouldRun && PhotonVoiceNetwork.Client != null && PhotonVoiceNetwork.Client.loadBalancingPeer != null)
     {
         ExitGames.Client.Photon.LoadBalancing.LoadBalancingPeer loadBalancingPeer = PhotonVoiceNetwork.Client.loadBalancingPeer;
         ExitGames.Client.Photon.LoadBalancing.ClientState       state             = PhotonVoiceNetwork.Client.State;
         if (PhotonVoiceHandler.timerToStopConnectionInBackground != null && PhotonVoiceNetwork.BackgroundTimeout > 0.1f && (float)PhotonVoiceHandler.timerToStopConnectionInBackground.ElapsedMilliseconds > PhotonVoiceNetwork.BackgroundTimeout * 1000f)
         {
             bool flag = true;
             if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated || state - ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnecting <= 1 || state == ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToNameServer)
             {
                 flag = false;
             }
             if (flag)
             {
                 PhotonVoiceNetwork.Disconnect();
             }
             PhotonVoiceHandler.timerToStopConnectionInBackground.Stop();
             PhotonVoiceHandler.timerToStopConnectionInBackground.Reset();
             return(PhotonVoiceHandler.sendThreadShouldRun);
         }
         if (loadBalancingPeer.ConnectionTime - loadBalancingPeer.LastSendOutgoingTime > 200)
         {
             loadBalancingPeer.SendAcksOnly();
         }
     }
     return(PhotonVoiceHandler.sendThreadShouldRun);
 }
Exemple #2
0
    public void OnStateChange(LoadBalancing.ClientState state)
    {
        if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
        {
            Debug.Log("PUNVoice: Voice Client state: " + state);
        }
        switch (state)
        {
        case LoadBalancing.ClientState.JoinedLobby:
            if (PhotonNetwork.inRoom)
            {
                this.OpJoinOrCreateRoom(PhotonNetwork.room.name + "_voice_", new LoadBalancing.RoomOptions()
                {
                    IsVisible = false
                }, null);
            }
            else
            {
                Debug.LogWarning("PUNVoice: PUN client is not in room yet. Disconnecting voice client.");
                this.Disconnect();
            }
            break;

        case LoadBalancing.ClientState.Disconnected:     // triggered by PUN room join or network failure
            if (this.reconnect)
            {
                PhotonVoiceNetwork.Connect();
            }
            this.reconnect = false;
            break;
        }
    }
Exemple #3
0
 // Token: 0x06002476 RID: 9334 RVA: 0x000B20D4 File Offset: 0x000B02D4
 private void OnVoiceClientStateChanged(ExitGames.Client.Photon.LoadBalancing.ClientState state)
 {
     if (this.pushToTalkPrivateButton != null)
     {
         if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.Joined)
         {
             this.pushToTalkPrivateButton.gameObject.SetActive(true);
             this.Subscribed = (this.Subscribed || this.Subscribe());
             return;
         }
         this.pushToTalkPrivateButton.gameObject.SetActive(false);
     }
 }
Exemple #4
0
 // Token: 0x06002482 RID: 9346 RVA: 0x000B24F0 File Offset: 0x000B06F0
 private void OnVoiceClientStateChanged(ExitGames.Client.Photon.LoadBalancing.ClientState state)
 {
     if (this.pushToTalkButton != null)
     {
         if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.Joined)
         {
             this.pushToTalkButton.gameObject.SetActive(true);
             for (int i = 0; i < PhotonNetwork.otherPlayers.Length; i++)
             {
                 this.OnPhotonPlayerConnected(PhotonNetwork.otherPlayers[i]);
             }
             return;
         }
         this.pushToTalkButton.gameObject.SetActive(false);
     }
 }
Exemple #5
0
 // Token: 0x06000043 RID: 67 RVA: 0x00003154 File Offset: 0x00001354
 private void OnJoinedRoom()
 {
     if (this != PhotonVoiceNetwork._instance)
     {
         return;
     }
     if ((!PhotonVoiceSettings.Instance.WorkInOfflineMode && PhotonNetwork.offlineMode) || !PhotonVoiceSettings.Instance.AutoConnect)
     {
         return;
     }
     ExitGames.Client.Photon.LoadBalancing.ClientState state = this.client.State;
     if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.Joined)
     {
         this.client.OpLeaveRoom();
         return;
     }
     this.client.Reconnect();
 }
Exemple #6
0
 // Token: 0x0600005E RID: 94 RVA: 0x00003824 File Offset: 0x00001A24
 public void OnStateChange(ExitGames.Client.Photon.LoadBalancing.ClientState state)
 {
     if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
     {
         Debug.LogFormat("PUNVoice: Voice Client state: {0}", new object[]
         {
             state
         });
     }
     if (state != ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnected)
     {
         if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToMasterserver)
         {
             if (PhotonNetwork.inRoom)
             {
                 base.OpJoinOrCreateRoom(string.Format("{0}_voice_", PhotonNetwork.room.Name), new ExitGames.Client.Photon.LoadBalancing.RoomOptions
                 {
                     IsVisible = false
                 }, null, null);
             }
             else
             {
                 Debug.LogWarning("PUNVoice: PUN client is not in room yet. Disconnecting voice client.");
                 base.Disconnect();
             }
         }
     }
     else
     {
         if (this.reconnect)
         {
             PhotonVoiceNetwork.Connect();
         }
         this.reconnect = false;
     }
     if (this.OnStateChangeAction != null)
     {
         this.OnStateChangeAction(state);
     }
 }
Exemple #7
0
    public void OnStateChange(LoadBalancing.ClientState state)
    {
        if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
        {
            Debug.LogFormat("PUNVoice: Voice Client state: {0}", state);
        }
        switch (state)
        {
        case LoadBalancing.ClientState.ConnectedToMasterserver:
            if (PhotonNetwork.inRoom)
            {
                this.OpJoinOrCreateRoom(string.Format("{0}_voice_", PhotonNetwork.room.Name),
                                        new LoadBalancing.RoomOptions()
                {
                    IsVisible = false
                }, null);
            }
            else
            {
                Debug.LogWarning("PUNVoice: PUN client is not in room yet. Disconnecting voice client.");
                this.Disconnect();
            }
            break;

        case LoadBalancing.ClientState.Disconnected:     // triggered by PUN room join or network failure
            // PhotonNetwork.SetMasterClient(PhotonNetwork.playerList[0]);
            // Debug.Log("Changed");
            if (this.reconnect)
            {
                PhotonVoiceNetwork.Connect();
            }
            this.reconnect = false;
            break;
        }

        if (this.OnStateChangeAction != null)
        {
            this.OnStateChangeAction(state);
        }
    }
Exemple #8
0
    // Token: 0x06000028 RID: 40 RVA: 0x00002B54 File Offset: 0x00000D54
    protected void Update()
    {
        ExitGames.Client.Photon.LoadBalancing.LoadBalancingPeer loadBalancingPeer = PhotonVoiceNetwork.Client.loadBalancingPeer;
        if (loadBalancingPeer == null)
        {
            Debug.LogError("[PUNVoice]: LoadBalancingPeer broke!");
            return;
        }
        ExitGames.Client.Photon.LoadBalancing.ClientState state = PhotonVoiceNetwork.Client.State;
        bool flag = true;

        if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated || state - ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnecting <= 1 || state == ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToNameServer)
        {
            flag = false;
        }
        if (!flag)
        {
            return;
        }
        bool flag2 = true;

        while (PhotonNetwork.isMessageQueueRunning && flag2)
        {
            flag2 = loadBalancingPeer.DispatchIncomingCommands();
        }
        int num = (int)(Time.realtimeSinceStartup * 1000f);

        if (num > this.nextSendTickCount)
        {
            bool flag3 = true;
            while (PhotonNetwork.isMessageQueueRunning && flag3)
            {
                flag3 = loadBalancingPeer.SendOutgoingCommands();
            }
            this.nextSendTickCount = num + this.updateInterval;
        }
    }
Exemple #9
0
        // Token: 0x0600249F RID: 9375 RVA: 0x000B31A8 File Offset: 0x000B13A8
        private void Update()
        {
            global::ClientState connectionStateDetailed = PhotonNetwork.connectionStateDetailed;

            if (connectionStateDetailed != global::ClientState.PeerCreated)
            {
                if (connectionStateDetailed == global::ClientState.Joined)
                {
                    this.punSwitch.interactable = true;
                    this.punSwitchText.text     = "PUN Disconnect";
                    goto IL_8D;
                }
                if (connectionStateDetailed != global::ClientState.Disconnected)
                {
                    this.punSwitch.interactable = false;
                    this.punSwitchText.text     = "PUN busy";
                    goto IL_8D;
                }
            }
            this.punSwitch.interactable = true;
            this.punSwitchText.text     = "PUN Connect";
            if (this.rec != null)
            {
                this.rec.enabled = false;
                this.rec         = null;
            }
IL_8D:
            ExitGames.Client.Photon.LoadBalancing.ClientState clientState = PhotonVoiceNetwork.ClientState;
            if (clientState != ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated)
            {
                if (clientState != ExitGames.Client.Photon.LoadBalancing.ClientState.Joined)
                {
                    if (clientState != ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnected)
                    {
                        this.voiceSwitch.interactable = false;
                        this.voiceSwitchText.text     = "Voice busy";
                        goto IL_211;
                    }
                }
                else
                {
                    this.voiceSwitch.interactable = true;
                    this.voiceSwitchText.text     = "Voice Disconnect";
                    this.inGameSettings.SetActive(true);
                    this.InitToggles(this.inGameSettings.GetComponentsInChildren <Toggle>());
                    if (this.rec != null)
                    {
                        this.calibrateButton.interactable = !this.rec.VoiceDetectorCalibrating;
                        this.calibrateText.text           = (this.rec.VoiceDetectorCalibrating ? "Calibrating" : string.Format("Calibrate ({0}s)", this.calibrationMilliSeconds / 1000));
                        goto IL_211;
                    }
                    this.calibrateButton.interactable = false;
                    this.calibrateText.text           = "Unavailable";
                    goto IL_211;
                }
            }
            if (PhotonNetwork.inRoom)
            {
                this.voiceSwitch.interactable = true;
                this.voiceSwitchText.text     = "Voice Connect";
                this.voiceDebugText.text      = "";
            }
            else
            {
                this.voiceSwitch.interactable = false;
                this.voiceSwitchText.text     = "Voice N/A";
                this.voiceDebugText.text      = "";
            }
            this.calibrateButton.interactable = false;
            this.calibrateText.text           = "Unavailable";
            this.inGameSettings.SetActive(false);
IL_211:
            if (this.debugMode)
            {
                this.punState.text   = string.Format("PUN: {0}", PhotonNetwork.connectionStateDetailed);
                this.voiceState.text = string.Format("PhotonVoice: {0}", PhotonVoiceNetwork.ClientState);
                if (this.rec != null && this.rec.LevelMeter != null)
                {
                    this.voiceDebugText.text = string.Format("Amp: avg. {0}, peak {1}", this.rec.LevelMeter.CurrentAvgAmp.ToString("0.000000"), this.rec.LevelMeter.CurrentPeakAmp.ToString("0.000000"));
                }
            }
        }