Esempio n. 1
0
 public UserDisplay(User u, Point location)
 {
     this.u = u;
     back.Bounds = new Rectangle(location, new Size(back.Bounds.Width, back.Bounds.Height));
     front.Bounds = new Rectangle(location.X + 2, location.Y + 2, front.Bounds.Width, front.Bounds.Height);
     back.Colour = new Color4(0.6f, 0.6f, 0.6f, 0.9f);
     front.Colour = new Color4(0.6f, 0.6f, 0.6f, 0.8f);
     Thread t = new Thread(new ParameterizedThreadStart(downloadThread));
     wc = new WebClient();
     t.IsBackground = true;
     t.Start(u.Avatar);
     name = new Text(new Size(118, 200), new Point(location.X + 90, location.Y + 2));
     name.Shadow = false;
     name.Update(u.RealName);
     playCount = new Text(new Size(300, 300), new Point(location.X + 90, location.Y + 35));
     playCount.Shadow = false;
     playCount.textFont = new Font("Myriad Pro", 14);
     playCount.Line = ("PC: " + u.Playcount + "\nScore: " + u.TotalScore + "\nLevel: " + u.Level);
     b = new Button(Game.game, new Rectangle(playCount.Location, new Size(100, 30)), "PM", delegate(int e)
     {
         Game.pbox.addTab("pulse|" + u.RealName);
     });
     b2 = new Button(Game.game, new Rectangle(playCount.Location, new Size(100, 30)), "Spec", delegate(int e)
     {
         if (!Config.Spectating)
         {
             if (!u.Name.ToLower().Equals(Account.currentAccount.AccountName.ToLower()))
             {
                 Client.PacketWriter.sendSpectateHook(Game.conn.Bw, u.Name);
                 Game.pbox.addLine("Spectating " + u.Name + " (if they are online)");
             }
             else
             {
                 Game.pbox.addLine("You can't spectate yourself");
             }
         }
         else
         {
             if (!Config.SpectatedUser.Equals(""))
             {
                 Game.pbox.addLine("Canceling spectate on " + Config.SpectatedUser);
             }
             Client.PacketWriter.sendSpectateCancel(Game.conn.Bw, Config.SpectatedUser);
             Config.SpectatedUser = "";
             Config.Spectating = false;
         }
     });
     if (u.avatarRect != null)
     {
         avatar = u.avatarRect;
     }
 }
Esempio n. 2
0
 public PauseScreen(Game game, string text, IngameScreen screen)
     : base(game, text)
 {
     this.screen = screen;
     buttons[0] = new Button(game, new Rectangle(Config.ClientWidth / 2 - 100, 100, 200, 100), "Continue", delegate(int data)
     {
         screen.unpause();
     });
     buttons[1] = new Button(game, new Rectangle(Config.ClientWidth / 2 - 100, 300, 200, 100), "Retry", delegate(int data)
     {
         screen.loadSong(screen.CurrentSong, screen.Difficulty, screen.Mods, screen.CurrentReplay, screen.PlayType1);
         screen.onSwitched();
     });
     if (screen.PlayType1 == IngameScreen.PlayType.REPLAY || screen.PlayType1 == IngameScreen.PlayType.TEST)
     {
         buttons[1].Text = "Restart";
     }
     buttons[2] = new Button(game, new Rectangle(Config.ClientWidth / 2 - 100, 500, 200, 100), "Exit", delegate(int data)
     {
         Game.setScreen(game.screens["selectScreen"]);
         game.Title = "Pulse";
         if (Config.Spectating)
         {
             try
             {
                 Client.PacketWriter.sendSpectateCancel(Game.conn.Bw, Config.SpectatedUser);
             }
             catch
             {
             }
             Config.Spectating = false;
             Config.SpectatedUser = "";
             Config.Specs = "";
         }
     });
     for (int x = 0; x < buttons.Length; x++)
     {
         UIComponents.Add(buttons[x]);
     }
     overlay = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     overlay.Colour = new Color4(0.0f, 0.0f, 0.0f, 0.75f);
 }
Esempio n. 3
0
        public ScoreScreen(Game game, string name, Replay replay, Song song, int diff, bool play)
            : base(game, name)
        {
            if (play)
            {
                retryButton = new Button(game, new Rectangle(Config.ResWidth - (int)(Config.ResWidth * 0.3), 230, 100, 50), "Retry", delegate(int data)
                {
                    game.screens["ingameScreen"].Music.stop();
                    IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
                    temp.loadSong(temp.CurrentSong, temp.Difficulty, temp.Mods, null, IngameScreen.PlayType.PLAY);
                    Game.setScreen(game.screens["ingameScreen"]);
                });
                UIComponents.Add(retryButton);
            }
            if (replay != null)
            {

                this.replay = replay;
                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"];
                    try
                    {
                        if (temp.Music != null)
                        {
                            temp.Music.stop();
                        }
                        temp.loadSong(song, diff, temp.Mods, this.replay, IngameScreen.PlayType.REPLAY);
                        Game.setScreen(temp);
                        game.Title = "Pulse | Watch replay | " + song.Artist + " - " + song.SongName + " [" + song.Charts[diff].Name + "]";
                    }
                    catch { }
                });
                UIComponents.Add(replayButton);
            }
        }
Esempio n. 4
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);
         }
     }
 }
