Example #1
0
    IEnumerator showResult()                                                         //總排名
    {
        GameObject[] PlayerLists = GameObject.FindGameObjectsWithTag("PlayerLists"); //抓取玩家名單的物件,方便銷毀
        GameStartUI.SetActive(false);
        ResultUIView.SetActive(true);
        PhotonPlayer local     = PhotonNetwork.player;
        int          localRank = 0;

        for (int i = 0; i < PhotonNetwork.room.PlayerCount; i++)
        {
            if (player[i].NickName == local.NickName)
            {
                localRank = i + 1;
            }
            ResultUIView.GetComponentsInChildren <Text>()[0].text += player[i].NickName + " 分數:" + player[i].GetScore().ToString("D2") + "\n\n";
        }
        ResultUIView.GetComponentsInChildren <Text>()[1].text = c_hintLA_count.ToString();
        ResultUIView.GetComponentsInChildren <Text>()[2].text = c_hintST_count.ToString();
        Button btn_learn = ResultUIView.GetComponentsInChildren <Button>()[0];
        Button btn_play  = ResultUIView.GetComponentsInChildren <Button>()[1];
        Button btn_exit  = ResultUIView.GetComponentsInChildren <Button>()[2];

        btn_learn.onClick.AddListener(delegate() { gameover(0, PlayerLists); });
        btn_play.onClick.AddListener(delegate() { gameover(1, PlayerLists); });
        btn_exit.onClick.AddListener(delegate() { gameover(2, PlayerLists); });
        yield return(new WaitForSeconds(0.1f));

        achievementState[1] = xmlprocess.setCompeteCount();//對戰次數
        if (xmlprocess.setCompeteCorrectRecord(correctNum, wrongNum) != null)
        {
            achievementState[2] = xmlprocess.setCompeteCorrectRecord(correctNum, wrongNum);                                                                  //累積答對
        }
        if (xmlprocess.setCompeteMaxCorrectRecord(max_correctNum) != null)
        {
            achievementState[3] = xmlprocess.setCompeteMaxCorrectRecord(max_correctNum);                                  //連續答對
        }
        string[] s_state = xmlprocess.setCompeteScoreRecord(c_hintLA_count, c_hintST_count, local.GetScore(), localRank); //提示與分數排名
        if (s_state[0] != null)
        {
            achievementState[4] = s_state[0];                    //有進步
        }
        if (s_state[1] != null)
        {
            achievementState[5] = s_state[1];                    //有刷新分數
        }
        if (s_state[2] != null)
        {
            achievementState[6] = s_state[2];                    //有進榜
        }
    }
Example #2
0
 public void OnEndTurn()
 {
     if (this.turnManager.Turn < 5)
     {
         this.StartCoroutine("ShowResultsBeginNextTurnCoroutine");
     }
     else //競賽結束,顯示本次雙方分數
     {
         GameUiView.SetActive(false);
         ResultUIView.SetActive(true);
         PhotonPlayer remote = PhotonNetwork.player.GetNext();
         PhotonPlayer local  = PhotonNetwork.player;
         ResultUIView.GetComponentsInChildren <Text>()[1].text = local.GetScore().ToString();
         ResultUIView.GetComponentsInChildren <Text>()[3].text = remote.GetScore().ToString();
         Debug.Log("Your Score:" + local.GetScore() + " remote's Score: " + remote.GetScore());
     }
 }