Пример #1
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Integrate with Yahoo! status display",
             Bindable = config.GetBindable<bool>(OsuConfig.YahooIntegration)
         },
         new CheckBoxOption
         {
             LabelText = "Integrate with MSN Live status display",
             Bindable = config.GetBindable<bool>(OsuConfig.MsnIntegration)
         },
         new CheckBoxOption
         {
             LabelText = "Automatically start osu!direct downloads",
             Bindable = config.GetBindable<bool>(OsuConfig.AutomaticDownload)
         },
         new CheckBoxOption
         {
             LabelText = "Prefer no-video downloads",
             Bindable = config.GetBindable<bool>(OsuConfig.AutomaticDownloadNoVideo)
         },
     };
 }
Пример #2
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new SpriteText { Text = "Resolution: TODO dropdown" },
         new CheckBoxOption
         {
             LabelText = "Fullscreen mode",
             Bindable = config.GetBindable<bool>(OsuConfig.Fullscreen),
         },
         new CheckBoxOption
         {
             LabelText = "Letterboxing",
             Bindable = config.GetBindable<bool>(OsuConfig.Letterboxing),
         },
         new SliderOption<int>
         {
             LabelText = "Horizontal position",
             Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionX)
         },
         new SliderOption<int>
         {
             LabelText = "Vertical position",
             Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionY)
         },
     };
 }
Пример #3
0
 private void load(OsuConfigManager config)
 {
     // NOTE: Compatability mode omitted
     Children = new Drawable[]
     {
         // TODO: this needs to be a custom dropdown at some point
         new DropdownOption<FrameSync>
         {
             LabelText = "Frame limiter",
             Bindable = config.GetBindable<FrameSync>(OsuConfig.FrameSync)
         },
         new CheckBoxOption
         {
             LabelText = "Show FPS counter",
             Bindable = config.GetBindable<bool>(OsuConfig.FpsCounter),
         },
         new CheckBoxOption
         {
             LabelText = "Reduce dropped frames",
             Bindable = config.GetBindable<bool>(OsuConfig.ForceFrameFlush),
         },
         new CheckBoxOption
         {
             LabelText = "Detect performance issues",
             Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
         },
     };
 }
Пример #4
0
 private void load(OsuConfigManager config)
 {
     Children = new[]
     {
         new CheckBoxOption
         {
             LabelText = "Snow",
             Bindable = config.GetBindable<bool>(OsuConfig.MenuSnow)
         },
         new CheckBoxOption
         {
             LabelText = "Parallax",
             Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax)
         },
         new CheckBoxOption
         {
             LabelText = "Menu tips",
             Bindable = config.GetBindable<bool>(OsuConfig.ShowMenuTips)
         },
         new CheckBoxOption
         {
             LabelText = "Interface voices",
             Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
         },
         new CheckBoxOption
         {
             LabelText = "osu! music theme",
             Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic)
         },
     };
 }
Пример #5
0
 private void load(OsuConfigManager config)
 {
     Children = new[]
     {
         new CheckBoxOption
         {
             LabelText = "Show thumbnails",
             Bindable = config.GetBindable<bool>(OsuConfig.SongSelectThumbnails)
         }
     };
 }
Пример #6
0
 private void load(OsuConfigManager config)
 {
     content.Spacing = new Vector2(0, 5);
     Children = new Drawable[]
     {
         new SpriteText { Text = "TODO: Skin preview textures" },
         new SpriteText { Text = "Current skin: TODO dropdown" },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Preview gameplay",
         },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Open skin folder",
         },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Export as .osk",
         },
         new CheckBoxOption
         {
             LabelText = "Ignore all beatmap skins",
             Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSkins)
         },
         new CheckBoxOption
         {
             LabelText = "Use skin's sound samples",
             Bindable = config.GetBindable<bool>(OsuConfig.SkinSamples)
         },
         new CheckBoxOption
         {
             LabelText = "Use Taiko skin for Taiko mode",
             Bindable = config.GetBindable<bool>(OsuConfig.UseTaikoSkin)
         },
         new CheckBoxOption
         {
             LabelText = "Always use skin cursor",
             Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
         },
         new SliderOption<double>
         {
             LabelText = "Cursor size",
             Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.CursorSize)
         },
         new CheckBoxOption
         {
             LabelText = "Automatic cursor size",
             Bindable = config.GetBindable<bool>(OsuConfig.AutomaticCursorSizing)
         },
     };
 }
Пример #7
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Snaking in sliders",
             Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
         },
         new CheckBoxOption
         {
             LabelText = "Snaking out sliders",
             Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders)
         },
         new CheckBoxOption
         {
             LabelText = "Background video",
             Bindable = config.GetBindable<bool>(OsuConfig.Video)
         },
         new CheckBoxOption
         {
             LabelText = "Storyboards",
             Bindable = config.GetBindable<bool>(OsuConfig.ShowStoryboard)
         },
         new CheckBoxOption
         {
             LabelText = "Combo bursts",
             Bindable = config.GetBindable<bool>(OsuConfig.ComboBurst)
         },
         new CheckBoxOption
         {
             LabelText = "Hit lighting",
             Bindable = config.GetBindable<bool>(OsuConfig.HitLighting)
         },
         new CheckBoxOption
         {
             LabelText = "Shaders",
             Bindable = config.GetBindable<bool>(OsuConfig.Bloom)
         },
         new CheckBoxOption
         {
             LabelText = "Softening filter",
             Bindable = config.GetBindable<bool>(OsuConfig.BloomSoftening)
         },
         new DropdownOption<ScreenshotFormat>
         {
             LabelText = "Screenshot",
             Bindable = config.GetBindable<ScreenshotFormat>(OsuConfig.ScreenshotFormat)
         }
     };
 }
Пример #8
0
 private void load(OsuConfigManager config, AudioManager audio)
 {
     Children = new Drawable[]
     {
         new SliderOption<double> { LabelText = "Master", Bindable = audio.Volume },
         new SliderOption<double> { LabelText = "Effect", Bindable = audio.VolumeSample },
         new SliderOption<double> { LabelText = "Music", Bindable = audio.VolumeTrack },
         new CheckBoxOption
         {
             LabelText = "Ignore beatmap hitsounds",
             Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples)
         }
     };
 }
Пример #9
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Share your city location with others",
             Bindable = config.GetBindable<bool>(OsuConfig.DisplayCityLocation)
         },
         new CheckBoxOption
         {
             LabelText = "Allow multiplayer game invites from all users",
             Bindable = config.GetBindable<bool>(OsuConfig.AllowPublicInvites)
         },
     };
 }
Пример #10
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new SliderOption<double>
         {
             LabelText = "Display beatmaps from",
             Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMinimum)
         },
         new SliderOption<double>
         {
             LabelText = "up to",
             Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMaximum)
         },
     };
 }
Пример #11
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "OS TabletPC support",
             Bindable = config.GetBindable<bool>(OsuConfig.Tablet)
         },
         new CheckBoxOption
         {
             LabelText = "Wiimote/TaTaCon Drum Support",
             Bindable = config.GetBindable<bool>(OsuConfig.Wiimote)
         },
     };
 }
Пример #12
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new SliderOption<int>
         {
             LabelText = "Universal Offset",
             Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.Offset)
         },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Offset wizard"
         }
     };
 }
Пример #13
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new SliderOption<int>
         {
             LabelText = "Background dim",
             Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel)
         },
         new DropdownOption<ProgressBarType>
         {
             LabelText = "Progress display",
             Bindable = config.GetBindable<ProgressBarType>(OsuConfig.ProgressBarType)
         },
         new DropdownOption<ScoreMeterType>
         {
             LabelText = "Score meter type",
             Bindable = config.GetBindable<ScoreMeterType>(OsuConfig.ScoreMeter)
         },
         new SliderOption<double>
         {
             LabelText = "Score meter size",
             Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)
         },
         new CheckBoxOption
         {
             LabelText = "Always show key overlay",
             Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
         },
         new CheckBoxOption
         {
             LabelText = "Show approach circle on first \"Hidden\" object",
             Bindable = config.GetBindable<bool>(OsuConfig.HiddenShowFirstApproach)
         },
         new CheckBoxOption
         {
             LabelText = "Scale osu!mania scroll speed with BPM",
             Bindable = config.GetBindable<bool>(OsuConfig.ManiaSpeedBPMScale)
         },
         new CheckBoxOption
         {
             LabelText = "Remember osu!mania scroll speed per beatmap",
             Bindable = config.GetBindable<bool>(OsuConfig.UsePerBeatmapManiaSpeed)
         },
     };
 }
Пример #14
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new SpriteText { Text = "TODO: Dropdown" },
         new CheckBoxOption
         {
             LabelText = "Prefer metadata in original language",
             Bindable = config.GetBindable<bool>(OsuConfig.ShowUnicode)
         },
         new CheckBoxOption
         {
             LabelText = "Use alternative font for chat display",
             Bindable = config.GetBindable<bool>(OsuConfig.AlternativeChatFont)
         },
     };
 }