Esempio n. 5
0
 /*public ScoreSelectScreen(Game game, string name, Replay replay, Song song, int diff)
     : this(game, name)
 {
     foreach (var pair in replay.PressTimings)
     {
         pair.value.value = false;
     }
     foreach (var pair in replay.ReleaseTimings)
     {
         pair.value.value = false;
     }
     foreach (ReplayHit h in replay.HitTimings)
     {
         h.Used = false;
     }
     this.replay = replay;
     replayButton = new Button(game, new Rectangle(Config.ResWidth - (int)(Config.ResWidth * 0.3), 330, 100, 50), "Replay", delegate()
     {
         IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
         try
         {
             temp.loadSong(song, diff, new Mods(), replay, IngameScreen.PlayType.REPLAY);
             temp.Music.stop();
             Game.setScreen(game.screens["replayScreen"]);
             //temp.onSwitched();
             game.Title = "Pulse | Watch replay | " + song.Artist + " - " + song.SongName + " [" + song.Charts[diff].Name + "]";
         }
         catch { }
     });
     UIComponents.Add(replayButton);
     exitButton.del = delegate()
     {
         game.screens["selectScreen"].Music.stop();
         Game.setScreen(game.screens["selectScreen"]);
         game.Title = "Pulse";
     };
 }*/
 public ScoreSelectScreen(Game game, string name)
     : base(game, name)
 {
     songInfoLabel = new Label(game, new Point(180, 120), "0");
     songInfoLabel.TextTexture.TextFont = new Font("Myriad Pro", 35);
     dateLabel = new Label(game, new Point(Config.ResWidth / 2 - 200, 85), "0");
     UIComponents.Add(songInfoLabel);
     scoreLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 200), "0");
     accuracyLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 250), "0");
     maxComboLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 300), "0");
     statsLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 350), "0");
     statsNoLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.7), 350), "0");
     UIComponents.Add(dateLabel);
     UIComponents.Add(statsNoLabel);
     UIComponents.Add(statsLabel);
     UIComponents.Add(scoreLabel);
     UIComponents.Add(accuracyLabel);
     UIComponents.Add(maxComboLabel);
     scoreBg = new Rect(new Rectangle(new Point(0, 0), new Size(Config.ResWidth, 768)), Skin.skindict["scorebg"]);
     scoreBg.Colour = Color4.SlateGray;
     exitButton = new Button(game, new Rectangle(Config.ResWidth - (int)(Config.ResWidth * 0.3), 430, 100, 50), "Exit", delegate(int data)
     {
         game.screens["selectScreen"].Music.stop();
         Game.setScreen(game.screens["selectScreen"]);
         game.Title = "Pulse";
     });
     UIComponents.Add(exitButton);
 }
Esempio n. 6
0
        public override void OnUpdateFrame(OpenTK.FrameEventArgs e)
        {
            scroll();
            float mwdif = 0;
            if (!Game.MouseState.LeftButton)
            {
                doIt = true;
            }
            float currentmw = game.Mouse.WheelPrecise;
            base.OnUpdateFrame(e);
            if (searchCountdown > 0 && !resetSearch)
            {
                searchCountdown -= (int)(e.Time * 1000);
            }
            if (searchCountdown <= 0 && !resetSearch)
            {
                //   if(!searchLabel.Text.Equals("")) {
                search(searchLabel.Text);
                //}
                resetSearch = true;
                searchCountdown = 500;
            }
            if (updateScore) {
                if (displayScores != null && displayScores.Count > 0)
                {
                    int upperlimit = displayScores.Count > scoreDisplayPage * 8 + 8 ? scoreDisplayPage * 8 + 8 : displayScores.Count;
                    if (upperlimit > displayScores.Count)
                    {
                        upperlimit = displayScores.Count;
                    }
                    for (int i = scoreDisplayPage * 8; i < upperlimit; i++)
                    {
                        int toset = i;
                        int loc = (i == 0 ? 0 : (i % 8));
                        Button toAdd = new Button(game, new Rectangle(Config.ResWidth, 200 + (loc * 60) + (loc * 1) /*1 px padding*/, 230, 60), "#" + (toset + 1) + " " +
                            displayScores[toset].Player + " " + displayScores[toset].TotalScore.ToString("D8"), delegate(int data)
                        {
                            ScoreSelectScreen temp = (ScoreSelectScreen)game.screens["sSScreen"];
                            Game.setScreen(temp);
                            temp.Music = this.Music;
                            temp.setScore(displayScores[toset], currentSong, currtIndex, data);
                        }, Skin.skindict["scoreentry"]);
                        toAdd.OtherData = i + 1;
                        scoreDisplayText.Add(toAdd);
                    }
                }
                updateScore = false;
            }
            for (int i = 0; i < scoreDisplayText.Count; i++)
            {
                //orig 770
                int recalc = Config.ResWidth - 254;
                Button b = scoreDisplayText[i];
                if (b.Bounds.X == (int)(Config.ResWidth - 254))
                {
                    continue; //nothing to do here
                }
                if (i != 0)
                {
                    if (scoreDisplayText[i - 1].Bounds.X > (int)(Config.ResWidth - 104))
                    { //stagger it
                        continue;
                    }
                }
                //770
                //total of 254 pixels to travel
                double percentage = (b.Bounds.X - recalc) / 254d;
              //  double percentage = (b.Bounds.X - 1034) / 254d;
                double squared = Math.Pow(percentage, 0.7);
                /// Console.WriteLine("{0} {1}", percentage, squared);
                if (b.Bounds.X > recalc)
                {
                    //         Console.WriteLine(b.Bounds.X);
                    int tomove = b.Bounds.X - ((int)Math.Round((20 * squared)) + 1);// ((int)(1600 * e.Time)); //with *time wasnt being staggered correctly because if the update took too long in the first update it would step over 920
                    if (tomove < recalc)
                    {
                        tomove = recalc;
                    }
                    b.Bounds = new Rectangle(tomove, b.Bounds.Y, b.Bounds.Width, b.Bounds.Height);
                }
                else
                {
                    b.Bounds = new Rectangle(recalc, b.Bounds.Y, b.Bounds.Width, b.Bounds.Height);
                }
            }
            if (transitioning)
            {
                if (transIn)
                {
                    bgoverlay.Alpha += 0.15f;
                    if (bgoverlay.Alpha >= 1f)
                    {
                        transIn = false;
                    }
                }
                else
                {
                    bgoverlay.Alpha -= 0.15f;
                    if (bgoverlay.Alpha <= 0f)
                    {
                        transitioning = false;
                        transIn = true;
                    }
                }
            }
            if (changed)
            {
                time += e.Time;
                if (time > 0.1)
                {
                    Music.Volume += targetVolume / 10.0f;
                    if (Music.Volume >= targetVolume)
                    {
                        Music.Volume = targetVolume;
                        changed = false;
                    }
                    time = 0.0;
                }
            }
            if (accept && !Game.pbox.expanded)
            {
                //   searchLabel.Text += toadd;
                if (keyPress(Key.Down))
                {
                    if (pickSong)
                    {
                        if (index + 1 != songNameList.Count)
                        {
                            index++;
                            changeSong();
                        }
                    }
                }
                else if (keyPress(Key.Up))
                {
                    if (pickSong)
                    {
                        if (index - 1 > -1)
                        {
                            index--;
                            changeSong();
                        }
                    }
                }
                else if (keyPress(Key.Enter))
                {
                    if (pickSong)
                    {
                        pickDiffs();
                        updateScoreLabels(0);
                        if (play)
                        {
                            calibrateButton.Visible = true;
                            calibrateButton.Enabled = true;
                        }
                    }
                    else if (pickDiff)
                    {
                        playButton.del.Invoke(0);
                    }
                }
                else if (keyPress(Key.Escape))
                {

                    if (pickDiff)
                    {
                        notPickDiffs();
                        updateScoreLabels(0);
                        diffIndex = 0;
                        if (play)
                        {
                            calibrateButton.Visible = false;
                            calibrateButton.Enabled = false;
                        }
                    }
                    else if (searchLabel.Text.Length > 0)
                    {
                        resetSearch = false;
                        searchCountdown = 0;
                        searchLabel.Text = "";
                    }
                    else
                    {
                        //Music.stop();
                        Game.setScreen(game.screens["menuScreen"]);
                    }
                }
                else if (keyPress(Key.F1))
                {
                    refresh();
                    changeSong();
                }
                else if ((mwdif = currentmw - prevMouse) != 0)
                {
                    prevMouse = currentmw;
                    totalscroll += mwdif;
                    //  Console.WriteLine("{0},{1},{2}", mwdif, prevMouse, "lol");
                    if (totalscroll < -5f)
                    {
                        if (pickSong)
                        {
                            if (index + 1 != songNameList.Count)
                            {
                                index++;
                                changeSong();
                            }
                        }
                        totalscroll = 0;
                        // Console.WriteLine("total scroll reset");
                    }
                    else if (totalscroll > 5f)
                    {
                        if (pickSong)
                        {
                            if (index - 1 > -1)
                            {
                                index--;
                                changeSong();
                            }
                        }
                        totalscroll = 0;
                        //Console.WriteLine("total scroll reset");
                    }
                }
                else
                {
                }

            }
            else
            {
                count++;
                if (count == 10)
                    accept = true;
            }
            for (int x = 0; x < songNameList.Count; x++)
            {
                songNameList[x].select.OnUpdateFrame(e);
            }
            if (dim.Colour.A > 0 || pickDiff)
            {
                dim.draw(e);
                panel.draw(e);
                playButton.OnUpdateFrame(e);
                hdB.OnUpdateFrame(e);
                dtB.OnUpdateFrame(e);
                nfB.OnUpdateFrame(e);
                mirB.OnUpdateFrame(e);
                autoB.OnUpdateFrame(e);
                htB.OnUpdateFrame(e);
                closeSel.OnUpdateFrame(e);
                calibrateButton.OnUpdateFrame(e);
                rateDrag.OnUpdateFrame(e);
            }
            if (displayScores != null)
            {
                if (scoreDisplayText.Count > 0)
                {
                    foreach (Button t in scoreDisplayText)
                    {
                        t.OnUpdateFrame(null);
                    }
                }
            }
        }
