예제 #1
0
            public BPMTextBox()
            {
                Label = "BPM";

                OnCommit += (val, isNew) =>
                {
                    if (!isNew)
                    {
                        return;
                    }

                    if (double.TryParse(Current.Value, out double doubleVal))
                    {
                        try
                        {
                            beatLengthBindable.Value = beatLengthToBpm(doubleVal);
                        }
                        catch
                        {
                            // will restore the previous text value on failure.
                            beatLengthBindable.TriggerChange();
                        }
                    }
                };

                beatLengthBindable.BindValueChanged(val =>
                {
                    Current.Value = beatLengthToBpm(val.NewValue).ToString("N2");
                }, true);
            }
예제 #2
0
            public BPMTextBox()
            {
                Label = "BPM";

                OnCommit += (val, isNew) =>
                {
                    if (!isNew)
                    {
                        return;
                    }

                    try
                    {
                        if (double.TryParse(Current.Value, out double doubleVal) && doubleVal > 0)
                        {
                            beatLengthBindable.Value = beatLengthToBpm(doubleVal);
                        }
                    }
                    catch
                    {
                        // TriggerChange below will restore the previous text value on failure.
                    }

                    // This is run regardless of parsing success as the parsed number may not actually trigger a change
                    // due to bindable clamping. Even in such a case we want to update the textbox to a sane visual state.
                    beatLengthBindable.TriggerChange();
                };

                beatLengthBindable.BindValueChanged(val =>
                {
                    Current.Value = beatLengthToBpm(val.NewValue).ToString("N2");
                }, true);
            }
예제 #3
0
 private void load()
 {
     UpdatePositionAndSize();
     text.BindValueChanged(e => UpdatePositionAndSize());
     startIndex.BindValueChanged(e => UpdatePositionAndSize());
     endIndex.BindValueChanged(e => UpdatePositionAndSize());
 }
예제 #4
0
        private void load()
        {
            Content.AddRange(new Drawable[]
            {
                new AttributeProgressBar(Point)
                {
                    Current = scrollSpeed,
                },
                text = new AttributeText(Point)
                {
                    Width = 45
                },
                kiaiModeBubble = new AttributeText(Point)
                {
                    Text = "kiai"
                },
                omitBarLineBubble = new AttributeText(Point)
                {
                    Text = "no barline"
                },
            });

            kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
            omitBarLine.BindValueChanged(enabled => omitBarLineBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
            scrollSpeed.BindValueChanged(_ => updateText(), true);
        }
예제 #5
0
 private void load(OsuColour colours)
 {
     beatLength.BindValueChanged(beatLength =>
     {
         Label.Text = $"{60000 / beatLength.NewValue:n1} BPM";
     }, true);
 }
예제 #6
0
        private void load()
        {
            Content.Add(text = new AttributeText(Point));

            timeSignature.BindValueChanged(_ => updateText());
            beatLength.BindValueChanged(_ => updateText(), true);
        }
예제 #7
0
        private void load(OsuColour colours)
        {
            Origin = Anchor.CentreLeft;
            Anchor = Anchor.CentreLeft;

            AutoSizeAxes = Axes.Both;

            Color4 colour = point.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    Alpha            = 0.9f,
                    Colour           = ColourInfo.GradientHorizontal(colour, colour.Opacity(0.5f)),
                    RelativeSizeAxes = Axes.Both,
                },
                bpmText = new OsuSpriteText
                {
                    Alpha   = 0.9f,
                    Padding = new MarginPadding(3),
                    Font    = OsuFont.Default.With(size: 40)
                }
            };

            beatLength.BindValueChanged(beatLength =>
            {
                bpmText.Text = $"{60000 / beatLength.NewValue:n1} BPM";
            }, true);
        }
예제 #8
0
        private void load(OverlayColourProvider colourProvider)
        {
            Content.Add(text = new AttributeText(Point));

            Background.Colour = colourProvider.Background4;

            timeSignature.BindValueChanged(_ => updateText());
            beatLength.BindValueChanged(_ => updateText(), true);
        }