Пример #15
0
 private void load(BasicStorage storage, OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new DropdownOption<ReleaseStream>
         {
             LabelText = "Release stream",
             Bindable = config.GetBindable<ReleaseStream>(OsuConfig.ReleaseStream),
         },
         new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Open osu! folder",
             Action = () => storage.OpenInNativeExplorer(),
         }
     };
 }
Пример #16
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new SliderOption<double>
         {
             LabelText = "Sensitivity",
             Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed),
         },
         new CheckBoxOption
         {
             LabelText = "Raw input",
             Bindable = config.GetBindable<bool>(OsuConfig.RawInput)
         },
         new CheckBoxOption
         {
             LabelText = "Map absolute raw input to the osu! window",
             Bindable = config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow)
         },
         new DropdownOption<ConfineMouseMode>
         {
             LabelText = "Confine mouse cursor",
             Bindable = config.GetBindable<ConfineMouseMode>(OsuConfig.ConfineMouse),
         },
         new CheckBoxOption
         {
             LabelText = "Disable mouse wheel in play mode",
             Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableWheel)
         },
         new CheckBoxOption
         {
             LabelText = "Disable mouse buttons in play mode",
             Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableButtons)
         },
         new CheckBoxOption
         {
             LabelText = "Cursor ripples",
             Bindable = config.GetBindable<bool>(OsuConfig.CursorRipple)
         },
     };
 }
Пример #17
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Filter offensive words",
             Bindable = config.GetBindable<bool>(OsuConfig.ChatFilter)
         },
         new CheckBoxOption
         {
             LabelText = "Filter foreign characters",
             Bindable = config.GetBindable<bool>(OsuConfig.ChatRemoveForeign)
         },
         new CheckBoxOption
         {
             LabelText = "Log private messages",
             Bindable = config.GetBindable<bool>(OsuConfig.LogPrivateMessages)
         },
         new CheckBoxOption
         {
             LabelText = "Block private messages from non-friends",
             Bindable = config.GetBindable<bool>(OsuConfig.BlockNonFriendPM)
         },
         new SpriteText { Text = "Chat ignore list (space-seperated list)" },
         chatIgnoreList = new TextBoxOption {
             Height = 20,
             RelativeSizeAxes = Axes.X,
             Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
         },
         new SpriteText { Text = "Chat highlight words (space-seperated list)" },
         chatHighlightWords = new TextBoxOption {
             Height = 20,
             RelativeSizeAxes = Axes.X,
             Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
         },
     };
 }
Пример #18
0
 private void load(OsuConfigManager config)
 {
     content.Spacing = new Vector2(0, 5);
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Background video",
             Bindable = config.GetBindable<bool>(OsuConfig.VideoEditor)
         },
         new CheckBoxOption
         {
             LabelText = "Always use default skin",
             Bindable = config.GetBindable<bool>(OsuConfig.EditorDefaultSkin)
         },
         new CheckBoxOption
         {
             LabelText = "Snaking sliders",
             Bindable = config.GetBindable<bool>(OsuConfig.EditorSnakingSliders)
         },
         new CheckBoxOption
         {
             LabelText = "Hit animations",
             Bindable = config.GetBindable<bool>(OsuConfig.EditorHitAnimations)
         },
         new CheckBoxOption
         {
             LabelText = "Follow points",
             Bindable = config.GetBindable<bool>(OsuConfig.EditorFollowPoints)
         },
         new CheckBoxOption
         {
             LabelText = "Stacking",
             Bindable = config.GetBindable<bool>(OsuConfig.EditorStacking)
         },
     };
 }
Пример #19
0
 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Enable chat ticker",
             Bindable = config.GetBindable<bool>(OsuConfig.Ticker)
         },
         new CheckBoxOption
         {
             LabelText = "Show a notification popup when someone says your name",
             Bindable = config.GetBindable<bool>(OsuConfig.ChatHighlightName)
         },
         new CheckBoxOption
         {
             LabelText = "Show chat message notifications",
             Bindable = config.GetBindable<bool>(OsuConfig.ChatMessageNotification)
         },
         new CheckBoxOption
         {
             LabelText = "Play a sound when someone says your name",
             Bindable = config.GetBindable<bool>(OsuConfig.ChatAudibleHighlight)
         },
         new CheckBoxOption
         {
             LabelText = "Show notification popups instantly during gameplay",
             Bindable = config.GetBindable<bool>(OsuConfig.PopupDuringGameplay)
         },
         new CheckBoxOption
         {
             LabelText = "Show notification popups when friends change status",
             Bindable = config.GetBindable<bool>(OsuConfig.NotifyFriends)
         },
     };
 }
Пример #20
0
 public void ReadFromConfig(OsuConfigManager config)
 {
     increaseFirstObjectVisibility = config.GetBindable <bool>(OsuSetting.IncreaseFirstObjectVisibility);
 }
Пример #21
0
        private void load(OsuConfigManager config, AccountCreationOverlay accountCreation)
        {
            Direction        = FillDirection.Vertical;
            Spacing          = new Vector2(0, 5);
            AutoSizeAxes     = Axes.Y;
            RelativeSizeAxes = Axes.X;
            Children         = new Drawable[]
            {
                username = new OsuTextBox
                {
                    PlaceholderText          = "username",
                    RelativeSizeAxes         = Axes.X,
                    Text                     = api?.ProvidedUsername ?? string.Empty,
                    TabbableContentContainer = this
                },
                password = new OsuPasswordTextBox
                {
                    PlaceholderText          = "password",
                    RelativeSizeAxes         = Axes.X,
                    TabbableContentContainer = this,
                },
                new SettingsCheckbox
                {
                    LabelText = "Remember username",
                    Current   = config.GetBindable <bool>(OsuSetting.SaveUsername),
                },
                new SettingsCheckbox
                {
                    LabelText = "Stay signed in",
                    Current   = config.GetBindable <bool>(OsuSetting.SavePassword),
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        shakeSignIn = new ShakeContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Child            = new SettingsButton
                            {
                                Text   = "Sign in",
                                Action = performLogin
                            },
                        }
                    }
                },
                new SettingsButton
                {
                    Text   = "Register",
                    Action = () =>
                    {
                        RequestHide();
                        accountCreation.Show();
                    }
                }
            };

            password.OnCommit += (sender, newText) => performLogin();
        }
Пример #22
0
 private void load(APIAccess api, OsuConfigManager config)
 {
     api.Register(this);
 }
 private void load()
 {
     Dependencies.Cache(localConfig = new OsuConfigManager(LocalStorage));
 }
Пример #24
0
        private void load(AudioManager audio, OsuConfigManager config)
        {
            Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray();

            if (Beatmap.Value is DummyWorkingBeatmap)
            {
                return;
            }

            IBeatmap playableBeatmap = loadPlayableBeatmap();

            if (playableBeatmap == null)
            {
                return;
            }

            sampleRestart = audio.Samples.Get(@"Gameplay/restart");

            mouseWheelDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableWheel);

            DrawableRuleset = ruleset.CreateDrawableRulesetWith(playableBeatmap, Mods.Value);

            ScoreProcessor = ruleset.CreateScoreProcessor();
            ScoreProcessor.ApplyBeatmap(playableBeatmap);
            ScoreProcessor.Mods.BindTo(Mods);

            HealthProcessor = ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
            HealthProcessor.ApplyBeatmap(playableBeatmap);

            if (!ScoreProcessor.Mode.Disabled)
            {
                config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
            }

            InternalChild = GameplayClockContainer = new GameplayClockContainer(Beatmap.Value, Mods.Value, DrawableRuleset.GameplayStartTime);

            AddInternal(gameplayBeatmap = new GameplayBeatmap(playableBeatmap));

            dependencies.CacheAs(gameplayBeatmap);

            addUnderlayComponents(GameplayClockContainer);
            addGameplayComponents(GameplayClockContainer, Beatmap.Value);
            addOverlayComponents(GameplayClockContainer, Beatmap.Value);

            DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);

            // bind clock into components that require it
            DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);

            DrawableRuleset.OnNewResult += r =>
            {
                HealthProcessor.ApplyResult(r);
                ScoreProcessor.ApplyResult(r);
            };

            DrawableRuleset.OnRevertResult += r =>
            {
                HealthProcessor.RevertResult(r);
                ScoreProcessor.RevertResult(r);
            };

            // Bind the judgement processors to ourselves
            ScoreProcessor.AllJudged += onCompletion;
            HealthProcessor.Failed   += onFail;

            foreach (var mod in Mods.Value.OfType <IApplicableToScoreProcessor>())
            {
                mod.ApplyToScoreProcessor(ScoreProcessor);
            }

            foreach (var mod in Mods.Value.OfType <IApplicableToHealthProcessor>())
            {
                mod.ApplyToHealthProcessor(HealthProcessor);
            }

            BreakOverlay.IsBreakTime.ValueChanged += _ => updatePauseOnFocusLostState();
        }