Esempio n. 7
0
        public override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            panel.Colour = new OpenTK.Graphics.Color4(0.3f, 0.3f, 0.3f, 0.0f);
            dim.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 0.0f);
            fsw.EnableRaisingEvents = true;
            fsw.IncludeSubdirectories = true;
            fsw.Created += new FileSystemEventHandler(fsw_Created);
            fsw.Changed += new FileSystemEventHandler(fsw_Created);
            fsw.Deleted += new FileSystemEventHandler(fsw_Deleted);
            fsw.Error += new ErrorEventHandler(fsw_Error);
            fsw.InternalBufferSize = 61440; //lets handle large changes ;D
            SongLibrary.cacheSongInfo();
            game.KeyPress += new EventHandler<OpenTK.KeyPressEventArgs>(game_KeyPress);
            bgoverlay.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 0.5f);
            searchLabel = new Label(game, new Point(0, 700), "");
            searchLabel.TextTexture.Shadow = true;
            searchInfoL = new Label(game, new Point(0, 700), "type to begin search..");
            //searchInfoL.TextTexture.Shadow = true;
            searchInfoL.TextTexture.Colour = Color.White;

            onlineToggle = new ToggleButton(game, new Rectangle(Utils.getMX(780), 130, 50, 40), "O", delegate(int data)
            {
                Config.LocalScores = !Config.LocalScores;
                updateScoreLabels(0);
            });

            prevPage = new Button(game, new Rectangle(Utils.getMX(835), 130, 50, 40), "<<", delegate(int data)
            {

                if(displayScores != null && scoreDisplayPage > 0) {
                    scoreDisplayPage--;
                    updateScoreLabels(scoreDisplayPage);
                }
            });
            nextPage = new Button(game, new Rectangle(Utils.getMX(890), 130, 50, 40), ">>", delegate(int data)
            {

                if (displayScores != null && displayScores.Count > 0) //if count was 0 maxpage would be -1
                {
                    int maxpage = displayScores.Count / 8;
                    if (displayScores.Count % 8 > 0) //if there's a remainder that means theres some extra scores to display so need new page
                    {
                        maxpage++;
                    }
                    maxpage--; //remember, scoredisplaypage is 0 based!
                    if (scoreDisplayPage < maxpage)
                    {
                        scoreDisplayPage++;
                        updateScoreLabels(scoreDisplayPage);
                        /*if (scoreDisplayPage == maxpage) //finish later, faulty to have in a place like this
                        {
                            nextPage.Visible = false;
                            nextPage.Enabled = false;
                        }*/
                    }
                }
            });
            if (!Config.LocalScores)
            {
                ((ToggleButton)onlineToggle).toggle();
            }
            UIComponents.Add(prevPage);
            UIComponents.Add(nextPage);
            UIComponents.Add(onlineToggle);
            calibrateButton = new Button(game, new Rectangle(70, 768 - 170, 200, 50), "Calibrate offset", delegate(int data)
            {
                int tIndex = 0;
                for (int x = 0; x < currentSong.Charts.Count; x++)
                {
                    if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                    {
                        tIndex = x;
                    }
                }
                IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
                try
                {
                    uint flags = 0;
                    flags = flags | (uint)(nfB.Selected ? 1 : 0);
                    flags = flags | (uint)(autoB.Selected ? 2 : 0);
                    flags = flags | (uint)(mirB.Selected ? 4 : 0);
                    flags = flags | (uint)(hdB.Selected ? 8 : 0);
                    temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex, new Mods()
                            {
                                Speed = dtB.Selected ? 1.5 : 1.0,
                                Flags = flags,
                                Scroll = Config.PlaySpeed
                            }, null, IngameScreen.PlayType.PLAY);
                    Music.stop();
                    Game.setScreen(game.screens["ingameScreen"]);
                    temp.Calibrate = true;
                    game.Title = "Pulse | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]";
                }
                catch (Exception ex)
                {
                    ErrorLog.log(ex);
                }
            });
            calibrateButton.Visible = false;
            calibrateButton.Enabled = false;
             //   int backpos = Config.ResWidth - 244;//Config.WideScreen? (int)((780d/1024d) * game.Width) : 780;
            backLabel = new Button(game, new Rectangle(Utils.getMX(780), 10, 220, 50), "Back", delegate(int data)
            {
                Game.setScreen(game.screens["menuScreen"]);
            });
            help = new Button(game, new Rectangle(Utils.getMX(780), 130, 220, 50), "Help", delegate(int data)
            {
                new EditorHelp().ShowDialog();
                Game.resetStates();
            });
            UIComponents.Add(help);

            newSongb = new Button(game, new Rectangle(Utils.getMX(780), 70, 220, 50), "New Song", delegate(int data)
            {
                new NewSong().ShowDialog();
                Game.resetStates();
            });
            //   UIComponents.Add(searchLabel);
            UIComponents.Add(backLabel);
            UIComponents.Add(newSongb);
            #region obsolete
            /*difficultyTexts[0] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
            difficultyTexts[0].Update("3key");
            difficultyTexts[0].Shadow = true;
            difficultyTexts[1] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
            difficultyTexts[1].Update("4key");
            difficultyTexts[1].Shadow = true;
            difficultyTexts[2] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
            difficultyTexts[2].Update("6key");
            difficultyTexts[2].Shadow = true;
            difficultyTexts[3] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
            difficultyTexts[3].Update("7key");
            difficultyTexts[3].Shadow = true;*/
            #endregion
            refresh();
            index = 0;
            for (int x = 0; x < songNameList.Count; x++)
            {
                if (songNameList[x].Info.SongName.Equals(Game.M.CurrentSong.SongName) && songNameList[x].Info.Dir.Equals(Game.M.CurrentSong.Dir))
                {
                    index = x;
                }
            }
            changeSong();
            selectionTexture = new Rect(new Rectangle(2, 250, 548, 28));
            sel2 = new Rect(new Rectangle(0, 249, 552, 30));
            searchBox = new Rect(new Rectangle(0, 700, Config.ResWidth, 30));
            searchBox.Colour = new OpenTK.Graphics.Color4(0.27f, 0.509f, 0.705f, .8f);
            cover = new Rect(new Rectangle(Config.ResWidth - 300, 0, 300, 768));
            cover.Colour = new OpenTK.Graphics.Color4(1f, 1f, 1f, .7f);
            scorebg = new Rect(new Rectangle((int)(Config.ResWidth - 324), 180, 295, 600), Skin.skindict["scoreback"]);
            sel2.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 1.0f);
            selectionTexture.Colour = new OpenTK.Graphics.Color4(0.25f, 0.0f, 1.0f, 1.0f);
            background = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));

            currentSong = SongLibrary.loadSong(songNameList[index].Info);
            string bgString = "";
            if (currentSong.FileVersion == 0)
            {
                bgString = currentSong.BgName;
            }
            else
            {
                bgString = currentSong.Charts[0].BgName;
            }
            background.useTexture("songs\\" + currentSong.Dir + "\\" + bgString);

            music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName);
            Music.Volume = 0.0f;
            targetVolume = Config.Volume / 100.0f;
            changed = true;
            Music.PositionAsMilli = (long)Game.M.Music.PositionAsMilli;
            Music.play(false, true);
            if (play)
            {
                game.Title = "Pulse | Play Selection";
                newSongb.Enabled = false;
                newSongb.Visible = false;
                help.Enabled = false;
                help.Visible = false;
            }
            else
            {
                game.Title = "Pulse | Edit Selection";
                newSongb.Enabled = true;
                newSongb.Visible = true;
            }
            updateDiffs();
            updateScoreLabels(0);
            //   changeSong();
            //   index = 0;
            for (int x = 0; x < songNameList.Count; x++)
            {
                // if (songNameList[x].textData.Location.Y != 246 + ((x - index) * 33) && !songNameList[x].textData.Moving)
                //  {
                songNameList[x].select.Bounds = new Rectangle(0, 246 + ((x - index) * 90), songNameList[x].select.Bounds.Width, songNameList[x].select.Bounds.Height);
                //  Console.WriteLine(songNameList[x].textData.Position.
                //
            }
            //Console.WriteLine("why");
            List<string> t = new List<String>();
            t.Add(" ");
            diffs = new DropDownBox(game, t, new Rectangle(70, 120, 150, 35));
            diffs.selected += new Action<int>(diffs_selected);
            string tempS = "";
            if (play)
            {
                tempS = "Play";
            }
            else
            {
                tempS = "Edit";
            }
            playButton = new Button(game, new Rectangle(290 + 220, 768 - 170, 200, 50), tempS, delegate(int data)
            {
                if (pickDiff)
                {
                    int tIndex = 0;
                    for (int x = 0; x < currentSong.Charts.Count; x++)
                    {
                        if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                        {
                            tIndex = x;
                        }
                    }
                    /*if (Config.AutoPlay && play)
                    {
                        ReplayScreen temp = (ReplayScreen)game.screens["replayScreen"];
                        try
                        {
                            temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex);
                            Game.M.setSong(songNameList[index].Info);
                            Game.M.play();
                            Music.stop();
                            Game.setScreen(game.screens["replayScreen"]);
                            game.Title = "Pulse | Watch replay | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]";
                        }
                        catch { }
                    }
                    else */if (play)
                    {
                        IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
                        try
                        {
                            IngameScreen.PlayType te = IngameScreen.PlayType.PLAY;
                            if (autoB.Selected)
                                te = IngameScreen.PlayType.AUTO;
                            uint flags = 0;
                            flags = flags | (uint)(nfB.Selected ? 1 : 0);
                            flags = flags | (uint)(autoB.Selected ? 2 : 0);
                            flags = flags | (uint)(mirB.Selected ? 4 : 0);
                            flags = flags | (uint)(hdB.Selected ? 8 : 0);
                            temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex, new Mods()
                            {
                                Speed = dtB.Selected ? 1.5 : 1.0,
                                Flags = flags,
                                Scroll = Config.PlaySpeed
                            }, null, te);
                            Game.M.setSong(ref songNameList[index].Info);
                            Game.M.play();
                            Music.stop();
                            temp.Calibrate = false;
                            Game.setScreen(game.screens["ingameScreen"]);
                            game.Title = "Pulse | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]";
                            scoreDisplayText.Clear();
                            scoreDisplayPage = 1;
                        }
                        catch (Exception ex)
                        {
                            ErrorLog.log(ex);
                        }
                    }
                    else if (!play)
                    {
                        EditorScreen temp = (EditorScreen)game.screens["editScreen"];
                        try
                        {
                            temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex);
                            Game.M.setSong(ref songNameList[index].Info);
                            Game.M.play();
                            Music.stop();
                            Game.setScreen(game.screens["editScreen"]);
                        }
                        catch (KeyNotFoundException)
                        {
                        }
                        game.Title = "Pulse|Editor|" + currentSong.Artist + "-" + currentSong.SongName + "[" + currentSong.Charts[tIndex].Name + "]";
                    }
                }
            });
            autoB = new ToggleButton(game, new Rectangle(874 - 480, 120, 100, 40), "Auto", delegate(int data)
            {
                Config.AutoPlay = autoB.Selected;
            });
            dtB = new ToggleButton(game, new Rectangle(874 - 370, 120, 100, 40), "DT", delegate(int data)
            {
                Config.Dt = dtB.Selected;
                if (Config.Dt)
                {
                    Config.Ht = false;
                    if (htB.Selected)
                    {
                        htB.toggle();
                    }
                }
            });
            htB = new ToggleButton(game, new Rectangle(874 - 260, 120, 100, 40), "HT", delegate(int data)
            {
                Config.Ht = htB.Selected;
                if (Config.Ht)
                {
                    Config.Dt = false;
                    if (dtB.Selected)
                    {
                        dtB.toggle();
                    }
                }
            });
            mirB = new ToggleButton(game, new Rectangle(874 - 480, 170, 100, 40), "Mirror", delegate(int data)
            {
                Config.Mirror = mirB.Selected;
            });
            hdB = new ToggleButton(game, new Rectangle(874 - 370, 170, 100, 40), "HD", delegate(int data)
            {
                Config.Hidden = hdB.Selected;
            });
            nfB = new ToggleButton(game, new Rectangle(874 - 260, 170, 100, 40), "No fail", delegate(int data)
            {
                Config.NoFail = nfB.Selected;
            });
            closeSel = new Button(game, new Rectangle(290, 768 - 170, 200, 50), "Close", delegate(int data)
                {
                    notPickDiffs();
                });
            rateLabel = new Label(game, new Point(874 - 460, 370), "Scroll speed: " + Config.PlaySpeed);
            rateDrag = new Dragbar(game, new Point(874-460, 400), 300, false, delegate(int d)
                {
                    double temp = rateDrag.getPercentScrolled();
                    int x = (int)(temp / 10);
                    Config.PlaySpeed = ((float)x / 2) + 0.5f;
                    rateLabel.Text = "Scroll speed: " + Config.PlaySpeed;
                });
            rateDrag.setPos(rateDrag.Bounds.X + (int)(Config.PlaySpeed * 20) + rateDrag.Bounds.Width / 10);
            game.Mouse.Move += new EventHandler<MouseMoveEventArgs>(Mouse_Move);
        }
