StopFallbackSendAckThread() public static method

public static StopFallbackSendAckThread ( ) : void
return void
Example #1
0
    public void Update()
    {
        if (!initialiserPersonnages && SceneConstant.teamJoueur.Count >= 4)
        {
            if (PhotonNetwork.isMasterClient)
            {
                //!!!
                Personnage1 = PhotonNetwork.Instantiate("Prefabs/" + SceneConstant.teamJoueur[0], new Vector3(2.58f, -1.25f, 0.825f), Quaternion.identity, 0);
                Personnage2 = PhotonNetwork.Instantiate("Prefabs/" + SceneConstant.teamJoueur[2], new Vector3(-2.58f, 1.25f, 0.925f), Quaternion.identity, 0);
                Personnage3 = PhotonNetwork.Instantiate("Prefabs/" + SceneConstant.teamJoueur[1], new Vector3(1.72f, -1.75f, 0.805f), Quaternion.identity, 0);
                Personnage4 = PhotonNetwork.Instantiate("Prefabs/" + SceneConstant.teamJoueur[3], new Vector3(-1.72f, 1.75f, 0.945f), Quaternion.identity, 0);
                Personnage1.GetComponent <PhotonView>().onSerializeTransformOption = OnSerializeTransform.OnlyScale;
                Personnage2.GetComponent <PhotonView>().onSerializeTransformOption = OnSerializeTransform.OnlyScale;
                Personnage3.GetComponent <PhotonView>().onSerializeTransformOption = OnSerializeTransform.OnlyScale;
                Personnage4.GetComponent <PhotonView>().onSerializeTransformOption = OnSerializeTransform.OnlyScale;
            }
            initialiserPersonnages = true;
        }

        if (!initialiserPartie && initialiserPersonnages && GameObject.FindGameObjectWithTag("Personnage") != null)
        {
            /*Personnage1 = Instantiate(Personnage1Prefab, Personnage1Prefab.transform.position, Quaternion.identity);
            *  Personnage2 = Instantiate(Personnage2Prefab, Personnage2Prefab.transform.position, Quaternion.identity);
            *  Personnage3 = Instantiate(Personnage3Prefab, Personnage3Prefab.transform.position, Quaternion.identity);
            *  Personnage4 = Instantiate(Personnage4Prefab, Personnage4Prefab.transform.position, Quaternion.identity);*/
            if (Personnage1 == null)
            {
                //print(SceneConstant.teamJoueur[2] + "   " + SceneConstant.teamJoueur[3] + "   " + SceneConstant.teamJoueur[0] + "   " + SceneConstant.teamJoueur[1] + "   ");
                Personnage1 = GameObject.Find(SceneConstant.teamJoueur[2] + "(Clone)");
                Personnage2 = GameObject.Find(SceneConstant.teamJoueur[0] + "(Clone)");
                Personnage3 = GameObject.Find(SceneConstant.teamJoueur[3] + "(Clone)");
                Personnage4 = GameObject.Find(SceneConstant.teamJoueur[1] + "(Clone)");

                //print(Personnage1);
            }
            GameObject.Find("Plateau").AddComponent <Partie>();
            GameObject.Find("Plateau").GetComponent <Partie>().enabled = true;

            if (PhotonNetwork.isMasterClient)
            {
                Partie.joueur = 1;
            }
            else
            {
                Partie.joueur = 2;
            }

            Transform[] allChildren = GameObject.Find("Plateau").GetComponentsInChildren <Transform>();
            foreach (Transform c in allChildren)
            {
                if (c.gameObject.name.Length >= 7 && c.gameObject.name.Substring(0, 7) == "CaseSol")
                {
                    c.gameObject.AddComponent <Case>();
                }
            }

            //print(Partie.personnages + "   " + Personnage1.GetComponent<Personnage>());
            Partie.personnages.Add(Personnage1.GetComponent <Personnage>());
            Partie.personnages.Add(Personnage2.GetComponent <Personnage>());
            Partie.personnages.Add(Personnage3.GetComponent <Personnage>());
            Partie.personnages.Add(Personnage4.GetComponent <Personnage>());
            //print(Partie.personnages[0]);

            Partie.teamA.Add(Partie.personnages[0]);
            Partie.teamA.Add(Partie.personnages[2]);
            Partie.teamB.Add(Partie.personnages[1]);
            Partie.teamB.Add(Partie.personnages[3]);
            Partie.personnageTour = Partie.personnages[0];



            for (int i = Partie.personnages.Count - 1; i >= 0; i--)
            {
                Partie.personnages[i].fondTextPv = GameObject.Find("PanelPv" + (i + 1));
                Partie.personnages[i].textPv     = GameObject.Find("PV" + (i + 1)).GetComponent <Text>();
                Partie.personnages[i].fondTextPv.GetComponent <Image>().rectTransform.localScale = new Vector3(1, 1, 1);
                Partie.personnages[i].fondTextPv.gameObject.SetActive(false);
                Partie.personnages[i].SpriteTimeLine = Instantiate(Partie.personnages[i].sprites[1], new Vector3(8.25f - (Partie.personnages.Count - 1 - i), -4.25f, 0), Quaternion.identity);
                Partie.personnages[i].SpriteTimeLine.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0.5f);

                if (Partie.joueur == 1 && Partie.teamA.Contains(Partie.personnages[i]) || Partie.joueur == 2 && Partie.teamB.Contains(Partie.personnages[i]))
                {
                    Partie.personnages[i].fondTextPv.GetComponent <Image>().color = Color.green;
                }
                else
                {
                    Partie.personnages[i].fondTextPv.GetComponent <Image>().color = Color.red;
                }
            }

            initialiserPartie = true;
        }

        // Check if we are out of context, which means we likely got back to the demo hub.
        if (this.DisconnectedPanel == null)
        {
            Destroy(this.gameObject);
        }

        // for debugging, it's useful to have a few actions tied to keys:
        if (Input.GetKeyUp(KeyCode.L))
        {
            PhotonNetwork.LeaveRoom();
        }
        if (Input.GetKeyUp(KeyCode.C))
        {
            PhotonNetwork.ConnectUsingSettings(null);
            PhotonHandler.StopFallbackSendAckThread();
        }


        if (!PhotonNetwork.inRoom)
        {
            return;
        }

        // disable the "reconnect panel" if PUN is connected or connecting
        if (PhotonNetwork.connected && this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(false);
        }
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting && !this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(true);
        }


        if (PhotonNetwork.room.PlayerCount > 1)
        {
            if (this.TurnManager.IsOver)
            {
                return;
            }

            /*
             *          // check if we ran out of time, in which case we loose
             *          if (turnEnd<0f && !IsShowingResults)
             *          {
             *                          Debug.Log("Calling OnTurnCompleted with turnEnd ="+turnEnd);
             *                          OnTurnCompleted(-1);
             *                          return;
             *          }
             */

            if (this.TurnText != null)
            {
                this.TurnText.text = this.TurnManager.Turn.ToString();
            }

            if (this.TurnManager.Turn > 0 && this.TimeText != null)
            {
                this.TimeText.text = this.TurnManager.RemainingSecondsInTurn.ToString("F1") + " SECONDES";

                TimerFillImage.anchorMax = new Vector2(1f - this.TurnManager.RemainingSecondsInTurn / this.TurnManager.TurnDuration, 1f);
            }
        }

        this.UpdatePlayerTexts();

        /*if (!this.turnManager.IsCompletedByAll)
         * {
         *  if (PhotonNetwork.room.PlayerCount < 2)
         *  {
         *
         *  }
         *
         *  // if the turn is not completed by all, we use a random image for the remote hand
         *  else if (this.turnManager.Turn > 0 && !this.turnManager.IsCompletedByAll)
         *  {
         *      // alpha of the remote hand is used as indicator if the remote player "is active" and "made a turn"
         *      PhotonPlayer remote = PhotonNetwork.player.GetNext();
         *  }
         * }*/
    }
