예제 #1
0
 private static int SortListByScore(ScorePair a, ScorePair b)
 {
     if (a.mScore > b.mScore)
     {
         return(-1);
     }
     if (a.mScore < b.mScore)
     {
         return(1);
     }
     return(0);
 }
예제 #2
0
    IEnumerator PostNewHighScoreCoroutine(ScorePair pair, CompletePostDelegate onComplete)
    {
        WWWForm form = new WWWForm();

        form.AddField("Name", pair.Name);
        form.AddField("Score", pair.Score);

        using (var request = UnityWebRequest.Post(serverUrl, form))
        {
            yield return(request.SendWebRequest());

            if (request.error == null)
            {
                onComplete();
            }
            else
            {
                print(request.error);
            }
        }
    }
예제 #3
0
 // if the value is equal to -1
 //then set title and cover to error
 void SetUI()
 {
     if (cAs[MID_SPRITE_INDEX] == -1)
     {
         title.text  = "Can't get the song";
         author.text = "Error No2252X00";
     }
     else
     {
         CheckVideoExist();
         //try to find the bestscore pair for the sheet in the middle
         ScorePair bestPair = null;
         title.text  = AllSheet[cAs[MID_SPRITE_INDEX]].name;
         author.text = AllSheet[cAs[MID_SPRITE_INDEX]].author;
         bestPair    = NoR2252Application.ScoreBoard.Find(AllSheet[cAs[MID_SPRITE_INDEX]].name);
         if (bestPair != null)
         {
             bestScore.text = "Best Score\n" + bestPair.Score.ToString();
         }
         else
         {
             NoR2252Application.ScoreBoard.Add(AllSheet[cAs[MID_SPRITE_INDEX]].name);
             bestScore.text = "Best Score \n0";
         }
     }
     //set all the cover for sprite
     for (int i = 0; i < sprites.Count; i++)
     {
         Texture2D tex = errorTex;
         if (cAs[i] != -1)
         {
             tex = AllSheet[cAs[i]].cover;
         }
         sprites[i].texture = tex;
     }
 }
예제 #4
0
 //
 // Post a new high score to the server
 public void PostNewHighScore(ScorePair pair, CompletePostDelegate onComplete)
 {
     StartCoroutine(PostNewHighScoreCoroutine(pair, onComplete));
 }