Esempio n. 8
0
        private void updateScoreLabels(int e)
        {
            scoreDisplayText.Clear();
            //gotScore = false;
            if (!pickDiff)
            {

                displayScores = null;
                return;
            }
            SongInfo ss = songNameList[index].Info;
            scoreDisplayPage = e;
            //Console.WriteLine("updating score labels");
            int tIndex = 0;
            for (int x = 0; x < currentSong.Charts.Count; x++)
            {
                if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                {
                    tIndex = x;
                }
            }
            String diffName = currentSong.Charts[tIndex].Name;
            if (currentSong.FileVersion == 1)
            {
                if (Config.LocalScores)
                {
                    string tempFileName = ScoreLibrary.getFileFromDiff(ss, diffName);
                    string hash = Utils.calcHash(tempFileName);
                    //  List<Score> tempList = null;
                    if (File.Exists("replay\\" + hash + ".psf"))
                    {
                        if (currentUpload != null)
                        {
                            currentUpload.abort();
                        }
                        displayScores = ScoreLibrary.reconstruct("replay\\" + hash + ".psf");
                        displayScores.Sort(scoreCompare);
                        scoreDisplayText.Clear();
                        //if calculated upper bound exceeds displayscores.count, use count as upper bound instead
                        int upperlimit = displayScores.Count > scoreDisplayPage * 8 + 8 ? scoreDisplayPage * 8 + 8 : displayScores.Count;

                        for (int i = scoreDisplayPage * 8; i < upperlimit; i++)
                        {
                            int toset = i;
                            int loc = (i == 0 ? 0 : (i % 8));
                            Button toAdd = new Button(game, new Rectangle(Config.ResWidth, 200 + (loc * 60) + (loc * 1) /*1 px padding*/, 230, 60), "#" + (toset + 1) + " " + displayScores[toset].Player + " " + displayScores[toset].TotalScore.ToString("D8"), delegate(int data)
                            {
                                ScoreSelectScreen temp = (ScoreSelectScreen)game.screens["sSScreen"];
                                Game.setScreen(temp);
                                temp.Music = this.Music;
                                temp.setScore(displayScores[toset], currentSong, tIndex, data);
                            }, Skin.skindict["scoreentry"]);
                            toAdd.OtherData = i + 1;
                            scoreDisplayText.Add(toAdd);
                        }
                        return;
                    }
                    else
                    {
                        displayScores = null;
                        return;
                    }
                }
                else
                {
                    if (Account.currentAccount != null)
                    {
                        //online scores TODO
                        if (!gotScore)
                        {
                            gotScore = true;
                            string hash = Utils.calcHash(currentSong.Charts[tIndex].Path);
                            NameValueCollection n = new NameValueCollection();
                            n.Add("n", Account.currentAccount.AccountName);
                            n.Add("c", hash);

                            scoreDisplayText.Clear();
                            if (currentUpload != null)
                            {
                                //currentUpload.abort();
                            }
                            UploadClass uc = new UploadClass();
                            currentUpload = uc;
                            uc.additionalArg = tIndex; //hacky
                            uc.uploadDone += new Action<string, int>(uc_uploadDone);
                            uc.HttpUploadFileAsync("http://p.ulse.net/getscores", n);
                        }
                        //Game.game.Context.MakeCurrent(null); not gonna fly ;x
                        /*  I feel like I am flying so free across the sky
                            Like i'm diving in the air
                            I fly high the way you want it

                            Just gotta the way you want it.

                            Don't trip on the people
                            And things around you now
                            Keep lookin' ahead cousin
                            So glide on until you find it

                            Just gotta until you find it
                            In this limitless sky

                            Full speed ahead and I get high
                            Open the window (Look up the sky)
                            (That's the floating island in the legendary world)
                            Future is eternal, (Light, early-morning sunlight)
                            (The greatest, open up, look now with your left eye)

                            It's all a weird-ass place i'm in so weird a place
                            I'm tripping-out passing time
                            It's a wonderful way to free my mind
                            Up in the sky
                            I'm content to keep on flying.*/
                    }
                    else
                    {
                        Config.LocalScores = true;
                        ((ToggleButton)onlineToggle).toggle();
                    }
                }
            }
        }