Example #2
0
 public void OnClickConnect()
 {
     PhotonNetwork.ConnectUsingSettings(null);
     PhotonHandler.StopFallbackSendAckThread();  // this is used in the demo to timeout in background!
 }
Example #3
0
 public void OnClickReConnectAndRejoin()
 {
     PhotonNetwork.ReconnectAndRejoin();
     PhotonHandler.StopFallbackSendAckThread();  // this is used in the demo to timeout in background!
 }
Example #4
0
 // Token: 0x06000235 RID: 565 RVA: 0x0000F33E File Offset: 0x0000D53E
 public void OnClickReConnectAndRejoin()
 {
     PhotonNetwork.ReconnectAndRejoin();
     PhotonHandler.StopFallbackSendAckThread();
 }
Example #5
0
 /// <summary>Called by Unity when the play mode ends. Used to cleanup.</summary>
 protected void OnDestroy()
 {
     //Debug.Log("OnDestroy on PhotonHandler.");
     PhotonHandler.StopFallbackSendAckThread();
     //PhotonNetwork.Disconnect();
 }
 // Token: 0x0600B224 RID: 45604 RVA: 0x00415FAC File Offset: 0x004141AC
 protected void DOFKFBFNNNO()
 {
     PhotonHandler.StopFallbackSendAckThread();
 }
