Exemple #1
0
        private void load(AudioManager audio, OsuColour colours)
        {
            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 300,
                    Colour           = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.75f), Color4.Black.Opacity(0))
                },
                muteButton = new MuteButton
                {
                    Anchor  = Anchor.BottomLeft,
                    Origin  = Anchor.BottomLeft,
                    Margin  = new MarginPadding(10),
                    Current = { BindTarget = IsMuted }
                },
                volumeMeters = new SelectionCycleFillFlowContainer <VolumeMeter>
                {
                    Direction    = FillDirection.Vertical,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Spacing      = new Vector2(0, offset),
                    Margin       = new MarginPadding {
                        Left = offset
                    },
                    Children = new[]
                    {
                        volumeMeterEffect = new VolumeMeter("EFFECTS", 125, colours.BlueDarker),
                        volumeMeterMaster = new VolumeMeter("MASTER", 150, colours.PinkDarker),
                        volumeMeterMusic  = new VolumeMeter("MUSIC", 125, colours.BlueDarker),
                    }
                }
            });

            volumeMeterMaster.Bindable.BindTo(audio.Volume);
            volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
            volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);

            IsMuted.BindValueChanged(muted =>
            {
                if (muted.NewValue)
                {
                    audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
                }
                else
                {
                    audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);
                }
            });
        }
Exemple #2
0
        private void load(OsuColour colours)
        {
            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Black,
                    Alpha            = background_alpha,
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Spacing          = new Vector2(0, 50),
                    Origin           = Anchor.Centre,
                    Anchor           = Anchor.Centre,
                    Children         = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Origin           = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0, 20),
                            Children         = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Text         = Header,
                                    Font         = OsuFont.GetFont(size: 30),
                                    Spacing      = new Vector2(5, 0),
                                    Origin       = Anchor.TopCentre,
                                    Anchor       = Anchor.TopCentre,
                                    Colour       = colours.Yellow,
                                    Shadow       = true,
                                    ShadowColour = new Colour4(0, 0, 0, 0.25f)
                                },
                                new OsuSpriteText
                                {
                                    Text         = Description,
                                    Origin       = Anchor.TopCentre,
                                    Anchor       = Anchor.TopCentre,
                                    Shadow       = true,
                                    ShadowColour = new Colour4(0, 0, 0, 0.25f)
                                }
                            }
                        },
                        InternalButtons = new SelectionCycleFillFlowContainer <DialogButton>
                        {
                            Origin           = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Masking          = true,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Colour4.Black.Opacity(0.6f),
                                Radius = 50
                            },
                        },
                        retryCounterContainer = new FillFlowContainer
                        {
                            Origin       = Anchor.TopCentre,
                            Anchor       = Anchor.TopCentre,
                            AutoSizeAxes = Axes.Both,
                        }
                    }
                },
            };

            State.ValueChanged += s => InternalButtons.Deselect();

            updateRetryCount();
        }