Esempio n. 9
0
        public TimingScreen(Game game, string name)
            : base(game, name)
        {
            reset = new Button(game, new Rectangle(600, 50, 200, 50), "Reset", delegate(int data)
            {
                song.Timings.Remove(offset);
                times.Clear();
                bpms.Clear();
                bpmLabel.Text = "BPM: ---";
                offsetLabel.Text = "Offset: ---";
                Music.play(true);

            });
            back = new Button(game, new Rectangle(100, 600, 200, 50), "Back", delegate(int data)
            {
                Music.stop();
                Game.setScreen(game.screens["editScreen"]);
            });
            UIComponents.Add(back);
            offsetLabel = new Label(game, new Point(200, 180), "Offset: ---");
            UIComponents.Add(offsetLabel);
            timeButton = new Button(game, new Rectangle(100, 50, 400, 50), "Press in time to the beat!", delegate(int data)
            {
                if (times.Count < 1)
                {
                    int off = Environment.TickCount - initial;
                    times.Add(off);
                    offset = (int)music.PositionAsMilli;
                    offsetLabel.Text = "Offset: " + music.PositionAsMilli;
                }
                else
                {
                    int diff = Environment.TickCount - initial;
                    double bpmtoadd = ((60d * 1000d) / (diff - times[times.Count - 1]));
                    if (!double.IsInfinity(bpmtoadd))
                    {
                        bpms.Add(bpmtoadd);
                        //Console.WriteLine(bpms.Average());
                        if (bpms.Count < 20)
                        {
                            bpm = Math.Round(bpms.Average(), 0);
                        }
                        else if (bpms.Count < 40)
                        {
                            bpm = Math.Round(bpms.Average(), 1);
                        }
                        else
                        {
                            bpm = Math.Round(bpms.Average(), 2);
                        }
                        bpmLabel.Text = "BPM: " + bpm;
                        //   if(bpms.Average() >= double.MaxValue) {
                        //    bpms.Clear();
                        //  }
                    }
                    times.Add(diff);
                }
            });
            save = new Button(game, new Rectangle(600, 125, 200, 50), "Save", delegate(int data)
            {
                try
                {
                    song.Timings[offset].Snap = 60 / bpm;
                }
                catch
                {
                    song.Timings.Add(offset, new TimingSection(offset, bpm, true));
                }
                Game.addToast("Timing section saved");
            });
            UIComponents.Add(save);
            bpmLabel = new Label(game, new Point(200, 150), "BPM: ---");
            UIComponents.Add(bpmLabel);
            UIComponents.Add(reset);
            UIComponents.Add(timeButton);
        }