Example #7
0
 // Token: 0x06000234 RID: 564 RVA: 0x0000F330 File Offset: 0x0000D530
 public void OnClickConnect()
 {
     PhotonNetwork.ConnectUsingSettings(null);
     PhotonHandler.StopFallbackSendAckThread();
 }
Example #8
0
    public void Update()
    {
        // Check if we are out of context, which means we likely got back to the demo hub.
        if (this.DisconnectedPanel == null)
        {
            Destroy(this.gameObject);
        }

        // for debugging, it's useful to have a few actions tied to keys:
        if (Input.GetKeyUp(KeyCode.L))
        {
            PhotonNetwork.LeaveRoom();
        }
        if (Input.GetKeyUp(KeyCode.C))
        {
            PhotonNetwork.ConnectUsingSettings(null);
            PhotonHandler.StopFallbackSendAckThread();
        }


        if (!PhotonNetwork.inRoom)
        {
            return;
        }

        // 重新連線的UI
        if (PhotonNetwork.connected && this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(false);
        }
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting && !this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(true);
        }

        //如果房間人數大於1,回傳當前回合以及時間
        if (PhotonNetwork.room.PlayerCount > 1)
        {
            if (this.turnManager.IsOver)
            {
                return;
            }

            if (this.TurnText != null)
            {
                this.TurnText.text = this.turnManager.Turn.ToString();//回傳當前第幾回合
            }

            if (this.turnManager.Turn > 0 && this.TimeText != null && !IsShowingResults)
            {
                this.TimeText.text = this.turnManager.RemainingSecondsInTurn.ToString("F1") + " SECONDS";

                TimerFillImage.anchorMax = new Vector2(1f - this.turnManager.RemainingSecondsInTurn / this.turnManager.TurnDuration, 1f);
            }
        }

        this.UpdatePlayerTexts();        //更新自己與對手的名字與分數

        // show local player's selected hand,預設為None
        Sprite selected = SelectionToSprite(this.localSelection);

        if (selected != null)
        {
            this.localSelectionImage.gameObject.SetActive(true);
            this.localSelectionImage.sprite = selected;
        }

        // remote player's selection is only shown, when the turn is complete (finished by both)
        if (this.turnManager.IsCompletedByAll)
        {
            selected = SelectionToSprite(this.remoteSelection);
            if (selected != null)
            {
                this.remoteSelectionImage.color  = new Color(1, 1, 1, 1);
                this.remoteSelectionImage.sprite = selected;
            }
        }
        else
        {
            ButtonCanvasGroup.interactable = PhotonNetwork.room.PlayerCount > 1;

            if (PhotonNetwork.room.PlayerCount < 2)//如果房間人數少於2,對手的圖案隱藏;如果對手尚未作答,用透明度來表示對手狀態。
            {
                this.remoteSelectionImage.color = new Color(1, 1, 1, 0);
            }

            // if the turn is not completed by all, we use a random image for the remote hand
            else if (this.turnManager.Turn > 0 && !this.turnManager.IsCompletedByAll)
            {
                // alpha of the remote hand is used as indicator if the remote player "is active" and "made a turn"
                PhotonPlayer remote = PhotonNetwork.player.GetNext();
                float        alpha  = 0.5f;
                if (this.turnManager.GetPlayerFinishedTurn(remote))
                {
                    alpha = 1;
                }
                if (remote != null && remote.IsInactive)//對手斷線
                {
                    alpha = 0.1f;
                }

                this.remoteSelectionImage.color  = new Color(1, 1, 1, alpha);
                this.remoteSelectionImage.sprite = SelectionToSprite(randomHand);
            }
        }
    }
