Esempio n. 1
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. 2
0
        public override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);
            if (!Game.pbox.expanded)
            {
                if (keyPress(Key.Up))
                {
                    if (failed)
                    {
                        indexMin = 1;
                    }
                    else
                    {
                        indexMin = 0;
                    }
                    if (index > indexMin)
                    {
                        buttons[index].Colour       = Color.White;
                        buttons[index].manualColour = false;
                        index--;
                        buttons[index].manualColour = true;
                        buttons[index].Colour       = Color.FromArgb(255, 255, 100, 0);
                    }
                }
                if (keyPress(Key.Down))
                {
                    if (index < 2)
                    {
                        buttons[index].Colour       = Color.White;
                        buttons[index].manualColour = false;
                        index++;
                        buttons[index].manualColour = true;
                        buttons[index].Colour       = Color.FromArgb(255, 255, 100, 0);
                    }
                }
                if (keyPress(Config.RestartKey))
                {
                    screen.loadSong(screen.CurrentSong, screen.Difficulty, screen.Mods, screen.CurrentReplay, screen.PlayType1);
                    screen.onSwitched();
                }
                if (keyPress(Key.Enter))
                {
                    switch (index)
                    {
                    case 0:
                        screen.unpause();
                        break;

                    case 1:
                        screen.loadSong(screen.CurrentSong, screen.Difficulty, screen.Mods, screen.CurrentReplay, screen.PlayType1);
                        screen.onSwitched();
                        break;

                    case 2:
                        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         = "";
                        }
                        break;
                    }
                }
            }
        }