예제 #9
0
            private void load()
            {
                sampleBank = samplePoint.SampleBankBindable.GetBoundCopy();
                sampleBank.BindValueChanged(_ => recreate());

                sampleVolume = samplePoint.SampleVolumeBindable.GetBoundCopy();
                sampleVolume.BindValueChanged(_ => recreate());

                recreate();
            }
예제 #10
0
        private void load(OsuColour colours)
        {
            Margin = new MarginPadding {
                Vertical = 5
            };

            Origin = Anchor.BottomCentre;
            Anchor = Anchor.BottomCentre;

            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            Color4 colour = samplePoint.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                volumeBox = new Circle
                {
                    CornerRadius = 5,
                    Anchor       = Anchor.BottomCentre,
                    Origin       = Anchor.BottomCentre,
                    Y            = -20,
                    Width        = 10,
                    Colour       = colour,
                },
                new Container
                {
                    AutoSizeAxes = Axes.X,
                    Height       = 16,
                    Masking      = true,
                    CornerRadius = 8,
                    Anchor       = Anchor.BottomCentre,
                    Origin       = Anchor.BottomCentre,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colour,
                            RelativeSizeAxes = Axes.Both,
                        },
                        text = new OsuSpriteText
                        {
                            Anchor  = Anchor.Centre,
                            Origin  = Anchor.Centre,
                            Padding = new MarginPadding(5),
                            Font    = OsuFont.Default.With(size: 12, weight: FontWeight.SemiBold),
                            Colour  = colours.B5,
                        }
                    }
                },
            };

            volume.BindValueChanged(volume => volumeBox.Height = max_volume_height * volume.NewValue / 100f, true);
            bank.BindValueChanged(bank => text.Text            = bank.NewValue, true);
        }
예제 #11
0
파일: ModNoScope.cs 프로젝트: Wieku/osu
        public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
        {
            if (HiddenComboCount.Value == 0)
            {
                return;
            }

            CurrentCombo = scoreProcessor.Combo.GetBoundCopy();
            CurrentCombo.BindValueChanged(combo =>
            {
                ComboBasedAlpha = Math.Max(MIN_ALPHA, 1 - (float)combo.NewValue / HiddenComboCount.Value);
            }, true);
        }
예제 #12
0
        public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
        {
            if (HiddenComboCount.Value == 0)
            {
                return;
            }

            currentCombo = scoreProcessor.Combo.GetBoundCopy();
            currentCombo.BindValueChanged(combo =>
            {
                targetAlpha = Math.Max(min_alpha, 1 - (float)combo.NewValue / HiddenComboCount.Value);
            }, true);
        }
예제 #13
0
        private void load(OsuColour colours)
        {
            Origin = Anchor.TopLeft;
            Anchor = Anchor.TopLeft;

            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            Color4 colour = samplePoint.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 20,
                    Children         = new Drawable[]
                    {
                        volumeBox = new Box
                        {
                            X                = 2,
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            Colour           = ColourInfo.GradientVertical(colour, Color4.Black),
                            RelativeSizeAxes = Axes.Both,
                        },
                        new Box
                        {
                            Colour           = colour.Lighten(0.2f),
                            Width            = 2,
                            RelativeSizeAxes = Axes.Y,
                        },
                    }
                },
                text = new OsuSpriteText
                {
                    X        = 2,
                    Y        = -5,
                    Anchor   = Anchor.BottomLeft,
                    Alpha    = 0.9f,
                    Rotation = -90,
                    Font     = OsuFont.Default.With(weight: FontWeight.SemiBold)
                }
            };

            volume.BindValueChanged(volume => volumeBox.Height = volume.NewValue / 100f, true);
            bank.BindValueChanged(bank => text.Text            = bank.NewValue, true);
        }
예제 #14
0
        private void load()
        {
            Content.AddRange(new Drawable[]
            {
                new AttributeProgressBar(Point)
                {
                    Current = speedMultiplier,
                },
                text = new AttributeText(Point)
                {
                    Width = 40,
                },
            });

            speedMultiplier.BindValueChanged(_ => updateText(), true);
        }