Пример #25
0
        private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config)
        {
            this.api = api;

            Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray();

            WorkingBeatmap working = loadBeatmap();

            if (working == null)
            {
                return;
            }

            sampleRestart = audio.Samples.Get(@"Gameplay/restart");

            mouseWheelDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableWheel);
            showStoryboard     = config.GetBindable <bool>(OsuSetting.ShowStoryboard);

            ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
            ScoreProcessor.Mods.BindTo(Mods);

            if (!ScoreProcessor.Mode.Disabled)
            {
                config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
            }

            InternalChild = GameplayClockContainer = new GameplayClockContainer(working, Mods.Value, DrawableRuleset.GameplayStartTime);

            GameplayClockContainer.Children = new[]
            {
                StoryboardContainer = CreateStoryboardContainer(),
                new ScalingContainer(ScalingMode.Gameplay)
                {
                    Child = new LocalSkinOverrideContainer(working.Skin)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = DrawableRuleset
                    }
                },
                new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Breaks = working.Beatmap.Breaks
                },
                // display the cursor above some HUD elements.
                DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
                HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, Mods.Value)
                {
                    HoldToQuit =
                    {
                        Action   = performUserRequestedExit,
                        IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
                    },
                    PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
                    KeyCounter            = { Visible = { BindTarget = DrawableRuleset.HasReplayLoaded } },
                    RequestSeek           = GameplayClockContainer.Seek,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre
                },
                new SkipOverlay(DrawableRuleset.GameplayStartTime)
                {
                    RequestSeek = GameplayClockContainer.Seek
                },
                FailOverlay = new FailOverlay
                {
                    OnRetry = Restart,
                    OnQuit  = performUserRequestedExit,
                },
                PauseOverlay = new PauseOverlay
                {
                    OnResume = Resume,
                    Retries  = RestartCount,
                    OnRetry  = Restart,
                    OnQuit   = performUserRequestedExit,
                },
                new HotkeyRetryOverlay
                {
                    Action = () =>
                    {
                        if (!this.IsCurrentScreen())
                        {
                            return;
                        }

                        fadeOut(true);
                        Restart();
                    },
                },
                new HotkeyExitOverlay
                {
                    Action = () =>
                    {
                        if (!this.IsCurrentScreen())
                        {
                            return;
                        }

                        fadeOut(true);
                        performImmediateExit();
                    },
                },
                failAnimation = new FailAnimation(DrawableRuleset)
                {
                    OnComplete = onFailComplete,
                }
            };

            DrawableRuleset.HasReplayLoaded.BindValueChanged(e => HUDOverlay.HoldToQuit.PauseOnFocusLost = !e.NewValue && PauseOnFocusLost, true);

            // bind clock into components that require it
            DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);

            // load storyboard as part of player's load if we can
            initializeStoryboard(false);

            // Bind ScoreProcessor to ourselves
            ScoreProcessor.AllJudged += onCompletion;
            ScoreProcessor.Failed    += onFail;

            foreach (var mod in Mods.Value.OfType <IApplicableToScoreProcessor>())
            {
                mod.ApplyToScoreProcessor(ScoreProcessor);
            }
        }
Пример #26
0
 private void load(OsuConfigManager config)
 {
     config.BindWith(OsuSetting.DimLevel, DimLevel);
     config.BindWith(OsuSetting.BlurLevel, BlurLevel);
 }
Пример #27
0
        private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
        {
            Mods.Value = base.Mods.Value.Select(m => m.CreateCopy()).ToArray();

            if (Beatmap.Value is DummyWorkingBeatmap)
            {
                return;
            }

            IBeatmap playableBeatmap = loadPlayableBeatmap();

            if (playableBeatmap == null)
            {
                return;
            }

            sampleRestart = audio.Samples.Get(@"Gameplay/restart");

            mouseWheelDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableWheel);

            if (game != null)
            {
                gameActive.BindTo(game.IsActive);
            }

            if (game is OsuGame osuGame)
            {
                LocalUserPlaying.BindTo(osuGame.LocalUserPlaying);
            }

            DrawableRuleset = ruleset.CreateDrawableRulesetWith(playableBeatmap, Mods.Value);

            ScoreProcessor = ruleset.CreateScoreProcessor();
            ScoreProcessor.ApplyBeatmap(playableBeatmap);
            ScoreProcessor.Mods.BindTo(Mods);

            HealthProcessor = ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
            HealthProcessor.ApplyBeatmap(playableBeatmap);

            if (!ScoreProcessor.Mode.Disabled)
            {
                config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
            }

            InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);

            AddInternal(gameplayBeatmap  = new GameplayBeatmap(playableBeatmap));
            AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));

            dependencies.CacheAs(gameplayBeatmap);

            var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);

            // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
            // full access to all skin sources.
            var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider, playableBeatmap));

            // load the skinning hierarchy first.
            // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
            GameplayClockContainer.Add(beatmapSkinProvider.WithChild(rulesetSkinProvider));

            rulesetSkinProvider.AddRange(new[]
            {
                // underlay and gameplay should have access the to skinning sources.
                createUnderlayComponents(),
                createGameplayComponents(Beatmap.Value, playableBeatmap)
            });

            // also give the HUD a ruleset container to allow rulesets to potentially override HUD elements (used to disable combo counters etc.)
            // we may want to limit this in the future to disallow rulesets from outright replacing elements the user expects to be there.
            var hudRulesetContainer = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider, playableBeatmap));

            // add the overlay components as a separate step as they proxy some elements from the above underlay/gameplay components.
            GameplayClockContainer.Add(hudRulesetContainer.WithChild(createOverlayComponents(Beatmap.Value)));

            if (!DrawableRuleset.AllowGameplayOverlays)
            {
                HUDOverlay.ShowHud.Value    = false;
                HUDOverlay.ShowHud.Disabled = true;
                BreakOverlay.Hide();
                skipOverlay.Hide();
            }

            DrawableRuleset.FrameStableClock.WaitingOnFrames.BindValueChanged(waiting =>
            {
                if (waiting.NewValue)
                {
                    GameplayClockContainer.Stop();
                }
                else
                {
                    GameplayClockContainer.Start();
                }
            });

            DrawableRuleset.IsPaused.BindValueChanged(paused =>
            {
                updateGameplayState();
                updateSampleDisabledState();
            });

            DrawableRuleset.FrameStableClock.IsCatchingUp.BindValueChanged(_ => updateSampleDisabledState());

            DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateGameplayState());

            // bind clock into components that require it
            DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);

            DrawableRuleset.NewResult += r =>
            {
                HealthProcessor.ApplyResult(r);
                ScoreProcessor.ApplyResult(r);
                gameplayBeatmap.ApplyResult(r);
            };

            DrawableRuleset.RevertResult += r =>
            {
                HealthProcessor.RevertResult(r);
                ScoreProcessor.RevertResult(r);
            };

            // Bind the judgement processors to ourselves
            ScoreProcessor.HasCompleted.ValueChanged += updateCompletionState;
            HealthProcessor.Failed += onFail;

            foreach (var mod in Mods.Value.OfType <IApplicableToScoreProcessor>())
            {
                mod.ApplyToScoreProcessor(ScoreProcessor);
            }

            foreach (var mod in Mods.Value.OfType <IApplicableToHealthProcessor>())
            {
                mod.ApplyToHealthProcessor(HealthProcessor);
            }

            IsBreakTime.BindTo(breakTracker.IsBreakTime);
            IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
        }
Пример #28
0
 private void load(OsuGameBase game, OsuConfigManager config)
 {
     showDisclaimer = game.IsDeployedBuild;
     introSequence  = config.Get <IntroSequence>(OsuSetting.IntroSequence);
 }
