// Use this for initialization void Start() { rankingListManager = GameObject.Find("RankingListManager").GetComponent <RankingListManager>(); //int rank = GameObject.Find ("RankingListManager").GetComponent<RankingListManager> ().getRankFromRankingList (ShotReactor.miss); int rank = rankingListManager.registerRankingList(ShotReactor.miss, Timer.countTime); Debug.Log("rank = " + rank.ToString()); nakaRankText.text = rank.ToString(); nakaTimeText.text = ((int)(Timer.countTime / 60)).ToString("D2") + ":" + ((int)Timer.countTime % 60).ToString("D2"); nakaMissText.text = ShotReactor.miss.ToString(); nakaScoreText.text = ((int)rankingListManager.getScoreByRank(rank)).ToString(); //Debug.Log("playerNum = " + rankingListManager.getPlayerNum ().ToString ()); nakaAllNum.text = "/" + rankingListManager.getPlayerNum().ToString() + "人中"; // 1位だった場合は上のラベルを非表示にし、テキストも更新しない if (rank == 1) { GameObject.Find("UeLabel").SetActive(false); } else { ueRankText.text = (rank - 1).ToString(); float ueTime = rankingListManager.getTimeByRank(rank - 1); ueTimeText.text = ((int)(ueTime / 60)).ToString("D2") + ":" + ((int)ueTime % 60).ToString("D2"); ueMissText.text = rankingListManager.getMissByRank(rank - 1).ToString(); ueScoreText.text = ((int)rankingListManager.getScoreByRank(rank - 1)).ToString(); } // 最下位または最大保持人数だった場合は下のラベルを非表示にし、テキストも更新しない if (rank == rankingListManager.getPlayerNum() || rank == rankingListManager.getNumberOfScoreInfo()) { GameObject.Find("ShitaLabel").SetActive(false); } else { shitaRankText.text = (rank + 1).ToString(); float shitaTime = rankingListManager.getTimeByRank(rank + 1); shitaTimeText.text = ((int)(shitaTime / 60)).ToString("D2") + ":" + ((int)shitaTime % 60).ToString("D2"); shitaMissText.text = rankingListManager.getMissByRank(rank + 1).ToString(); shitaScoreText.text = ((int)rankingListManager.getScoreByRank(rank + 1)).ToString(); } AudioSource audio = AudioSource.GetComponent <AudioSource>(); if (rank <= 10) { audio.clip = top10bgm; } audio.Play(); //testCount--; }
// Use this for initialization void Start() { rankingListManager = GameObject.Find("RankingListManager").GetComponent <RankingListManager> (); for (i = 0; i < NumberOfScore; i++) { rankObjects [i] = GameObject.Find("Rank" + (i + 1).ToString() + "Label"); timeText [i] = GameObject.Find("Rank" + (i + 1).ToString() + "Time").GetComponent <Text> (); missText [i] = GameObject.Find("Rank" + (i + 1).ToString() + "Miss").GetComponent <Text> (); scoreText[i] = GameObject.Find("Rank" + (i + 1).ToString() + "Score").GetComponent <Text>(); //rankText [i] = GameObject.Find ("Rank" + (i + 1).ToString()).GetComponent<Text> (); //rankObjects [i].SetActive (false); //rankText [i].text = "Rank" + (i + 1).ToString() + " : " + GameObject.Find ("RankingListManager").GetComponent<RankingListManager>().getScoreByRank(i + 1).ToString(); timeText [i].text = ((int)(rankingListManager.getTimeByRank(i + 1) / 60)).ToString("D2") + ":" + ((int)(rankingListManager.getTimeByRank(i + 1) % 60)).ToString("D2"); missText [i].text = rankingListManager.getMissByRank(i + 1).ToString(); scoreText[i].text = ((int)rankingListManager.getScoreByRank(i + 1)).ToString(); } /* * for (i = 3; i < NumberOfScore; i++) { * rankObjects [i] = GameObject.Find ("Rank" + (i + 1).ToString() + "Label"); * rankText [i] = GameObject.Find ("Rank" + (i + 1).ToString()).GetComponent<Text> (); * //rankText [i] = GameObject.Find ("Rank" + (i + 1).ToString()).GetComponent<Text> (); * //rankObjects [i].SetActive (false); * //rankText [i].text = "Rank" + (i + 1).ToString() + " : " + GameObject.Find ("RankingListManager").GetComponent<RankingListManager>().getScoreByRank(i + 1).ToString(); * rankText [i].text = (i + 1).ToString() + "位 : " + rankingListManager.getNameByRank(i + 1) + " : " + rankingListManager.getScoreByRank(i + 1).ToString(); * } */ //テストデータ(現在プレイ人数以降のスコア)は非表示にする int playerNum = rankingListManager.getPlayerNum(); if (playerNum < NumberOfScore) { for (int rank = playerNum + 1; rank <= NumberOfScore; rank++) { rankObjects[rank - 1].SetActive(false); } } //StartCoroutine("showScoresAscendingOrder"); }
// Use this for initialization void Start() { rankingListManager = GameObject.Find("RankingListManager").GetComponent <RankingListManager>(); StreamWriter sw; FileInfo fi; string file_path = Application.dataPath + "/RankingData.csv"; if (File.Exists(file_path)) { File.Delete(file_path); } fi = new FileInfo(Application.dataPath + "/RankingData.csv"); sw = fi.AppendText(); for (int i = 0; i < 100; i++) { float time = rankingListManager.getTimeByRank(i + 1); int miss = rankingListManager.getMissByRank(i + 1); sw.WriteLine((i + 1).ToString() + ", " + time.ToString("F2") + ", " + miss.ToString() + ", " + (miss * 10).ToString() + ", " + (time + (miss * 10)).ToString("F2")); } sw.Flush(); sw.Close(); }