コード例 #1
0
        public void SetData(int index, HighScoreModel highscore)
        {
            gameObject.SetActive(true);
            string usernameStr = FormatText(highscore.username, highscoreTextFormat.usernameColor);
            string indexStr    = FormatText(index.ToString(), highscoreTextFormat.indexColor) + ".";

            usernameText.text = string.Format("{0}    {1}", indexStr, usernameStr);
            scoreText.text    = highscore.score.ToString();
        }
コード例 #2
0
 public void UpdateLeaderboard(string strData)
 {
     highscores.Clear();
     string[] rows = strData.Split('\n');
     for (int i = 0; i < rows.Length; i++)
     {
         if (!string.IsNullOrEmpty(rows[i]))
         {
             highscores.Add(HighScoreModel.FromPipeDreamlo(rows[i]));
         }
     }
 }
コード例 #3
0
        IEnumerator CR_UploadScore(HighScoreModel highScore, System.Action successCallback = null, System.Action failedCallback = null)
        {
            string uri = string.Format("{0}/{1}/{2}/{3}/{4}", StringConstant.DREAMLO_WEB_URL, StringConstant.DREAMLO_PRIVATE_CODE, "add", highScore.username, highScore.score.ToString());

            //Debug.Log(string.Format("Uploading: {0}:{1}...",highScore.username,highScore.score));
            using (UnityWebRequest webRequest = new UnityWebRequest(uri))
            {
                yield return(webRequest.SendWebRequest());

                if (webRequest.isNetworkError || webRequest.isHttpError)
                {
                    failedCallback();
                }
                else
                {
                    successCallback();
                }
            }
        }
コード例 #4
0
 public void UploadScore(HighScoreModel highScore, System.Action successCallback = null, System.Action failedCallback = null)
 {
     StartCoroutine(CR_UploadScore(highScore, successCallback, failedCallback));
 }