コード例 #1
0
        public void setScore(Score score, Song song, int diff, int rank)
        {
            this.score         = score;
            scoreLabel.Text    = score.TotalScore.ToString("D8");
            accuracyLabel.Text = String.Format("{0:0.00}%", score.Accuracy);
            maxComboLabel.Text = "" + score.MaxCombo + "x";
            dateLabel.Text     = score.dateString;
            statsLabel.Text    = "Perfect: " + "\nGood: " + "\nOK: " + "\nMiss: ";
            statsNoLabel.Text  = "" + score.Perfects + "\n" + score.Goods + "\n" + score.Oks + "\n" + score.Misses;
            string songinf = score.ArtistTitle;

            if (songinf.Length < 26)
            {
                songInfoLabel.Text = songinf.Substring(0, songinf.Length) + " [" + score.chartName + "]";
            }
            else
            {
                songInfoLabel.Text = songinf.Substring(0, 25) + "... [" + score.chartName + "]";
            }
            if (score.ReplayName != "")
            {
                replayButton = new Button(game, new Rectangle(Config.ResWidth - (int)(Config.ResWidth * 0.3), 330, 100, 50), "Replay", delegate(int data)
                {
                    IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
                    if (Config.LocalScores)
                    {
                        Replay replay = ScoreLibrary.reconReplay("replay\\r\\" + score.ReplayName + ".pcr");
                        try
                        {
                            temp.loadSong(song, diff, replay.Mods, replay, IngameScreen.PlayType.REPLAY);
                            temp.Music.stop();
                            Game.setScreen(game.screens["ingameScreen"]);
                            game.Title = "Pulse | Watch replay | " + song.Artist + " - " + song.SongName + " [" + song.Charts[diff].Name + "]";
                        }
                        catch { }
                    }
                    else
                    {
                        string hash = Utils.calcHash(song.Charts[diff].Path);
                        string dl   = "http://p.ulse.net/getreplay?r=" + rank + "&c=" + hash;
                        Console.WriteLine("{0} rank {1} hash", rank, hash);
                        downloadReplay dr  = new downloadReplay();
                        dr.downloadFinish += new Action <Song, int>(dr_downloadFinish);
                        dr.DownloadReplay(dl, "replay\\" + hash + ".pcr", song, diff);
                        // wc.DownloadFileAsync(new Uri(dl), "replay\\temp.pcr");
                        //wc.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(wc_DownloadFileCompleted);
                        replayButton.Enabled = false;
                        replayButton.Visible = false;
                        exitButton.Enabled   = false;
                        exitButton.Visible   = false;
                        Game.addToast("Downloading replay...");
                    }
                });
                if (!UIComponents.Contains(replayButton))
                {
                    UIComponents.Add(replayButton);
                }
            }
        }
コード例 #2
0
ファイル: ScoreSelectScreen.cs プロジェクト: Zhangerr/pulse
 public void setScore(Score score, Song song, int diff, int rank)
 {
     this.score = score;
     scoreLabel.Text = score.TotalScore.ToString("D8");
     accuracyLabel.Text = String.Format("{0:0.00}%", score.Accuracy);
     maxComboLabel.Text = "" + score.MaxCombo + "x";
     dateLabel.Text = score.dateString;
     statsLabel.Text = "Perfect: " + "\nGood: " + "\nOK: " + "\nMiss: ";
     statsNoLabel.Text = "" + score.Perfects + "\n" + score.Goods + "\n" + score.Oks + "\n" + score.Misses;
     string songinf = score.ArtistTitle;
     if (songinf.Length < 26)
     {
         songInfoLabel.Text = songinf.Substring(0, songinf.Length) + " [" + score.chartName + "]";
     }
     else
     {
         songInfoLabel.Text = songinf.Substring(0, 25) + "... [" + score.chartName + "]";
     }
     if (score.ReplayName != "")
     {
         replayButton = new Button(game, new Rectangle(Config.ResWidth - (int)(Config.ResWidth * 0.3), 330, 100, 50), "Replay", delegate(int data)
         {
             IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
             if (Config.LocalScores)
             {
                 Replay replay = ScoreLibrary.reconReplay("replay\\r\\" + score.ReplayName + ".pcr");
                 try
                 {
                     temp.loadSong(song, diff, replay.Mods, replay, IngameScreen.PlayType.REPLAY);
                     temp.Music.stop();
                     Game.setScreen(game.screens["ingameScreen"]);
                     game.Title = "Pulse | Watch replay | " + song.Artist + " - " + song.SongName + " [" + song.Charts[diff].Name + "]";
                 }
                 catch { }
             }
             else
             {
                 string hash = Utils.calcHash(song.Charts[diff].Path);
                 string dl = "http://p.ulse.net/getreplay?r=" + rank + "&c=" + hash;
                 Console.WriteLine("{0} rank {1} hash", rank, hash);
                 downloadReplay dr = new downloadReplay();
                 dr.downloadFinish += new Action<Song, int>(dr_downloadFinish);
                 dr.DownloadReplay(dl, "replay\\" + hash + ".pcr", song, diff);
                // wc.DownloadFileAsync(new Uri(dl), "replay\\temp.pcr");
                 //wc.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(wc_DownloadFileCompleted);
                 replayButton.Enabled = false;
                 replayButton.Visible = false;
                 exitButton.Enabled = false;
                 exitButton.Visible = false;
                 Game.addToast("Downloading replay...");
             }
         });
         if (!UIComponents.Contains(replayButton))
         {
             UIComponents.Add(replayButton);
         }
     }
 }