Пример #29
0
        private void load(OsuGameBase osuGame, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours)
        {
            game = osuGame;

            unicodeString = config.GetUnicodeString;

            Children = new Drawable[]
            {
                dragContainer = new Container
                {
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Masking      = true,
                    CornerRadius = 5,
                    EdgeEffect   = new EdgeEffect
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        title = new OsuSpriteText
                        {
                            Origin   = Anchor.BottomCentre,
                            Anchor   = Anchor.TopCentre,
                            Position = new Vector2(0, 40),
                            TextSize = 25,
                            Colour   = Color4.White,
                            Text     = @"Nothing to play",
                            Font     = @"Exo2.0-MediumItalic"
                        },
                        artist = new OsuSpriteText
                        {
                            Origin   = Anchor.TopCentre,
                            Anchor   = Anchor.TopCentre,
                            Position = new Vector2(0, 45),
                            TextSize = 15,
                            Colour   = Color4.White,
                            Text     = @"Nothing to play",
                            Font     = @"Exo2.0-BoldItalic"
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomCentre,
                            Position     = new Vector2(0, -30),
                            Action       = () =>
                            {
                                if (current?.Track == null)
                                {
                                    return;
                                }
                                if (current.Track.IsRunning)
                                {
                                    current.Track.Stop();
                                }
                                else
                                {
                                    current.Track.Start();
                                }
                            },
                            Children = new Drawable[]
                            {
                                playButton = new TextAwesome
                                {
                                    TextSize = 30,
                                    Icon     = FontAwesome.fa_play_circle_o,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomCentre,
                            Position     = new Vector2(-30, -30),
                            Action       = prev,
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 15,
                                    Icon     = FontAwesome.fa_step_backward,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomCentre,
                            Position     = new Vector2(30, -30),
                            Action       = next,
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 15,
                                    Icon     = FontAwesome.fa_step_forward,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomRight,
                            Position     = new Vector2(20, -30),
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 15,
                                    Icon     = FontAwesome.fa_bars,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        progress = new DragBar
                        {
                            Origin        = Anchor.BottomCentre,
                            Anchor        = Anchor.BottomCentre,
                            Height        = 10,
                            Colour        = colours.Yellow,
                            SeekRequested = seek
                        }
                    }
                }
            };

            this.beatmaps = beatmaps;
            trackManager  = osuGame.Audio.Track;
            preferUnicode = config.GetBindable <bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += preferUnicode_changed;

            beatmapSource = osuGame.Beatmap ?? new Bindable <WorkingBeatmap>();
            playList      = beatmaps.GetAllWithChildren <BeatmapSetInfo>();

            backgroundSprite = new MusicControllerBackground();
            dragContainer.Add(backgroundSprite);
        }
Пример #30
0
        public ScoreManager(RulesetStore rulesets, Func <BeatmapManager> beatmaps, Storage storage, IDatabaseContextFactory contextFactory, Scheduler scheduler,
                            IIpcHost importHost = null, Func <BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null)
        {
            this.scheduler     = scheduler;
            this.difficulties  = difficulties;
            this.configManager = configManager;

            scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, contextFactory, importHost);
        }
Пример #31
0
 private void load(OsuConfigManager config)
 {
     mouseDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableButtons);
 }
Пример #32
0
        private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host)
        {
            notificationOverlay = notification;
            this.config         = config;
            this.game           = game;
            this.host           = host;

            AutoSizeAxes = Axes.Both;
            Anchor       = Anchor.BottomCentre;
            Origin       = Anchor.BottomCentre;

            Alpha = 0;

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Children     = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Spacing      = new Vector2(5),
                            Anchor       = Anchor.TopCentre,
                            Origin       = Anchor.TopCentre,
                            Children     = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Font = OsuFont.GetFont(weight: FontWeight.Bold),
                                    Text = game.Name
                                },
                                new OsuSpriteText
                                {
                                    Colour = DebugUtils.IsDebug ? colours.Red : Color4.White,
                                    Text   = game.Version
                                },
                            }
                        },
                        new OsuSpriteText
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Font   = OsuFont.Numeric.With(size: 12),
                            Colour = colours.Yellow,
                            Text   = @"Development Build"
                        },
                        new Sprite
                        {
                            Anchor  = Anchor.TopCentre,
                            Origin  = Anchor.TopCentre,
                            Texture = textures.Get(@"Menu/dev-build-footer"),
                        },
                    }
                }
            };
        }
Пример #33
0
        private void load(OsuConfigManager config)
        {
            snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
            snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);

            int textureWidth = (int)PathWidth * 2;

            //initialise background
            var upload = new TextureUpload(textureWidth * 4);
            var bytes = upload.Data;

            const float aa_portion = 0.02f;
            const float border_portion = 0.18f;
            const float gradient_portion = 1 - border_portion;

            const float opacity_at_centre = 0.3f;
            const float opacity_at_edge = 0.8f;

            for (int i = 0; i < textureWidth; i++)
            {
                float progress = (float)i / (textureWidth - 1);

                if (progress <= border_portion)
                {
                    bytes[i * 4] = 255;
                    bytes[i * 4 + 1] = 255;
                    bytes[i * 4 + 2] = 255;
                    bytes[i * 4 + 3] = (byte)(Math.Min(progress / aa_portion, 1) * 255);
                }
                else
                {
                    progress -= border_portion;

                    bytes[i * 4] = (byte)(slider.Colour.R * 255);
                    bytes[i * 4 + 1] = (byte)(slider.Colour.G * 255);
                    bytes[i * 4 + 2] = (byte)(slider.Colour.B * 255);
                    bytes[i * 4 + 3] = (byte)((opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * (slider.Colour.A * 255));
                }
            }

            var texture = new Texture(textureWidth, 1);
            texture.SetData(upload);
            path.Texture = texture;
        }
Пример #34
0
 private void load(OsuColour colours, OsuConfigManager config)
 {
     AccentColour = colours.BlueLighter;
     overlayDim.BindTo(config.GetBindable <double>(OsuSetting.OverlayDim));
     DisplayedCountSpriteText.Alpha = 1 - (float)overlayDim.Value;
 }
Пример #35
0
 private void load(OsuConfigManager config)
 {
     ShortcutText.Text = config.LookupKeyBindings(action).ToUpper();
 }
Пример #36
0
        private void load(OsuConfigManager config, OsuColour colours, TextureStore textures)
        {
            const float padding = 5;

            Children = new Drawable[]
            {
                channelSelectionContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Height           = 1f - DEFAULT_HEIGHT,
                    Masking          = true,
                    Children         = new[]
                    {
                        ChannelSelectionOverlay = new ChannelSelectionOverlay
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                chatContainer = new Container
                {
                    Name             = @"chat container",
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                    Height           = DEFAULT_HEIGHT,
                    Children         = new[]
                    {
                        new Container
                        {
                            Name             = @"chat area",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = TAB_AREA_HEIGHT
                            },
                            Children = new Drawable[]
                            {
                                chatBackground = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new OnlineViewContainer("Sign in to chat")
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new Drawable[]
                                    {
                                        currentChannelContainer = new Container <DrawableChannel>
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding
                                            {
                                                Bottom = textbox_height
                                            },
                                        },
                                        new Container
                                        {
                                            Anchor           = Anchor.BottomLeft,
                                            Origin           = Anchor.BottomLeft,
                                            RelativeSizeAxes = Axes.X,
                                            Height           = textbox_height,
                                            Padding          = new MarginPadding
                                            {
                                                Top    = padding * 2,
                                                Bottom = padding * 2,
                                                Left   = ChatLine.LEFT_PADDING + padding * 2,
                                                Right  = padding * 2,
                                            },
                                            Children = new Drawable[]
                                            {
                                                textbox = new FocusedTextBox
                                                {
                                                    RelativeSizeAxes     = Axes.Both,
                                                    Height               = 1,
                                                    PlaceholderText      = "type your message",
                                                    ReleaseFocusOnCommit = false,
                                                    HoldFocus            = true,
                                                }
                                            }
                                        },
                                        loading = new LoadingSpinner(),
                                    },
                                }
                            }
                        },
                        tabsArea = new TabsArea
                        {
                            Children = new Drawable[]
                            {
                                tabBackground = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                },
                                new Sprite
                                {
                                    Texture = textures.Get(IconTexture),
                                    Anchor  = Anchor.CentreLeft,
                                    Origin  = Anchor.CentreLeft,
                                    Size    = new Vector2(OverlayTitle.ICON_SIZE),
                                    Margin  = new MarginPadding {
                                        Left = 10
                                    },
                                },
                                ChannelTabControl = CreateChannelTabControl().With(d =>
                                {
                                    d.Anchor           = Anchor.BottomLeft;
                                    d.Origin           = Anchor.BottomLeft;
                                    d.RelativeSizeAxes = Axes.Both;
                                    d.OnRequestLeave   = channelManager.LeaveChannel;
                                    d.IsSwitchable     = true;
                                }),
                            }
                        },
                    },
                },
            };

            textbox.OnCommit += postMessage;

            ChannelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
            ChannelTabControl.ChannelSelectorActive.ValueChanged += active => ChannelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
            ChannelSelectionOverlay.State.ValueChanged           += state =>
            {
                // Propagate the visibility state to ChannelSelectorActive
                ChannelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible;

                if (state.NewValue == Visibility.Visible)
                {
                    textbox.HoldFocus = false;
                    if (1f - ChatHeight.Value < channel_selection_min_height)
                    {
                        this.TransformBindableTo(ChatHeight, 1f - channel_selection_min_height, 800, Easing.OutQuint);
                    }
                }
                else
                {
                    textbox.HoldFocus = true;
                }
            };

            ChannelSelectionOverlay.OnRequestJoin  = channel => channelManager.JoinChannel(channel);
            ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;

            ChatHeight = config.GetBindable <float>(OsuSetting.ChatDisplayHeight);
            ChatHeight.BindValueChanged(height =>
            {
                chatContainer.Height             = height.NewValue;
                channelSelectionContainer.Height = 1f - height.NewValue;
                tabBackground.FadeTo(height.NewValue == 1f ? 1f : 0.8f, 200);
            }, true);

            chatBackground.Colour = colours.ChatBlue;

            loading.Show();

            // This is a relatively expensive (and blocking) operation.
            // Scheduling it ensures that it won't be performed unless the user decides to open chat.
            // TODO: Refactor OsuFocusedOverlayContainer / OverlayContainer to support delayed content loading.
            Schedule(() =>
            {
                // TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
                channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;

                foreach (Channel channel in channelManager.JoinedChannels)
                {
                    ChannelTabControl.AddChannel(channel);
                }

                channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
                availableChannelsChanged(null, null);

                currentChannel = channelManager.CurrentChannel.GetBoundCopy();
                currentChannel.BindValueChanged(currentChannelChanged, true);
            });
        }