Esempio n. 10
0
        public override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            IngameScreen tempPlayScreen = (IngameScreen)game.screens["ingameScreen"];
            string songinf = tempPlayScreen.CurrentSong.Artist + " - " + tempPlayScreen.CurrentSong.SongName;

            songInfoLabel = new Label(game, new Point(180, 120), "0");
            dateLabel = new Label(game, new Point(200, 85), "0");
            UIComponents.Add(dateLabel);
            songInfoLabel.TextTexture.TextFont = new Font("Myriad Pro", 35);
            if (songinf.Length < 26)
            {
                songInfoLabel.Text = songinf.Substring(0, songinf.Length) + " [" + tempPlayScreen.Chart.Name + "]";
            }
            else
            {
                songInfoLabel.Text = songinf.Substring(0, 25) + "... [" + tempPlayScreen.Chart.Name + "]";
            }
            UIComponents.Add(songInfoLabel);
            scoreLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 200), "0");
            accuracyLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 250), "0");
            maxComboLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 300), "0");
            statsLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.8), 350), "0");
            statsNoLabel = new Label(game, new Point(Config.ResWidth - (int)(Config.ResWidth * 0.7), 350), "0");
            UIComponents.Add(statsNoLabel);
            UIComponents.Add(statsLabel);
            UIComponents.Add(scoreLabel);
            UIComponents.Add(accuracyLabel);
            UIComponents.Add(maxComboLabel);
            scoreBg = new Rect(new Rectangle(new Point(0, 0), new Size(Config.ResWidth, 768)), Skin.skindict["scorebg"]);
            scoreBg.Colour = Color4.SlateGray;
            exitButton = new Button(game, new Rectangle(Config.ResWidth - (int)(Config.ResWidth * 0.3), 430, 100, 50), "Exit", delegate(int data)
            {
                game.screens["ingameScreen"].Music.stop();
                Game.setScreen(game.screens["selectScreen"]);
                game.Title = "Pulse";
            });
            UIComponents.Add(exitButton);
        }
