Пример #1
0
        public TimelineArea()
        {
            Masking      = true;
            CornerRadius = 5;

            OsuCheckbox hitObjectsCheckbox;
            OsuCheckbox hitSoundsCheckbox;
            OsuCheckbox waveformCheckbox;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex("111")
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.FromHex("222")
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor       = Anchor.CentreLeft,
                                        Origin       = Anchor.CentreLeft,
                                        AutoSizeAxes = Axes.Y,
                                        Width        = 160,
                                        Padding      = new MarginPadding {
                                            Horizontal = 15
                                        },
                                        Direction = FillDirection.Vertical,
                                        Spacing   = new Vector2(0, 4),
                                        Children  = new[]
                                        {
                                            hitObjectsCheckbox = new OsuCheckbox {
                                                LabelText = "击打物件"
                                            },
                                            hitSoundsCheckbox = new OsuCheckbox {
                                                LabelText = "击打音效"
                                            },
                                            waveformCheckbox = new OsuCheckbox {
                                                LabelText = "声音波形"
                                            }
                                        }
                                    }
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.FromHex("333")
                                    },
                                    new Container <TimelineButton>
                                    {
                                        Anchor           = Anchor.CentreLeft,
                                        Origin           = Anchor.CentreLeft,
                                        RelativeSizeAxes = Axes.Y,
                                        AutoSizeAxes     = Axes.X,
                                        Masking          = true,
                                        Children         = new[]
                                        {
                                            new TimelineButton
                                            {
                                                RelativeSizeAxes = Axes.Y,
                                                Height           = 0.5f,
                                                Icon             = FontAwesome.Solid.SearchPlus,
                                                Action           = () => changeZoom(1)
                                            },
                                            new TimelineButton
                                            {
                                                Anchor           = Anchor.BottomLeft,
                                                Origin           = Anchor.BottomLeft,
                                                RelativeSizeAxes = Axes.Y,
                                                Height           = 0.5f,
                                                Icon             = FontAwesome.Solid.SearchMinus,
                                                Action           = () => changeZoom(-1)
                                            },
                                        }
                                    }
                                }
                            },
                            timeline = new Timeline {
                                RelativeSizeAxes = Axes.Both
                            }
                        },
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.Distributed),
                    }
                }
            };

            hitObjectsCheckbox.Current.Value = true;
            hitSoundsCheckbox.Current.Value  = true;
            waveformCheckbox.Current.Value   = true;

            timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
        }
Пример #2
0
        private void load(OverlayColourProvider colourProvider)
        {
            Masking = true;

            OsuCheckbox waveformCheckbox;
            OsuCheckbox controlPointsCheckbox;
            OsuCheckbox ticksCheckbox;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = colourProvider.Background5
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X,
                                Name             = @"Toggle controls",
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = colourProvider.Background2,
                                    },
                                    new FillFlowContainer
                                    {
                                        AutoSizeAxes = Axes.Y,
                                        Width        = 160,
                                        Padding      = new MarginPadding(10),
                                        Direction    = FillDirection.Vertical,
                                        Spacing      = new Vector2(0, 4),
                                        Children     = new[]
                                        {
                                            waveformCheckbox = new OsuCheckbox
                                            {
                                                LabelText = "Waveform",
                                                Current   = { Value = true },
                                            },
                                            controlPointsCheckbox = new OsuCheckbox
                                            {
                                                LabelText = "Control Points",
                                                Current   = { Value = true },
                                            },
                                            ticksCheckbox = new OsuCheckbox
                                            {
                                                LabelText = "Ticks",
                                                Current   = { Value = true },
                                            }
                                        }
                                    }
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X,
                                Name             = @"Zoom controls",
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = colourProvider.Background3,
                                    },
                                    new Container <TimelineButton>
                                    {
                                        Anchor           = Anchor.CentreLeft,
                                        Origin           = Anchor.CentreLeft,
                                        RelativeSizeAxes = Axes.Y,
                                        AutoSizeAxes     = Axes.X,
                                        Masking          = true,
                                        Children         = new[]
                                        {
                                            new TimelineButton
                                            {
                                                RelativeSizeAxes = Axes.Y,
                                                Height           = 0.5f,
                                                Icon             = FontAwesome.Solid.SearchPlus,
                                                Action           = () => changeZoom(1)
                                            },
                                            new TimelineButton
                                            {
                                                Anchor           = Anchor.BottomLeft,
                                                Origin           = Anchor.BottomLeft,
                                                RelativeSizeAxes = Axes.Y,
                                                Height           = 0.5f,
                                                Icon             = FontAwesome.Solid.SearchMinus,
                                                Action           = () => changeZoom(-1)
                                            },
                                        }
                                    }
                                }
                            },
                            Timeline = new Timeline(userContent),
                        },
                    },
                    RowDimensions = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(),
                    }
                }
            };

            Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
            Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
            Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
        }