Пример #37
0
 private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuConfig)
 {
     BeginTracking(this, frameworkConfig);
     BeginTracking(this, osuConfig);
 }
Пример #38
0
        private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config)
        {
            var beatmap = Beatmap.Beatmap;

            if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu)
            {
                //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
                Exit();
                return;
            }

            dimLevel           = config.GetBindable <int>(OsuConfig.DimLevel);
            mouseWheelDisabled = config.GetBindable <bool>(OsuConfig.MouseDisableWheel);

            try
            {
                if (Beatmap == null)
                {
                    Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
                }

                if ((Beatmap?.Beatmap?.HitObjects.Count ?? 0) == 0)
                {
                    throw new Exception("No valid objects were found!");
                }

                if (Beatmap == null)
                {
                    throw new Exception("Beatmap was not loaded");
                }
            }
            catch (Exception e)
            {
                Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error);

                //couldn't load, hard abort!
                Exit();
                return;
            }

            Track track = Beatmap.Track;

            if (track != null)
            {
                audio.Track.SetExclusive(track);
                sourceClock = track;
            }

            sourceClock             = (IAdjustableClock)track ?? new StopwatchClock();
            interpolatedSourceClock = new InterpolatingFramedClock(sourceClock);

            Schedule(() =>
            {
                sourceClock.Reset();
            });

            ruleset     = Ruleset.GetRuleset(Beatmap.PlayMode);
            hitRenderer = ruleset.CreateHitRendererWith(Beatmap);

            scoreProcessor = hitRenderer.CreateScoreProcessor();

            hudOverlay = new StandardHudOverlay();
            hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
            hudOverlay.BindProcessor(scoreProcessor);

            pauseOverlay = new PauseOverlay
            {
                Depth    = -1,
                OnResume = delegate
                {
                    Delay(400);
                    Schedule(Resume);
                },
                OnRetry = Restart,
                OnQuit  = Exit
            };


            if (ReplayInputHandler != null)
            {
                hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler;
            }

            hudOverlay.BindHitRenderer(hitRenderer);

            //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
            hitRenderer.OnAllJudged += onCompletion;

            //bind ScoreProcessor to ourselves (for a fail situation)
            scoreProcessor.Failed += onFail;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Clock            = interpolatedSourceClock,
                    Children         = new Drawable[]
                    {
                        hitRenderer,
                        skipButton = new SkipButton
                        {
                            Alpha = 0
                        },
                    }
                },
                hudOverlay,
                pauseOverlay
            };
        }
Пример #39
0
        private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings, RankingsOverlay rankings, OsuConfigManager config, SessionStatics statics)
        {
            holdDelay      = config.GetBindable <float>(OsuSetting.UIHoldActivationDelay);
            loginDisplayed = statics.GetBindable <bool>(Static.LoginOverlayDisplayed);

            if (host.CanExit)
            {
                AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
                {
                    Action = () =>
                    {
                        if (holdDelay.Value > 0)
                        {
                            confirmAndExit();
                        }
                        else
                        {
                            this.Exit();
                        }
                    }
                });
            }

            AddRangeInternal(new[]
            {
                buttonsContainer = new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children       = new Drawable[]
                    {
                        buttons = new ButtonSystem
                        {
                            OnEdit = delegate
                            {
                                Beatmap.SetDefault();
                                this.Push(new Editor());
                            },
                            OnSolo        = onSolo,
                            OnMultiplayer = () => this.Push(new Multiplayer()),
                            OnPlaylists   = () => this.Push(new Playlists()),
                            OnExit        = confirmAndExit,
                        }
                    }
                },
                sideFlashes = new MenuSideFlashes(),
                songTicker  = new SongTicker
                {
                    Anchor = Anchor.TopRight,
                    Origin = Anchor.TopRight,
                    Margin = new MarginPadding {
                        Right = 15, Top = 5
                    }
                },
                exitConfirmOverlay?.CreateProxy() ?? Drawable.Empty()
            });

            buttons.StateChanged += state =>
            {
                switch (state)
                {
                case ButtonSystemState.Initial:
                case ButtonSystemState.Exit:
                    ApplyToBackground(b => b.FadeColour(Color4.White, 500, Easing.OutSine));
                    break;

                default:
                    ApplyToBackground(b => b.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine));
                    break;
                }
            };

            buttons.OnSettings       = () => settings?.ToggleVisibility();
            buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility();

            LoadComponentAsync(background = new BackgroundScreenDefault());
            preloadSongSelect();
        }
Пример #40
0
 private void load(OsuConfigManager config)
 {
     mouseDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableButtons)
         ?? new Bindable<bool>(false);
 }
Пример #41
0
        private void load(BeatmapDatabase database, OsuConfigManager config)
        {
            this.database = database;

            randomType = config.GetBindable <SelectionRandomType>(OsuSetting.SelectionRandomType);
        }
Пример #42
0
        private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config)
        {
            holdDelay = config.GetBindable <int>(OsuSetting.UIHoldActivationDelay);

            if (host.CanExit)
            {
                AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
                {
                    Action = () =>
                    {
                        if (holdDelay.Value > 0)
                        {
                            confirmAndExit();
                        }
                        else
                        {
                            this.Exit();
                        }
                    }
                });
            }

            AddRangeInternal(new Drawable[]
            {
                new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children       = new Drawable[]
                    {
                        buttons = new ButtonSystem
                        {
                            OnChart = delegate { this.Push(new ChartListing()); },
                            OnEdit  = delegate { this.Push(new Editor()); },
                            OnSolo  = onSolo,
                            OnMulti = delegate { this.Push(new Multiplayer()); },
                            OnExit  = confirmAndExit,
                        }
                    }
                },
                sideFlashes = new MenuSideFlashes(),
            });

            buttons.StateChanged += state =>
            {
                switch (state)
                {
                case ButtonSystemState.Initial:
                case ButtonSystemState.Exit:
                    Background.FadeColour(Color4.White, 500, Easing.OutSine);
                    break;

                default:
                    Background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine);
                    break;
                }
            };

            buttons.OnSettings = () => settings?.ToggleVisibility();
            buttons.OnDirect   = () => direct?.ToggleVisibility();

            LoadComponentAsync(background = new BackgroundScreenDefault());
            preloadSongSelect();
        }
 private void load(OsuConfigManager config)
 {
     externalLinkWarning = config.GetBindable <bool>(OsuSetting.ExternalLinkWarning);
 }
Пример #44
0
        private void load(OsuConfigManager config)
        {
            Children = new Drawable[]
            {
                new SettingsSlider <double>
                {
                    LabelText           = "Background dim",
                    Current             = config.GetBindable <double>(OsuSetting.DimLevel),
                    KeyboardStep        = 0.01f,
                    DisplayAsPercentage = true
                },
                new SettingsSlider <double>
                {
                    LabelText           = "Background blur",
                    Current             = config.GetBindable <double>(OsuSetting.BlurLevel),
                    KeyboardStep        = 0.01f,
                    DisplayAsPercentage = true
                },
                new SettingsCheckbox
                {
                    LabelText = "Lighten playfield during breaks",
                    Current   = config.GetBindable <bool>(OsuSetting.LightenDuringBreaks)
                },
                new SettingsEnumDropdown <HUDVisibilityMode>
                {
                    LabelText = "HUD overlay visibility mode",
                    Current   = config.GetBindable <HUDVisibilityMode>(OsuSetting.HUDVisibilityMode)
                },
                new SettingsCheckbox
                {
                    LabelText = "Show difficulty graph on progress bar",
                    Current   = config.GetBindable <bool>(OsuSetting.ShowProgressGraph)
                },
                new SettingsCheckbox
                {
                    LabelText = "Show health display even when you can't fail",
                    Current   = config.GetBindable <bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
                    Keywords  = new[] { "hp", "bar" }
                },
                new SettingsCheckbox
                {
                    LabelText = "Fade playfield to red when health is low",
                    Current   = config.GetBindable <bool>(OsuSetting.FadePlayfieldWhenHealthLow),
                },
                new SettingsCheckbox
                {
                    LabelText = "Always show key overlay",
                    Current   = config.GetBindable <bool>(OsuSetting.KeyOverlay)
                },
                new SettingsCheckbox
                {
                    LabelText = "Positional hitsounds",
                    Current   = config.GetBindable <bool>(OsuSetting.PositionalHitSounds)
                },
                new SettingsEnumDropdown <ScoreMeterType>
                {
                    LabelText = "Score meter type",
                    Current   = config.GetBindable <ScoreMeterType>(OsuSetting.ScoreMeter)
                },
                new SettingsEnumDropdown <ScoringMode>
                {
                    LabelText = "Score display mode",
                    Current   = config.GetBindable <ScoringMode>(OsuSetting.ScoreDisplayMode),
                    Keywords  = new[] { "scoring" }
                },
            };

            if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
            {
                Add(new SettingsCheckbox
                {
                    LabelText = "Disable Windows key during gameplay",
                    Current   = config.GetBindable <bool>(OsuSetting.GameplayDisableWinKey)
                });
            }
        }
