예제 #1
0
        public OnlineSelection(Game game)
            : base(game)
        {
            if (AudioEngine.AudioState == AudioStates.Playing)
            {
                wasPlayingAudio = true;
                AudioEngine.TogglePause();
            }

            spriteManager   = new SpriteManager(true);
            resultsPane     = new pScrollableArea(new Rectangle(0, 82, GameBase.WindowManager.WidthScaled - 4 - OsuDirect.WIDTH, 350), Vector2.Zero, true);
            spriteManagerFg = new SpriteManager(true);

            searchInfo          = new pText("Type a search to begin.", 11, new Vector2(20, 40), 1, true, Color.YellowGreen);
            searchInfo.TextBold = true;
            spriteManager.Add(searchInfo);

            results = new pText("", 16, new Vector2(20, 80), 1, true, Color.White);
            spriteManager.Add(results);

            searchTextBox           = new pTextBoxOmniscient(18, new Vector2(20, 20), 300, false, 1.1f);
            searchTextBox.OnChange += delegate { nextSearchUpdate = GameBase.Time + 600; };
            spriteManagerFg.Add(searchTextBox.SpriteCollection);

            loadingText = new pSprite(TextureManager.Load(@"searching", SkinSource.Osu), new Vector2(320, 240), 1f, true,
                                      Color.TransparentWhite);
            loadingText.Origin = Origins.Centre;
            loadingText.UpdateTextureAlignment();

            GameBase.spriteManager.Add(loadingText);

            backButton = new BackButton(delegate { GameBase.ChangeMode(OsuModes.Menu); });
            spriteManagerFg.Add(backButton.SpriteCollection);

            int xPos = 330;

            pButton pb = new pButton("Newest Maps", new Vector2(xPos, 20), new Vector2(100, 20), 1, Color.Orange,
                                     delegate
            {
                lastSearch = "Newest";
                searchTextBox.SetToDefault();
                displayModeDropdown.SetSelected(0, false);
            });

            spriteManager.Add(pb.SpriteCollection);

            xPos += 105;

            pb = new pButton("Top Rated", new Vector2(xPos, 20), new Vector2(100, 20), 1, Color.OrangeRed,
                             delegate
            {
                lastSearch = "Top Rated";
                searchTextBox.SetToDefault();
                displayModeDropdown.SetSelected(0, false);
            });
            spriteManager.Add(pb.SpriteCollection);

            xPos += 105;

            pb = new pButton("Most Played", new Vector2(xPos, 20), new Vector2(100, 20), 1, Color.SkyBlue,
                             delegate
            {
                lastSearch = "Most Played";
                searchTextBox.SetToDefault();
                displayModeDropdown.SetSelected(0, false);
            });
            spriteManager.Add(pb.SpriteCollection);


            pText t = new pText("Display:", 11, new Vector2(5, 55), 1, true, Color.White);

            t.TextBold = true;
            spriteManager.Add(t);

            displayExisting = new pCheckbox("Show already downloaded maps", 0.88f, new Vector2(320, 54), 1, false);
            spriteManager.Add(displayExisting.SpriteCollection);

            displayExisting.OnCheckChanged += displayExisting_OnCheckChanged;

            displayModeDropdown = new pDropdown(spriteManagerFg, "", new Vector2(50, 54));
            displayModeDropdown.AddOption("All", 4);
            displayModeDropdown.AddOption("Ranked", 0);
            displayModeDropdown.AddOption("Ranked (Played)", 7);
            displayModeDropdown.AddOption("Qualified", 3);
            displayModeDropdown.AddOption("Pending/Help", 2);
            displayModeDropdown.AddOption("Graveyard", 5);

            displayModeDropdown.SetSelected(4, true);
            displayModeDropdown.OnSelect += pd_OnSelect;

            t          = new pText("Mode:", 11, new Vector2(180, 55), 1, true, Color.White);
            t.TextBold = true;
            spriteManager.Add(t);

            displayOsuModeDropdown = new pDropdown(spriteManagerFg, "", new Vector2(220, 54), 85, 1);
            displayOsuModeDropdown.AddOption(@"All", -1);
            displayOsuModeDropdown.AddOption(@"osu!", 0);
            displayOsuModeDropdown.AddOption(@"Taiko", 1);
            displayOsuModeDropdown.AddOption(@"Catch the Beat", 2);
            displayOsuModeDropdown.AddOption(@"osu!mania", 3);

            displayOsuModeDropdown.SetSelected(-1, true);
            displayOsuModeDropdown.OnSelect += mode_OnSelect;


            KeyboardHandler.OnKeyRepeat += KeyboardHandler_OnKeyRepeat;
        }