Esempio n. 11
0
        //    Rect test;
        public override void OnLoad(EventArgs e)
        {
            Game.stopMedia = false;
            base.OnLoad(e);
               // AviManager am = new AviManager("vid1.avi", true);
              //  VideoStream vs = am.GetVideoStream();
             //   test = new Rect(new Rectangle(0, 0, 300, 300), FrameGrabber.GetFrameFromVideo("vid1.avi", .2));
            //vs.GetFrameOpen();
            //vs.GetBitmap()
              //  Console.WriteLine(vs.StreamInfo.dwLength);
             //   vs.GetFrameClose();
            Animation preload = new Animation(new Rectangle(0, 0, 0, 0), 100, "holdBurst", 3, true, true);
            // ircl = new Client.irc.IrcClient("lol");
            logo = new Rect(new Rectangle(Config.ResWidth / 2 - (710 / 2), 20, 710, 519), "skin\\Pulse-LogoText.png");
            startText = new Label(game, new Rectangle(new Point(0, 0),
                new Size(0, 0)), "pulse alpha version " + Config.Version);
            SizeF temp = startText.TextTexture.getStringSize();
            Button optionsButton = new Button(game, new Rectangle((Config.ResWidth / 2) - 150, 768 / 2 + 240, 300, 60), "Options", delegate(int data)
            {
                //  new Thread(new ThreadStart(openOptions)).Start();
                new Options().ShowDialog();
            }, true, true, Color.LawnGreen);
            Button exitButton = new Button(game, new Rectangle((Config.ResWidth / 2) - 150, 768 / 2 + 305, 300, 60), "Exit", delegate(int data)
            {
                game.Exit();
            }, true, true, Color.Cyan);
            Button playButton = new Button(game, new Rectangle(Config.ResWidth / 2 - 150, 768 / 2 + 110, 300, 60), "Play", delegate(int data)
            {
                play(true);
            }, true, true, Color.Red);
            Button editButton = new Button(game, new Rectangle(Config.ResWidth / 2 - 150, 768 / 2 + 175, 300, 60), "Edit", delegate(int data)
            {
                play(false);
            }, true, true, Color.Blue);
            avatarbutton = new Button(game, new Rectangle(Utils.getMX(700), 0, 300, 100), "\tLogin", delegate(int data)
            {
                new Pulse.UI.LoginDialog().ShowDialog();
                // downloadAvatar();
            });
            UIComponents.Add(avatarbutton);
            startText.TextTexture.Location = new Point(Config.ResWidth / 2 - ((int)temp.Width / 2), 0);
            startText.TextTexture.TextureSize = new Size((int)temp.Width, (int)temp.Height);
            bg = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
            bg.Colour = new OpenTK.Graphics.Color4(0.4f, 0.4f, 0.4f, 1.0f);
            bg.useTexture("skin\\Pulse-LogoText.png");
            bg2 = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
            bg2.Colour = new OpenTK.Graphics.Color4(0.4f, 0.4f, 0.4f, 1.0f);
            bg2.useTexture("skin\\Pulse-LogoText.png");
            bg2.Alpha = 0.3f;
            bg3 = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
            bg3.Colour = new OpenTK.Graphics.Color4(1.0f, 1.0f, 1.0f, 1.0f);
            bg3.useTexture("skin\\Pulse-MenuBG.png");
            bg4 = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
            bg4.Colour = new OpenTK.Graphics.Color4(1.0f, 1.0f, 1.0f, 1.0f);
            bg4.useTexture("skin\\Pulse-MenuOverlay.png");
            website = new Button(game, new Rectangle(0, 768 - 53, 360, 53), "", delegate(int data)
                {
                    if (!Game.pbox.expanded)
                    {
                        System.Diagnostics.Process.Start("http://p.ulse.net");
                    }
                }, Skin.skindict["websiteText"]);
            setMarquee();

            UIComponents.Add(startText);
            UIComponents.Add(optionsButton);
            UIComponents.Add(playButton);
            UIComponents.Add(editButton);
            //UIComponents.Add(nowp);
            UIComponents.Add(exitButton);
            // pbox = new PTextBox(game, new Rectangle(0, 768-300, Utils.getMX(1024), 290), "", ircl);
            //UIComponents.Add(pbox);
            //UIComponents.Add(skipForwardButton);
            //UIComponents.Add(togglePauseButton);
            Game.conn.recvPacket += new Action<short, Client.RecievePacket>(conn_recvPacket);
            //downloadAvatar();
        }
Esempio n. 12
0
        public MediaPlayer(Game game)
        {
            this.game = game;
            stop = new Button(game, new Rectangle(155, 5, 45, 45), "", delegate(int data)
            {
                stopped = true;
                pause.Texture.useTexture(Skin.skindict["mediaPY"]);
                music.pause();
            }, Skin.skindict["mediaSP"]);
            stop.manualColour = true;
            forward = new Button(game, new Rectangle(new Point(105, 5), new Size(45, 45)), "", delegate(int data)
            {
                if (!music.Finished)
                {
                    music.stop();
                }
                pause.Texture.useTexture(Skin.skindict["mediaPS"]);
            }, Skin.skindict["mediaFF"]);
            forward.manualColour = true;
            pause = new Button(game, new Rectangle(new Point(55, 5), new Size(45, 45)), "", delegate(int data)
            {
                if (!music.Paused)
                {
                    music.pause();
                    pause.Texture.useTexture(Skin.skindict["mediaPY"]);
                }
                else
                {
                    if (stopped)
                    {
                        music.play(true);
                    }
                    else
                    {
                        music.play(false);
                    }
                    stopped = false;
                    pause.Texture.useTexture(Skin.skindict["mediaPS"]);
                }
            }, Skin.skindict["mediaPS"]);
            pause.manualColour = true;
            backward = new Button(game, new Rectangle(new Point(5, 5), new Size(45, 45)), "", delegate(int data)
            {

                pause.Texture.useTexture(Skin.skindict["mediaPS"]);
                if (previousSongs.Count > 1)
                {
                    music.stop();
                    if (currentID - 1 == -1)
                    {
                        currentID = 0;
                    }
                    else
                    {
                        currentID--;
                    }
                    setSong(previousSongs[currentID]);
                    play();
                }
                else
                {
                    music.PositionAsMilli = 0;
                    currentID = 0;
                }
            }, Skin.skindict["mediaFB"]);
            backward.manualColour = true;
            title = new Label(game, new Point(0, 50), "");
            Random r = new Random();
            if (SongLibrary.Songs.Count > 0)
            {
                int id;
                id = r.Next(0, SongLibrary.Songs.Count);
                setSong(id);
                play();
                previousSongs.Add(id);
                currentID = 0;
            }
            position = new Dragbar(game, new Point(10, 85), 230, false, delegate(int d)
                {
                    music.PositionAsMilli = (long)((music.Length / 100) * position.getPercentScrolled());
                });
        }