Пример #45
0
        private void load(OsuColour colours, IBindable <RulesetInfo> parentRuleset, OsuConfigManager config)
        {
            sortMode  = config.GetBindable <SortMode>(OsuSetting.SongSelectSortingMode);
            groupMode = config.GetBindable <GroupMode>(OsuSetting.SongSelectGroupingMode);

            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = Colour4.Black,
                    Alpha            = 0.8f,
                    Width            = 2,
                    RelativeSizeAxes = Axes.Both,
                },
                new Container
                {
                    Padding          = new MarginPadding(side_margin),
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.5f,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    // Reverse ChildID so that dropdowns in the top section appear on top of the bottom section.
                    Child = new ReverseChildIDFillFlowContainer <Drawable>
                    {
                        RelativeSizeAxes = Axes.Both,
                        Spacing          = new Vector2(0, 5),
                        Children         = new[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 60,
                                Children         = new Drawable[]
                                {
                                    searchTextBox = new SeekLimitedSearchTextBox {
                                        RelativeSizeAxes = Axes.X
                                    },
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 1,
                                        Colour           = OsuColour.Gray(80),
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor           = Anchor.BottomRight,
                                        Origin           = Anchor.BottomRight,
                                        Direction        = FillDirection.Horizontal,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Spacing          = new Vector2(OsuTabControl <SortMode> .HORIZONTAL_SPACING, 0),
                                        Children         = new Drawable[]
                                        {
                                            new OsuTabControlCheckbox
                                            {
                                                Text    = "Show converted",
                                                Current = config.GetBindable <bool>(OsuSetting.ShowConvertedBeatmaps),
                                                Anchor  = Anchor.BottomRight,
                                                Origin  = Anchor.BottomRight,
                                            },
                                            sortTabs = new OsuTabControl <SortMode>
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Width            = 0.5f,
                                                Height           = 24,
                                                AutoSort         = true,
                                                Anchor           = Anchor.BottomRight,
                                                Origin           = Anchor.BottomRight,
                                                AccentColour     = colours.GreenLight,
                                                Current          = { BindTarget = sortMode }
                                            },
                                            new OsuSpriteText
                                            {
                                                Text   = "Sort by",
                                                Font   = OsuFont.GetFont(size: 14),
                                                Margin = new MarginPadding(5),
                                                Anchor = Anchor.BottomRight,
                                                Origin = Anchor.BottomRight,
                                            },
                                        }
                                    },
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 20,
                                Children         = new Drawable[]
                                {
                                    collectionDropdown = new CollectionFilterDropdown
                                    {
                                        Anchor           = Anchor.TopRight,
                                        Origin           = Anchor.TopRight,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = 0.4f,
                                    }
                                }
                            },
                        }
                    }
                }
            };

            config.BindWith(OsuSetting.ShowConvertedBeatmaps, showConverted);
            showConverted.ValueChanged += _ => updateCriteria();

            config.BindWith(OsuSetting.DisplayStarsMinimum, minimumStars);
            minimumStars.ValueChanged += _ => updateCriteria();

            config.BindWith(OsuSetting.DisplayStarsMaximum, maximumStars);
            maximumStars.ValueChanged += _ => updateCriteria();

            ruleset.BindTo(parentRuleset);
            ruleset.BindValueChanged(_ => updateCriteria());

            groupMode.BindValueChanged(_ => updateCriteria());
            sortMode.BindValueChanged(_ => updateCriteria());

            collectionDropdown.Current.ValueChanged += val =>
            {
                if (val.NewValue == null)
                {
                    // may be null briefly while menu is repopulated.
                    return;
                }

                updateCriteria();
            };

            searchTextBox.Current.ValueChanged += _ => updateCriteria();

            updateCriteria();
        }
Пример #46
0
        private void load(OsuConfigManager config)
        {
            this.config = config;

            preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += preferUnicode_changed;
            preferUnicode_changed(preferUnicode, null);
        }
Пример #47
0
        private void load(OsuColour colours, OsuConfigManager config)
        {
            var loadableBeatmap = Beatmap.Value;

            if (loadableBeatmap is DummyWorkingBeatmap)
            {
                isNewBeatmap = true;

                loadableBeatmap = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);

                // required so we can get the track length in EditorClock.
                // this is safe as nothing has yet got a reference to this new beatmap.
                loadableBeatmap.LoadTrack();

                // this is a bit haphazard, but guards against setting the lease Beatmap bindable if
                // the editor has already been exited.
                if (!ValidForPush)
                {
                    return;
                }
            }

            try
            {
                playableBeatmap = loadableBeatmap.GetPlayableBeatmap(loadableBeatmap.BeatmapInfo.Ruleset);

                // clone these locally for now to avoid incurring overhead on GetPlayableBeatmap usages.
                // eventually we will want to improve how/where this is done as there are issues with *not* cloning it in all cases.
                playableBeatmap.ControlPointInfo = playableBeatmap.ControlPointInfo.CreateCopy();
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap successfully!");
                // couldn't load, hard abort!
                this.Exit();
                return;
            }

            beatDivisor.Value = playableBeatmap.BeatmapInfo.BeatDivisor;
            beatDivisor.BindValueChanged(divisor => playableBeatmap.BeatmapInfo.BeatDivisor = divisor.NewValue);

            // Todo: should probably be done at a DrawableRuleset level to share logic with Player.
            clock = new EditorClock(playableBeatmap, beatDivisor)
            {
                IsCoupled = false
            };

            UpdateClockSource();

            dependencies.CacheAs(clock);
            AddInternal(clock);

            clock.SeekingOrStopped.BindValueChanged(_ => updateSampleDisabledState());

            // todo: remove caching of this and consume via editorBeatmap?
            dependencies.Cache(beatDivisor);

            AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.Skin));
            dependencies.CacheAs(editorBeatmap);
            changeHandler = new EditorChangeHandler(editorBeatmap);
            dependencies.CacheAs <IEditorChangeHandler>(changeHandler);

            updateLastSavedHash();

            Schedule(() =>
            {
                // we need to avoid changing the beatmap from an asynchronous load thread. it can potentially cause weirdness including crashes.
                // this assumes that nothing during the rest of this load() method is accessing Beatmap.Value (loadableBeatmap should be preferred).
                // generally this is quite safe, as the actual load of editor content comes after menuBar.Mode.ValueChanged is fired in its own LoadComplete.
                Beatmap.Value = loadableBeatmap;
            });

            OsuMenuItem undoMenuItem;
            OsuMenuItem redoMenuItem;

            EditorMenuItem cutMenuItem;
            EditorMenuItem copyMenuItem;
            EditorMenuItem pasteMenuItem;

            AddInternal(new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    new Container
                    {
                        Name             = "Screen container",
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = 40, Bottom = 60
                        },
                        Child = screenContainer = new Container <EditorScreen>
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true
                        }
                    },
                    new Container
                    {
                        Name             = "Top bar",
                        RelativeSizeAxes = Axes.X,
                        Height           = 40,
                        Child            = menuBar = new EditorMenuBar
                        {
                            Anchor           = Anchor.CentreLeft,
                            Origin           = Anchor.CentreLeft,
                            RelativeSizeAxes = Axes.Both,
                            Mode             = { Value = isNewBeatmap ? EditorScreenMode.SongSetup : EditorScreenMode.Compose },
                            Items            = new[]
                            {
                                new MenuItem("File")
                                {
                                    Items = createFileMenuItems()
                                },
                                new MenuItem("Edit")
                                {
                                    Items = new[]
                                    {
                                        undoMenuItem = new EditorMenuItem("Undo", MenuItemType.Standard, Undo),
                                        redoMenuItem = new EditorMenuItem("Redo", MenuItemType.Standard, Redo),
                                        new EditorMenuItemSpacer(),
                                        cutMenuItem   = new EditorMenuItem("Cut", MenuItemType.Standard, Cut),
                                        copyMenuItem  = new EditorMenuItem("Copy", MenuItemType.Standard, Copy),
                                        pasteMenuItem = new EditorMenuItem("Paste", MenuItemType.Standard, Paste),
                                    }
                                },
                                new MenuItem("View")
                                {
                                    Items = new[]
                                    {
                                        new WaveformOpacityMenu(config)
                                    }
                                }
                            }
                        }
                    },
                    new Container
                    {
                        Name             = "Bottom bar",
                        Anchor           = Anchor.BottomLeft,
                        Origin           = Anchor.BottomLeft,
                        RelativeSizeAxes = Axes.X,
                        Height           = 60,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = colours.Gray2
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding {
                                    Vertical = 5, Horizontal = 10
                                },
                                Child = new GridContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    ColumnDimensions = new[]
                                    {
                                        new Dimension(GridSizeMode.Absolute, 220),
                                        new Dimension(),
                                        new Dimension(GridSizeMode.Absolute, 220)
                                    },
                                    Content = new[]
                                    {
                                        new Drawable[]
                                        {
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Right = 10
                                                },
                                                Child = new TimeInfoContainer {
                                                    RelativeSizeAxes = Axes.Both
                                                },
                                            },
                                            new SummaryTimeline
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Left = 10
                                                },
                                                Child = new PlaybackControl {
                                                    RelativeSizeAxes = Axes.Both
                                                },
                                            }
                                        },
                                    }
                                },
                            }
                        }
                    },
                }
            });

            changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
            changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);

            editorBeatmap.SelectedHitObjects.BindCollectionChanged((_, __) =>
            {
                var hasObjects = editorBeatmap.SelectedHitObjects.Count > 0;

                cutMenuItem.Action.Disabled  = !hasObjects;
                copyMenuItem.Action.Disabled = !hasObjects;
            }, true);

            clipboard.BindValueChanged(content => pasteMenuItem.Action.Disabled = string.IsNullOrEmpty(content.NewValue));

            menuBar.Mode.ValueChanged += onModeChanged;
        }