Example #9
0
 protected void OnDestroy()
 {
     PhotonHandler.StopFallbackSendAckThread();
 }
Example #10
0
    public void Update()
    {
        // 检查我们是否脱离了环境.
        if (this.DisconnectedPanel == null)
        {
            Destroy(this.gameObject);
        }

        // 为了方便调试, 弄一些快捷键是很有用的:
        if (Input.GetKeyUp(KeyCode.L))          //L键离开房间
        {
            PhotonNetwork.LeaveRoom();
        }
        if (Input.GetKeyUp(KeyCode.C))         //C键连接
        {
            PhotonNetwork.ConnectUsingSettings(null);
            PhotonHandler.StopFallbackSendAckThread();
        }


        if (!PhotonNetwork.inRoom)              //不在房间则退出
        {
            return;
        }

        // 如果PUN已连接或正在连接则禁用"reconnect panel"(重连面板)
        if (PhotonNetwork.connected && this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(false);
        }
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting && !this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(true);
        }


        if (PhotonNetwork.room.PlayerCount > 1)
        {
            if (this.turnManager.IsOver)
            {
                return;                 //回合结束
            }

            if (this.TurnText != null)
            {
                this.TurnText.text = this.turnManager.Turn.ToString();                  //更新回合数
            }

            if (this.turnManager.Turn > 0 && this.TimeText != null && !IsShowingResults)
            {
                this.TimeText.text = this.turnManager.RemainingSecondsInTurn.ToString("F1") + " 秒";                     //更新回合剩余时间

                TimerFillImage.anchorMax = new Vector2(1f - this.turnManager.RemainingSecondsInTurn / this.turnManager.TurnDuration, 1f);
            }
        }

        this.UpdatePlayerTexts();               //更新玩家文本信息



        // 远程玩家的选择只在回合结束时(双方都完成回合)展示
        if (this.turnManager.IsCompletedByAll)
        {
        }
        else
        {
            ButtonCanvasGroup.interactable = PhotonNetwork.room.PlayerCount > 1;                //玩家数量大于1才可以触发按钮

            if (PhotonNetwork.room.PlayerCount < 2)
            {
            }

            // 如果所有玩家都没有完成该回合,我们为远程玩家的手势使用一个随机图片
            else if (this.turnManager.Turn > 0 && !this.turnManager.IsCompletedByAll)
            {
                // 远程玩家手势图片的阿尔法值(透明度)被用于表明远程玩家是否“活跃”以及“完成回合”
                PhotonPlayer remote = PhotonNetwork.player.GetNext();
                float        alpha  = 0.5f;
                if (this.turnManager.GetPlayerFinishedTurn(remote))
                {
                    alpha = 1;                          //完成回合为1
                }
                if (remote != null && remote.IsInactive)
                {
                    alpha = 0.1f;
                }
            }
        }
    }
        void Update()
        {
            if (Input.GetKeyUp(KeyCode.A))
            {
                _room.LeaveRoom();
            }

            if (Input.GetKeyUp(KeyCode.S))
            {
                _room.ConnectUsingSettings("0");
                PhotonHandler.StopFallbackSendAckThread();
            }

            if (!_room.InRoom)
            {
                return;
            }

            if (_room.Connected && _reconnectParent.gameObject.GetActive())
            {
                _reconnectParent.gameObject.SetActive(false);
            }

            if (!_room.Connected && !_room.Connecting && !_reconnectParent.gameObject.GetActive())
            {
                _reconnectParent.gameObject.SetActive(true);
            }

            if (_room.CurrentRoom.PlayerCount > 1)
            {
                if (_room.TurnIsOver)
                {
                    return;
                }

                if (_turnText != null)
                {
                    _turnText.text = _room.Turn.ToString();
                }

                if (_room.Turn > 0 && _timeText != null && !_isShowingResults)
                {
                    _timeText.text = _room.RemainingSecondsInTurn.ToString("F1") + " SECONDS";

                    _timerFillImage.anchorMax = new Vector2(1f - _room.RemainingSecondsInTurn / _room.TurnDuration, 1f);
                }
            }

            UpdatePlayerTexts();

            Sprite selected = SelectionToSprite(_localSelection);

            if (selected != null)
            {
                _localSelectionImage.gameObject.SetActive(true);
                _localSelectionImage.sprite = selected;
            }

            if (_room.IsCompletedByAll)
            {
                selected = SelectionToSprite(_remoteSelection);
                if (selected != null)
                {
                    _remoteSelectionImage.color  = new Color(1, 1, 1, 1);
                    _remoteSelectionImage.sprite = selected;
                }
            }
            else
            {
                EnableButtons(_room.CurrentRoom.PlayerCount > 1);

                if (_room.CurrentRoom.PlayerCount < 2)
                {
                    _remoteSelectionImage.color = new Color(1, 1, 1, 0);
                }

                // if the turn is not completed by all, we use a random image for the remote hand
                else if (_room.Turn > 0 && !_room.IsCompletedByAll)
                {
                    // alpha of the remote hand is used as indicator if the remote player "is active" and "made a turn"
                    PhotonPlayer remote = _room.LocalPlayer.GetNext();
                    float        alpha  = 0.5f;
                    if (_room.IsPlayerTurnFinished(remote))
                    {
                        alpha = 1;
                    }

                    if (remote != null && remote.IsInactive)
                    {
                        alpha = 0.1f;
                    }

                    _remoteSelectionImage.color  = new Color(1, 1, 1, alpha);
                    _remoteSelectionImage.sprite = SelectionToSprite(_randomHand);
                }
            }
        }
