示例#1
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);
            }
示例#2
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);
            }
示例#3
0
        public override void Reset()
        {
            base.Reset();

            playbackSpeed.TriggerChange();

            AddStep(@"circles", () => load(HitObjectType.Circle));
            AddStep(@"slider", () => load(HitObjectType.Slider));
            AddStep(@"spinner", () => load(HitObjectType.Spinner));

            AddToggleStep(@"auto", state => { auto = state; load(mode); });

            BasicSliderBar <double> sliderBar;

            Add(new Container
            {
                Anchor       = Anchor.TopRight,
                Origin       = Anchor.TopRight,
                AutoSizeAxes = Axes.Both,
                Children     = new Drawable[]
                {
                    new SpriteText {
                        Text = "Playback Speed"
                    },
                    sliderBar = new BasicSliderBar <double>
                    {
                        Width          = 150,
                        Height         = 10,
                        SelectionColor = Color4.Orange,
                    }
                }
            });

            sliderBar.Current.BindTo(playbackSpeed);

            framedClock.ProcessFrame();

            var clockAdjustContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Clock            = framedClock,
                Children         = new[]
                {
                    playfieldContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    },
                    approachContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    }
                }
            };

            Add(clockAdjustContainer);

            load(mode);
        }
示例#4
0
        public override void Reset()
        {
            base.Reset();

            playbackSpeed.TriggerChange();

            AddButton(@"circles", () => load(HitObjectType.Circle));
            AddButton(@"slider", () => load(HitObjectType.Slider));
            AddButton(@"spinner", () => load(HitObjectType.Spinner));

            AddToggle(@"auto", () => { auto = !auto; load(mode); });

            ButtonsContainer.Add(new SpriteText {
                Text = "Playback Speed"
            });
            ButtonsContainer.Add(new BasicSliderBar <double>
            {
                Width          = 150,
                Height         = 10,
                SelectionColor = Color4.Orange,
                Bindable       = playbackSpeed
            });

            framedClock.ProcessFrame();

            var clockAdjustContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Clock            = framedClock,
                Children         = new[]
                {
                    playfieldContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    },
                    approachContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    }
                }
            };

            Add(clockAdjustContainer);

            load(mode);
        }