Пример #48
0
        private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio,
            TextureStore textures, OsuColour colours)
        {
            Children = new Drawable[]
            {
                title = new SpriteText
                {
                    Origin = Anchor.BottomCentre,
                    Anchor = Anchor.TopCentre,
                    Position = new Vector2(0, 40),
                    TextSize = 25,
                    Colour = Color4.White,
                    Text = @"Nothing to play",
                    Font = @"Exo2.0-MediumItalic"
                },
                artist = new SpriteText
                {
                    Origin = Anchor.TopCentre,
                    Anchor = Anchor.TopCentre,
                    Position = new Vector2(0, 45),
                    TextSize = 15,
                    Colour = Color4.White,
                    Text = @"Nothing to play",
                    Font = @"Exo2.0-BoldItalic"
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomCentre,
                    Position = new Vector2(0, -30),
                    Action = () =>
                    {
                        if (current?.Track == null) return;
                        if (current.Track.IsRunning)
                            current.Track.Stop();
                        else
                            current.Track.Start();
                    },
                    Children = new Drawable[]
                    {
                        playButton = new TextAwesome
                        {
                            TextSize = 30,
                            Icon = FontAwesome.fa_play_circle_o,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomCentre,
                    Position = new Vector2(-30, -30),
                    Action = prev,
                    Children = new Drawable[]
                    {
                        new TextAwesome
                        {
                            TextSize = 15,
                            Icon = FontAwesome.fa_step_backward,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomCentre,
                    Position = new Vector2(30, -30),
                    Action = next,
                    Children = new Drawable[]
                    {
                        new TextAwesome
                        {
                            TextSize = 15,
                            Icon = FontAwesome.fa_step_forward,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomRight,
                    Position = new Vector2(20, -30),
                    Children = new Drawable[]
                    {
                        listButton = new TextAwesome
                        {
                            TextSize = 15,
                            Icon = FontAwesome.fa_bars,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                progress = new DragBar
                {
                    Origin = Anchor.BottomCentre,
                    Anchor = Anchor.BottomCentre,
                    Height = 10,
                    Colour = colours.Yellow,
                    SeekRequested = seek
                }
            };
        
            this.beatmaps = beatmaps;
            trackManager = osuGame.Audio.Track;
            config = osuGame.Config;
            preferUnicode = osuGame.Config.GetBindable<bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += preferUnicode_changed;

            beatmapSource = osuGame.Beatmap ?? new Bindable<WorkingBeatmap>();
            playList = beatmaps.GetAllWithChildren<BeatmapSetInfo>();

            backgroundSprite = new MusicControllerBackground();
            AddInternal(backgroundSprite);
        }
Пример #49
0
 private void load(OsuConfigManager config)
 {
     config.BindWith(OsuSetting.BeatmapSkins, BeatmapSkins);
     config.BindWith(OsuSetting.BeatmapColours, BeatmapColours);
 }
Пример #50
0
 public override void SetHost(BasicGameHost host)
 {
     if (Config == null)
         Config = new OsuConfigManager(host.Storage);
     base.SetHost(host);
 }
Пример #51
0
        private void load(AudioManager audio, OsuConfigManager config, OsuGame osu)
        {
            dimLevel           = config.GetBindable <double>(OsuSetting.DimLevel);
            mouseWheelDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableWheel);

            sampleRestart = audio.Sample.Get(@"Gameplay/restart");

            Ruleset rulesetInstance;

            WorkingBeatmap working = Beatmap.Value;
            Beatmap        beatmap;

            try
            {
                beatmap = working.Beatmap;

                if (beatmap == null)
                {
                    throw new InvalidOperationException("Beatmap was not loaded");
                }

                ruleset         = osu?.Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset;
                rulesetInstance = ruleset.CreateInstance();

                try
                {
                    RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID);
                }
                catch (BeatmapInvalidForRulesetException)
                {
                    // we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset
                    // let's try again forcing the beatmap's ruleset.
                    ruleset          = beatmap.BeatmapInfo.Ruleset;
                    rulesetInstance  = ruleset.CreateInstance();
                    RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true);
                }

                if (!RulesetContainer.Objects.Any())
                {
                    throw new InvalidOperationException("Beatmap contains no hit objects!");
                }
            }
            catch (Exception e)
            {
                Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error);

                //couldn't load, hard abort!
                Exit();
                return;
            }

            adjustableSourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock();
            decoupledClock        = new DecoupleableInterpolatingFramedClock {
                IsCoupled = false
            };

            var firstObjectTime = RulesetContainer.Objects.First().StartTime;

            decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)));
            decoupledClock.ProcessFrame();

            offsetClock = new FramedOffsetClock(decoupledClock);

            userAudioOffset = config.GetBindable <double>(OsuSetting.AudioOffset);
            userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
            userAudioOffset.TriggerChange();

            Schedule(() =>
            {
                adjustableSourceClock.Reset();

                foreach (var mod in working.Mods.Value.OfType <IApplicableToClock>())
                {
                    mod.ApplyToClock(adjustableSourceClock);
                }

                decoupledClock.ChangeSource(adjustableSourceClock);
            });

            Children = new Drawable[]
            {
                pauseContainer = new PauseContainer
                {
                    AudioClock    = decoupledClock,
                    FramedClock   = offsetClock,
                    OnRetry       = Restart,
                    OnQuit        = Exit,
                    CheckCanPause = () => ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
                    Retries       = RestartCount,
                    OnPause       = () => {
                        hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
                    },
                    OnResume = () => {
                        hudOverlay.KeyCounter.IsCounting = true;
                    },
                    Children = new Drawable[]
                    {
                        new SkipButton(firstObjectTime)
                        {
                            AudioClock = decoupledClock
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Clock            = offsetClock,
                            Children         = new Drawable[]
                            {
                                RulesetContainer,
                            }
                        },
                        hudOverlay = new HUDOverlay
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre
                        },
                    }
                },
                failOverlay = new FailOverlay
                {
                    OnRetry = Restart,
                    OnQuit  = Exit,
                },
                new HotkeyRetryOverlay
                {
                    Action = () => {
                        //we want to hide the hitrenderer immediately (looks better).
                        //we may be able to remove this once the mouse cursor trail is improved.
                        RulesetContainer?.Hide();
                        Restart();
                    },
                }
            };

            scoreProcessor = RulesetContainer.CreateScoreProcessor();

            hudOverlay.KeyCounter.AddRange(rulesetInstance.CreateGameplayKeys());
            hudOverlay.BindProcessor(scoreProcessor);
            hudOverlay.BindRulesetContainer(RulesetContainer);

            hudOverlay.Progress.Objects      = RulesetContainer.Objects;
            hudOverlay.Progress.AudioClock   = decoupledClock;
            hudOverlay.Progress.AllowSeeking = RulesetContainer.HasReplayLoaded;
            hudOverlay.Progress.OnSeek       = pos => decoupledClock.Seek(pos);

            hudOverlay.ModDisplay.Current.BindTo(working.Mods);

            //bind RulesetContainer to ScoreProcessor and ourselves (for a pass situation)
            RulesetContainer.OnAllJudged += onCompletion;

            //bind ScoreProcessor to ourselves (for a fail situation)
            scoreProcessor.Failed += onFail;
        }
Пример #52
0
        private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager)
        {
            const float padding = 5;

            Children = new Drawable[]
            {
                channelSelectionContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Height           = 1f - DEFAULT_HEIGHT,
                    Masking          = true,
                    Children         = new[]
                    {
                        channelSelectionOverlay = new ChannelSelectionOverlay
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                chatContainer = new Container
                {
                    Name             = @"chat container",
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                    Height           = DEFAULT_HEIGHT,
                    Children         = new[]
                    {
                        new Container
                        {
                            Name             = @"chat area",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = TAB_AREA_HEIGHT
                            },
                            Children = new Drawable[]
                            {
                                chatBackground = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                currentChannelContainer = new Container <DrawableChannel>
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding
                                    {
                                        Bottom = textbox_height
                                    },
                                },
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    RelativeSizeAxes = Axes.X,
                                    Height           = textbox_height,
                                    Padding          = new MarginPadding
                                    {
                                        Top    = padding * 2,
                                        Bottom = padding * 2,
                                        Left   = ChatLine.LEFT_PADDING + padding * 2,
                                        Right  = padding * 2,
                                    },
                                    Children = new Drawable[]
                                    {
                                        textbox = new FocusedTextBox
                                        {
                                            RelativeSizeAxes     = Axes.Both,
                                            Height               = 1,
                                            PlaceholderText      = "type your message",
                                            Exit                 = Hide,
                                            OnCommit             = postMessage,
                                            ReleaseFocusOnCommit = false,
                                            HoldFocus            = true,
                                        }
                                    }
                                },
                                loading = new LoadingAnimation(),
                            }
                        },
                        tabsArea = new TabsArea
                        {
                            Children = new Drawable[]
                            {
                                tabBackground = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                },
                                channelTabControl = new ChannelTabControl
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    OnRequestLeave   = channelManager.LeaveChannel
                                },
                            }
                        },
                    },
                },
            };

            channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
            channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
            channelSelectionOverlay.State.ValueChanged           += state =>
            {
                if (state.NewValue == Visibility.Hidden && channelManager.JoinedChannels.Count == 0)
                {
                    channelSelectionOverlay.Show();
                    Hide();
                    return;
                }

                channelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible;

                if (state.NewValue == Visibility.Visible)
                {
                    textbox.HoldFocus = false;
                    if (1f - ChatHeight.Value < channel_selection_min_height)
                    {
                        this.TransformBindableTo(ChatHeight, 1f - channel_selection_min_height, 800, Easing.OutQuint);
                    }
                }
                else
                {
                    textbox.HoldFocus = true;
                }
            };

            channelSelectionOverlay.OnRequestJoin  = channel => channelManager.JoinChannel(channel);
            channelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;

            ChatHeight = config.GetBindable <double>(OsuSetting.ChatDisplayHeight);
            ChatHeight.ValueChanged += height =>
            {
                chatContainer.Height             = (float)height.NewValue;
                channelSelectionContainer.Height = 1f - (float)height.NewValue;
                tabBackground.FadeTo(height.NewValue == 1 ? 1 : 0.8f, 200);
            };
            ChatHeight.TriggerChange();

            chatBackground.Colour = colours.ChatBlue;

            this.channelManager = channelManager;

            loading.Show();

            // This is a relatively expensive (and blocking) operation.
            // Scheduling it ensures that it won't be performed unless the user decides to open chat.
            // TODO: Refactor OsuFocusedOverlayContainer / OverlayContainer to support delayed content loading.
            Schedule(() =>
            {
                // TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
                channelManager.JoinedChannels.ItemsAdded   += onChannelAddedToJoinedChannels;
                channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels;
                foreach (Channel channel in channelManager.JoinedChannels)
                {
                    channelTabControl.AddChannel(channel);
                }

                channelManager.AvailableChannels.ItemsAdded   += availableChannelsChanged;
                channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged;
                channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);

                currentChannel = channelManager.CurrentChannel.GetBoundCopy();
                currentChannel.BindValueChanged(currentChannelChanged, true);
            });
        }