Esempio n. 13
0
 private void initUI()
 {
     if (skip != null)
     {
         UIComponents.Remove(skip);
     }
     skip = new Button(game, new Rectangle(400, 350, 200, 50), "Skip", delegate(int data)
     {
         running = true;
         unpause();
         music.PositionAsMilli = (long)startOffset - 2000;
         currentOffset = music.PositionAsMilli;
         skip.Visible = false;
         skip.Enabled = false;
     });
     UIComponents.Add(skip);
     if (startOffset < 2000)
     {
         skip.Visible = false;
         skip.Enabled = false;
     }
     else
     {
         skip.Visible = true;
         skip.Enabled = true;
     }
     bg = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     if (currentSong.FileVersion == 0)
     {
         bg.useTexture("songs\\" + currentSong.Dir + "\\" + currentSong.BgName);
         music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName);
     }
     else
     {
         bg.useTexture("songs\\" + currentSong.Dir + "\\" + chart.BgName);
         music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName); //fix in future to load per chart
     }
     forceScores = false;
     failed = false;
     scores = false;
     running = false;
     paused = false;
     UIComponents.Clear();
     score = new Score();
     score.Flags = (int)mods.Flags;
     scoreFadeTime = 0;
     pulse = false;
     Config.Editing = false;
     Skin.PlayFrame = new Frame(Skin.FrameLoc, chart.Keys);
     frame = Skin.PlayFrame;
     setNoteOffsets(Skin.FrameLoc);
     tlContainer = new Rect(new Rectangle(Config.ResWidth - 605, 0, 605, 150), Skin.skindict["tlContainer"]);
     hpBar = new Rect(new Rectangle((int)frame.Location.X + (int)frame.Width, 0, 10, (int)frame.HitHeight));
     adjustHp(0);
     overlay = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     overlay.Colour = new Color4(0.0f, 0.0f, 0.0f, 0.0f);
     glow = new Rect(new Rectangle((int)frame.Location.X, (int)frame.HitHeight - 43, (int)frame.Width, 40), Skin.skindict["keyLight"]);
     glow.Colour = Skin.PulseColour;
     for (int x = 0; x < lights.Length; x++)
     {
         presses[x] = new Rect(new Rectangle(frame.Location.X + frame.LaneLoc[x] + 5 + (1 * x), frame.Location.Y + 600, frame.LaneWidth[x] + 1, 50), Skin.skindict["press" + (x + 1)]);
         presses[x].fade(0.0f, 0.075);
         lights[x] = new Rect(new Rectangle(((frame.Location.X) + frame.LaneLoc[x]) + (1 * x) + 5 + 25, (int)frame.HitHeight - 53, 0, frame.LaneWidth[x]), Skin.skindict["keyLight"]);
         glows[x] = new Rect(new Rectangle(((frame.Location.X) + frame.LaneLoc[x]) + (1 * x) + 5, (int)frame.HitHeight - 203, frame.LaneWidth[x], 200), Skin.skindict["keyLight"]);
         glows[x].Colour = new Color4(1.0f, 1.0f, 1.0f, 0.5f);
         lights[x].Colour = Skin.LightColours[x];
         lights[x].fade(0.0f, 0.075);
         glows[x].fade(0.0f, 0.075);
     }
     songtitle = new Label(game, new Point(Config.ResWidth - 490, 10), currentSong.SongName + " - " + chart.Name);
     songartist = new Label(game, new Point(Config.ResWidth - 485, 60), currentSong.Artist);
     songtitle.TextTexture.TextFont = new Font("Myriad Pro", 35);
     songtitle.TextTexture.Shadow = false;
     songartist.TextTexture.Shadow = false;
     UIComponents.Add(songartist);
     UIComponents.Add(songtitle);
     if (calibrate)
     {
         offsetLabel = new Label(game, new Point(450, 85), "Average mistime: ");
         UIComponents.Add(offsetLabel);
         offsetLabel.Visible = true;
         offsetLabel.Enabled = true;
         offsets.Clear();
     }
     scoreLabel = new GraphicalText(score.TotalScore.ToString("D9"), Skin.ScoreLocation);
     scoreLabel.scale(new Size(30, 30), 0.1);
     comboText = new GraphicalText("0x", (new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString("0x", frame.LaneWidth[0])) / 2, frame.Location.Y + 200)));
     comboText.Visible = false;
     accuracyLabel = new GraphicalText("00.00%", Skin.AccLocation);
     pauseScreen = new PauseScreen(game, "pause", this);
     pauseScreen.OnLoad(null);
     countDown = new Label(game, new Point((int)frame.Location.X + (int)frame.Width + 20, (int)frame.HitHeight - 20), "00:00");
     countDown.TextTexture.TextFont = new Font("Myriad pro", 30);
     UIComponents.Add(countDown);
     scoreLabel.scale(new Size(Skin.ScoreSize.Width, Skin.ScoreSize.Height), 0.0);
     accuracyLabel.scale(new Size(Skin.AccSize.Width, Skin.AccSize.Height), 0.0);
     if (skip != null)
     {
         UIComponents.Add(skip);
     }
     bufferOverlay = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     bufferOverlay.Colour = new Color4(0, 0, 0, 0.5f);
     bufferingLabel = new Label(game, new Point(Config.ResWidth / 2 - 100, 768 / 2 - 20), "Buffering...");
     specFailedLabel = new Label(game, new Point(Config.ResWidth / 2 - 100, 768 / 2 - 20), "User failed");
     userList = new Text(new Size(700, 100), new Point((int)frame.Width + 50, 70));
     oldSpecs = "";
 }