Exemple #1
0
    void Update()
    {
        SScore_       = score_ + Score_;
        s1.text       = score_.ToString();
        S1.text       = Score_.ToString();
        SS1.text      = SScore_.ToString();
        LookWin1.text = P1Win.ToString();
        LookWin2.text = P2Win.ToString();

        if (S_L.Judgment != 1 && !wait.activeSelf)
        {
            nameAndScore.SetActive(true);
        }

        if (Sc["score_"].ToString() != s1.text)
        {
            Sc.Remove("score_");
            PhotonNetwork.LocalPlayer.SetCustomProperties(Sc, null);
            Sc.Add("score_", score_);
        }
        if (Sc["Score_"].ToString() != S1.text)
        {
            Sc.Remove("Score_");
            PhotonNetwork.LocalPlayer.SetCustomProperties(Sc, null);
            Sc.Add("Score_", Score_);
        }
    }
Exemple #2
0
    public override void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
    {
        if (PhotonNetwork.CountOfPlayersInRooms < 2)
        {
            foreach (Player player in PhotonNetwork.PlayerList)
            {
                if (player.NickName == PhotonNetwork.NickName)
                {
                    p1.text = PhotonNetwork.NickName;
                }
                else
                {
                    p2.text = player.NickName;
                }
            }
        }



        if (PhotonNetwork.CountOfPlayersInRooms < 2)
        {
            foreach (Player player in PhotonNetwork.PlayerList)
            {
                if (player.NickName == PhotonNetwork.NickName)
                {
                    s1.text  = score_.ToString();
                    S1.text  = Score_.ToString();
                    SS1.text = SScore_.ToString();

                    if (SS1.text != player.GetScore().ToString())
                    {
                        player.SetScore(SScore_);
                    }
                }
                else
                {
                    if (Input.GetKeyDown(KeyCode.F6))
                    {
                        Debug.LogError(player.GetScore().ToString());
                    }
                    if (player.CustomProperties.ContainsKey("score_"))
                    {
                        s2.text = player.CustomProperties["score_"].ToString();
                    }
                    if (player.CustomProperties.ContainsKey("Score_"))
                    {
                        S2.text = player.CustomProperties["Score_"].ToString();
                    }

                    SS2.text = player.GetScore().ToString();
                }
            }
        }
    }