Пример #53
0
        private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config)
        {
            notificationOverlay = notification;
            this.config         = config;
            this.game           = game;

            AutoSizeAxes = Axes.Both;
            Anchor       = Anchor.BottomCentre;
            Origin       = Anchor.BottomCentre;

            Alpha = 0;

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Children     = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Spacing      = new Vector2(5),
                            Anchor       = Anchor.TopCentre,
                            Origin       = Anchor.TopCentre,
                            Children     = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Font = @"Exo2.0-Bold",
                                    Text = game.Name
                                },
                                new OsuSpriteText
                                {
                                    Colour = DebugUtils.IsDebug ? colours.Red : Color4.White,
                                    Text   = game.Version
                                },
                            }
                        },
                        new OsuSpriteText
                        {
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                            TextSize = 12,
                            Colour   = colours.Yellow,
                            Font     = @"Venera",
                            Text     = @"Development Build"
                        },
                        new Sprite
                        {
                            Anchor  = Anchor.TopCentre,
                            Origin  = Anchor.TopCentre,
                            Texture = textures.Get(@"Menu/dev-build-footer"),
                        },
                    }
                }
            };

            if (game.IsDeployedBuild)
            {
                checkForUpdateAsync();
            }
        }
 private void load()
 {
     Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage));
     LocalConfig.GetBindable <double>(OsuSetting.DimLevel).Value = 1.0;
 }
Пример #55
0
        private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
        {
            this.api = api;

            WorkingBeatmap working = Beatmap.Value;

            if (working is DummyWorkingBeatmap)
            {
                return;
            }

            sampleRestart = audio.Sample.Get(@"Gameplay/restart");

            mouseWheelDisabled = config.GetBindable <bool>(OsuSetting.MouseDisableWheel);
            userAudioOffset    = config.GetBindable <double>(OsuSetting.AudioOffset);

            IBeatmap beatmap;

            try
            {
                beatmap = working.Beatmap;

                if (beatmap == null)
                {
                    throw new InvalidOperationException("Beatmap was not loaded");
                }

                ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset;
                var rulesetInstance = ruleset.CreateInstance();

                try
                {
                    RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working);
                }
                catch (BeatmapInvalidForRulesetException)
                {
                    // we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset
                    // let's try again forcing the beatmap's ruleset.
                    ruleset          = beatmap.BeatmapInfo.Ruleset;
                    rulesetInstance  = ruleset.CreateInstance();
                    RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap.Value);
                }

                if (!RulesetContainer.Objects.Any())
                {
                    Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error);
                    return;
                }
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                //couldn't load, hard abort!
                return;
            }

            sourceClock     = (IAdjustableClock)working.Track ?? new StopwatchClock();
            adjustableClock = new DecoupleableInterpolatingFramedClock {
                IsCoupled = false
            };

            adjustableClock.Seek(AllowLeadIn
                ? Math.Min(0, RulesetContainer.GameplayStartTime - beatmap.BeatmapInfo.AudioLeadIn)
                : RulesetContainer.GameplayStartTime);

            adjustableClock.ProcessFrame();

            // Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
            // This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
            var platformOffsetClock = new FramedOffsetClock(adjustableClock)
            {
                Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 22 : 0
            };

            // the final usable gameplay clock with user-set offsets applied.
            var offsetClock = new FramedOffsetClock(platformOffsetClock);

            userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
            userAudioOffset.TriggerChange();

            ScoreProcessor = RulesetContainer.CreateScoreProcessor();
            if (!ScoreProcessor.Mode.Disabled)
            {
                config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
            }

            Children = new Drawable[]
            {
                pauseContainer = new PauseContainer(offsetClock, adjustableClock)
                {
                    Retries       = RestartCount,
                    OnRetry       = Restart,
                    OnQuit        = performUserRequestedExit,
                    CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
                    Children      = new[]
                    {
                        storyboardContainer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Alpha            = 0,
                        },
                        new LocalSkinOverrideContainer(working.Skin)
                        {
                            RelativeSizeAxes = Axes.Both,
                            Child            = RulesetContainer
                        },
                        new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
                        {
                            Anchor             = Anchor.Centre,
                            Origin             = Anchor.Centre,
                            ProcessCustomClock = false,
                            Breaks             = beatmap.Breaks
                        },
                        RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
                        hudOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
                        {
                            Clock = Clock, // hud overlay doesn't want to use the audio clock directly
                            ProcessCustomClock = false,
                            Anchor             = Anchor.Centre,
                            Origin             = Anchor.Centre
                        },
                        new SkipOverlay(RulesetContainer.GameplayStartTime)
                        {
                            Clock = Clock, // skip button doesn't want to use the audio clock directly
                            ProcessCustomClock = false,
                            AdjustableClock    = adjustableClock,
                            FramedClock        = offsetClock,
                        },
                    }
                },
                failOverlay = new FailOverlay
                {
                    OnRetry = Restart,
                    OnQuit  = performUserRequestedExit,
                },
                new HotkeyRetryOverlay
                {
                    Action = () =>
                    {
                        if (!IsCurrentScreen)
                        {
                            return;
                        }

                        fadeOut(true);
                        Restart();
                    },
                }
            };

            hudOverlay.HoldToQuit.Action = performUserRequestedExit;
            hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);

            RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);

            if (ShowStoryboard)
            {
                initializeStoryboard(false);
            }

            // Bind ScoreProcessor to ourselves
            ScoreProcessor.AllJudged += onCompletion;
            ScoreProcessor.Failed    += onFail;

            foreach (var mod in Beatmap.Value.Mods.Value.OfType <IApplicableToScoreProcessor>())
            {
                mod.ApplyToScoreProcessor(ScoreProcessor);
            }
        }