예제 #15
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            for (int i = 0; i < total_waveforms; i++)
            {
                AddInternal(new WaveformRow(i == total_waveforms / 2)
                {
                    RelativeSizeAxes     = Axes.Both,
                    RelativePositionAxes = Axes.Both,
                    Height = 1f / total_waveforms,
                    Y      = (float)i / total_waveforms,
                });
            }

            AddInternal(new Circle
            {
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Colour           = Color4.White,
                RelativeSizeAxes = Axes.Y,
                Width            = 3,
            });

            AddInternal(lockedOverlay = new LockedOverlay());

            selectedGroup.BindValueChanged(_ => updateTimingGroup(), true);

            controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups);
            controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup());

            beatLength.BindValueChanged(_ => regenerateDisplay(true), true);

            displayLocked.BindValueChanged(locked =>
            {
                if (locked.NewValue)
                {
                    lockedOverlay.Show();
                }
                else
                {
                    lockedOverlay.Hide();
                }
            }, true);
        }
예제 #16
0
 public ColourPropertyDisplay(string name, Func <int, Color4> resultColour)
 {
     resultFunction   = resultColour;
     RelativeSizeAxes = Axes.X;
     Height           = height;
     Children         = new Drawable[]
     {
         new SpriteText
         {
             Text = name,
             Font = new FontUsage(null, font_size)
         },
         new FillFlowContainer <GridItem>
         {
             RelativeSizeAxes = Axes.X,
             Height           = slider_height,
             Direction        = FillDirection.Horizontal,
             Spacing          = new osuTK.Vector2(spacing),
             Anchor           = Anchor.BottomLeft,
             Origin           = Anchor.BottomLeft,
             Children         = new GridItem[]
             {
                 new GridItem(new HBSliderBar <int>
                 {
                     RelativeSizeAxes = Axes.Both,
                     Current          = Bindable = new BindableNumber <int>
                     {
                         MinValue  = 0,
                         MaxValue  = 255,
                         Value     = 127,
                         Precision = 1
                     }
                 }),
                 new GridItem(0.2f, resultBox = new Box
                 {
                     RelativeSizeAxes = Axes.Both
                 })
             }
         }
     };
     Bindable.BindValueChanged(OnValueChanged, true);
 }
예제 #17
0
            protected override void LoadComplete()
            {
                const int judgement_fade_in_duration  = 100;
                const int judgement_fade_out_duration = 5000;

                base.LoadComplete();

                Alpha = 0;
                Width = 0;

                JudgementLineThickness.BindValueChanged(thickness => Height = thickness.NewValue, true);

                this
                .FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint)
                .ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint)
                .Then()
                .FadeOut(judgement_fade_out_duration)
                .ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint)
                .Expire();
            }
예제 #18
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            areaOffset.BindTo(handler.AreaOffset);
            areaOffset.BindValueChanged(val =>
            {
                usableAreaContainer.MoveTo(val.NewValue, 100, Easing.OutQuint);
                checkBounds();
            }, true);

            areaSize.BindTo(handler.AreaSize);
            areaSize.BindValueChanged(val =>
            {
                usableAreaContainer.ResizeTo(val.NewValue, 100, Easing.OutQuint);

                int x             = (int)val.NewValue.X;
                int y             = (int)val.NewValue.Y;
                int commonDivider = greatestCommonDivider(x, y);

                usableAreaText.Text = $"{(float)x / commonDivider}:{(float)y / commonDivider}";
                checkBounds();
            }, true);

            rotation.BindTo(handler.Rotation);
            rotation.BindValueChanged(val =>
            {
                usableAreaContainer.RotateTo(val.NewValue, 100, Easing.OutQuint);
                tabletContainer.RotateTo(-val.NewValue, 800, Easing.OutQuint);

                checkBounds();
            }, true);

            tablet.BindTo(handler.Tablet);
            tablet.BindValueChanged(_ => Scheduler.AddOnce(updateTabletDetails));

            updateTabletDetails();
            // initial animation should be instant.
            FinishTransforms(true);
        }