Example #12
0
 /// <summary>
 /// 连接
 /// </summary>
 public void OnClickConnect()
 {
     PlayMusic(selectClap);
     PhotonNetwork.ConnectUsingSettings(null);
     PhotonHandler.StopFallbackSendAckThread();          // 这在案例中被用于后台超时!
 }
Example #13
0
    public void Update()
    {
        // for debugging, it's useful to have a few actions tied to keys:
        if (Input.GetKeyUp(KeyCode.L))
        {
            PhotonNetwork.LeaveRoom();
        }
        if (Input.GetKeyUp(KeyCode.C))
        {
            PhotonNetwork.ConnectUsingSettings(null);
            PhotonHandler.StopFallbackSendAckThread();
        }

        // disable the "reconnect panel" if PUN is connected or connecting
        if (PhotonNetwork.connected && this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(false);
        }
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting && !this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(true);
        }

        if (PhotonNetwork.inRoom)
        {
            if (this.TurnText != null)
            {
                this.TurnText.text = this.turnManager.Turn.ToString();
            }
            if (this.turnManager.Turn > 0 && this.TimeText != null)
            {
                float turnEnd = this.turnManager.GetRemainingSeconds();
                this.TimeText.text = turnEnd.ToString("F1") + " SECONDS";
            }
            this.UpdatePlayerTexts();


            // show local player's selected hand
            Sprite selected = SelectionToSprite(this.localSelection);
            if (selected != null)
            {
                this.localSelectionImage.gameObject.SetActive(true);
                this.localSelectionImage.sprite = selected;
            }

            // remote player's selection is only shown, when the turn is complete (finished by both)
            if (this.turnManager.IsCompletedByAll)
            {
                selected = SelectionToSprite(this.remoteSelection);
                if (selected != null)
                {
                    this.remoteSelectionImage.color  = new Color(1, 1, 1, 1);
                    this.remoteSelectionImage.sprite = selected;
                }
            }
            else
            {
                if (PhotonNetwork.room.playerCount < 2)
                {
                    this.remoteSelectionImage.color = new Color(1, 1, 1, 0);
                }

                // if the turn is not completed by all, we use a random image for the remote hand
                else if (this.turnManager.Turn > 0 && !this.turnManager.IsCompletedByAll)
                {
                    // alpha of the remote hand is used as indicator if the remote player "is active" and "made a turn"
                    PhotonPlayer remote = PhotonNetwork.player.GetNext();
                    float        alpha  = 0.5f;
                    if (this.turnManager.GetPlayerFinishedTurn(remote))
                    {
                        alpha = 1;
                    }
                    if (remote != null && remote.isInactive)
                    {
                        alpha = 0.1f;
                    }

                    this.remoteSelectionImage.color  = new Color(1, 1, 1, alpha);
                    this.remoteSelectionImage.sprite = SelectionToSprite(randomHand);
                }
            }
        }
    }
 // Token: 0x0600B250 RID: 45648 RVA: 0x00416691 File Offset: 0x00414891
 protected void PDNMKEKIGJH()
 {
     PhotonHandler.MBIFDLCKGKN = true;
     PhotonHandler.StopFallbackSendAckThread();
     PhotonNetwork.Disconnect();
 }