예제 #19
0
        private void load()
        {
            AttributeProgressBar progress;

            Content.AddRange(new Drawable[]
            {
                sampleText = new AttributeText(Point),
                progress   = new AttributeProgressBar(Point),
                volumeText = new AttributeText(Point)
                {
                    Width = 40,
                },
            });

            volume.BindValueChanged(vol =>
            {
                progress.Current.Value = vol.NewValue / 100f;
                updateText();
            }, true);

            sampleBank.BindValueChanged(_ => updateText(), true);
        }
예제 #20
0
        private void load(OsuColour colours)
        {
            RelativeSizeAxes = Axes.Y;
            AutoSizeAxes     = Axes.X;

            Color4 colour = difficultyPoint.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    Colour           = colour,
                    Width            = 2,
                    RelativeSizeAxes = Axes.Y,
                },
                new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colour,
                            RelativeSizeAxes = Axes.Both,
                        },
                        speedMultiplierText = new OsuSpriteText
                        {
                            Font   = OsuFont.Default.With(weight: FontWeight.Bold),
                            Colour = Color4.White,
                        }
                    }
                },
            };

            speedMultiplier.BindValueChanged(multiplier => speedMultiplierText.Text = $"{multiplier.NewValue:n2}x", true);
        }
예제 #21
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            areaOffset.BindTo(tabletHandler.AreaOffset);
            areaOffset.BindValueChanged(val =>
            {
                offsetX.Value = val.NewValue.X;
                offsetY.Value = val.NewValue.Y;
            }, true);

            offsetX.BindValueChanged(val => areaOffset.Value = new Vector2(val.NewValue, areaOffset.Value.Y));
            offsetY.BindValueChanged(val => areaOffset.Value = new Vector2(areaOffset.Value.X, val.NewValue));

            areaSize.BindTo(tabletHandler.AreaSize);
            areaSize.BindValueChanged(val =>
            {
                sizeX.Value = val.NewValue.X;
                sizeY.Value = val.NewValue.Y;
            }, true);

            sizeX.BindValueChanged(val =>
            {
                areaSize.Value = new Vector2(val.NewValue, areaSize.Value.Y);

                aspectRatioApplication?.Cancel();
                aspectRatioApplication = Schedule(() => applyAspectRatio(sizeX));
            });

            sizeY.BindValueChanged(val =>
            {
                areaSize.Value = new Vector2(areaSize.Value.X, val.NewValue);

                aspectRatioApplication?.Cancel();
                aspectRatioApplication = Schedule(() => applyAspectRatio(sizeY));
            });

            updateAspectRatio();
            aspectRatio.BindValueChanged(aspect =>
            {
                aspectRatioApplication?.Cancel();
                aspectRatioApplication = Schedule(() => forceAspectRatio(aspect.NewValue));
            });

            tablet.BindTo(tabletHandler.Tablet);
            tablet.BindValueChanged(val =>
            {
                Scheduler.AddOnce(toggleVisibility);

                var tab = val.NewValue;

                bool tabletFound = tab != null;
                if (!tabletFound)
                {
                    return;
                }

                offsetX.MaxValue = tab.Size.X;
                offsetX.Default  = tab.Size.X / 2;
                sizeX.Default    = sizeX.MaxValue = tab.Size.X;

                offsetY.MaxValue = tab.Size.Y;
                offsetY.Default  = tab.Size.Y / 2;
                sizeY.Default    = sizeY.MaxValue = tab.Size.Y;

                areaSize.Default = new Vector2(sizeX.Default, sizeY.Default);
            }, true);
        }
 protected override void LoadComplete()
 {
     base.LoadComplete();
     speedMultiplier.BindValueChanged(multiplier => Label.Text = $"{multiplier.NewValue:n2}x", true);
 }