Example #15
0
 protected void OnApplicationQuit()
 {
     PhotonHandler.AppQuits = true;
     PhotonHandler.StopFallbackSendAckThread();
     PhotonNetwork.Disconnect();
 }
Example #16
0
    // Token: 0x06000221 RID: 545 RVA: 0x0000ECD8 File Offset: 0x0000CED8
    public void Update()
    {
        if (this.DisconnectedPanel == null)
        {
            Object.Destroy(base.gameObject);
        }
        if (Input.GetKeyUp(KeyCode.L))
        {
            PhotonNetwork.LeaveRoom(true);
        }
        if (Input.GetKeyUp(KeyCode.C))
        {
            PhotonNetwork.ConnectUsingSettings(null);
            PhotonHandler.StopFallbackSendAckThread();
        }
        if (!PhotonNetwork.inRoom)
        {
            return;
        }
        if (PhotonNetwork.connected && this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(false);
        }
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting && !this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(true);
        }
        if (PhotonNetwork.room.PlayerCount > 1)
        {
            if (this.turnManager.IsOver)
            {
                return;
            }
            if (this.TurnText != null)
            {
                this.TurnText.text = this.turnManager.Turn.ToString();
            }
            if (this.turnManager.Turn > 0 && this.TimeText != null && !this.IsShowingResults)
            {
                this.TimeText.text            = this.turnManager.RemainingSecondsInTurn.ToString("F1") + " SECONDS";
                this.TimerFillImage.anchorMax = new Vector2(1f - this.turnManager.RemainingSecondsInTurn / this.turnManager.TurnDuration, 1f);
            }
        }
        this.UpdatePlayerTexts();
        Sprite sprite = this.SelectionToSprite(this.localSelection);

        if (sprite != null)
        {
            this.localSelectionImage.gameObject.SetActive(true);
            this.localSelectionImage.sprite = sprite;
        }
        if (this.turnManager.IsCompletedByAll)
        {
            sprite = this.SelectionToSprite(this.remoteSelection);
            if (sprite != null)
            {
                this.remoteSelectionImage.color  = new Color(1f, 1f, 1f, 1f);
                this.remoteSelectionImage.sprite = sprite;
                return;
            }
        }
        else
        {
            this.ButtonCanvasGroup.interactable = (PhotonNetwork.room.PlayerCount > 1);
            if (PhotonNetwork.room.PlayerCount < 2)
            {
                this.remoteSelectionImage.color = new Color(1f, 1f, 1f, 0f);
                return;
            }
            if (this.turnManager.Turn > 0 && !this.turnManager.IsCompletedByAll)
            {
                PhotonPlayer next = PhotonNetwork.player.GetNext();
                float        a    = 0.5f;
                if (this.turnManager.GetPlayerFinishedTurn(next))
                {
                    a = 1f;
                }
                if (next != null && next.IsInactive)
                {
                    a = 0.1f;
                }
                this.remoteSelectionImage.color  = new Color(1f, 1f, 1f, a);
                this.remoteSelectionImage.sprite = this.SelectionToSprite(this.randomHand);
            }
        }
    }
Example #17
0
    public void Update()
    {
        // Check if we are out of context, which means we likely got back to the demo hub.
        if (this.DisconnectedPanel == null)
        {
            Destroy(this.gameObject);
        }

        // for debugging, it's useful to have a few actions tied to keys:
        if (Input.GetKeyUp(KeyCode.L))
        {
            PhotonNetwork.LeaveRoom();
        }
        if (Input.GetKeyUp(KeyCode.C))
        {
            PhotonNetwork.ConnectUsingSettings(null);
            PhotonHandler.StopFallbackSendAckThread();
        }



        if (!PhotonNetwork.inRoom)
        {
            return;
        }

        // disable the "reconnect panel" if PUN is connected or connecting
        if (PhotonNetwork.connected && this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(false);
        }
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting && !this.DisconnectedPanel.gameObject.GetActive())
        {
            this.DisconnectedPanel.gameObject.SetActive(true);
        }


        if (PhotonNetwork.room.PlayerCount > 1)
        {
            if (this.turnManager.IsOver)
            {
                return;
            }

            /*
             * // check if we ran out of time, in which case we loose
             * if (turnEnd<0f && !IsShowingResults)
             * {
             *              Debug.Log("Calling OnTurnCompleted with turnEnd ="+turnEnd);
             *              OnTurnCompleted(-1);
             *              return;
             * }
             */

            if (this.TurnText != null)
            {
                this.TurnText.text = this.turnManager.Turn.ToString();
            }

            if (this.turnManager.Turn > 0 && this.TimeText != null && !IsShowingResults)
            {
                this.TimeText.text = this.turnManager.RemainingSecondsInTurn.ToString("F1") + " SECONDS";

                TimerFillImage.anchorMax = new Vector2(1f - this.turnManager.RemainingSecondsInTurn / this.turnManager.TurnDuration, 1f);
            }
        }

        this.UpdatePlayerTexts();

        // show local player's selected hand
        Sprite selected = SelectionToSprite(this.localSelection);

        if (selected != null)
        {
            this.localSelectionImage.gameObject.SetActive(true);
            this.localSelectionImage.sprite = selected;
        }

        // remote player's selection is only shown, when the turn is complete (finished by both)
        if (this.turnManager.IsCompletedByAll)
        {
            selected = SelectionToSprite(this.remoteSelection);
            if (selected != null)
            {
                this.remoteSelectionImage.color  = new Color(1, 1, 1, 1);
                this.remoteSelectionImage.sprite = selected;
            }
        }
        else
        {
            ButtonCanvasGroup.interactable = PhotonNetwork.room.PlayerCount > 1;

            if (PhotonNetwork.room.PlayerCount < 2)
            {
                this.remoteSelectionImage.color = new Color(1, 1, 1, 0);
            }

            // if the turn is not completed by all, we use a random image for the remote hand
            else if (this.turnManager.Turn > 0 && !this.turnManager.IsCompletedByAll)
            {
                // alpha of the remote hand is used as indicator if the remote player "is active" and "made a turn"
                PhotonPlayer remote = PhotonNetwork.player.GetNext();
                float        alpha  = 0.5f;
                if (this.turnManager.GetPlayerFinishedTurn(remote))
                {
                    alpha = 1;
                }
                if (remote != null && remote.IsInactive)
                {
                    alpha = 0.1f;
                }

                this.remoteSelectionImage.color  = new Color(1, 1, 1, alpha);
                this.remoteSelectionImage.sprite = SelectionToSprite(randomHand);
            }
        }
    }
 // Token: 0x0600B26A RID: 45674 RVA: 0x00415FAC File Offset: 0x004141AC
 protected void PINGNFLJAGB()
 {
     PhotonHandler.StopFallbackSendAckThread();
 }