Beispiel #1
0
        public Editor()
        {
            EditorMenuBar     menuBar;
            TimeInfoContainer timeInfo;
            SummaryTimeline   timeline;
            PlaybackControl   playback;

            Children = new[]
            {
                new Container
                {
                    Name             = "Screen container",
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = 40, Bottom = 60
                    },
                    Child = screenContainer = new Container
                    {
                        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,
                        Items            = new[]
                        {
                            new MenuItem("File")
                            {
                                Items = new[]
                                {
                                    new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap),
                                    new EditorMenuItemSpacer(),
                                    new EditorMenuItem("Exit", MenuItemType.Standard, Exit)
                                }
                            }
                        }
                    }
                },
                new Container
                {
                    Name             = "Bottom bar",
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Height           = 60,
                    Children         = new Drawable[]
                    {
                        bottomBackground = new Box {
                            RelativeSizeAxes = Axes.Both
                        },
                        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 = timeInfo = new TimeInfoContainer {
                                                RelativeSizeAxes = Axes.Both
                                            },
                                        },
                                        timeline = new SummaryTimeline
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                        },
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Left = 10
                                            },
                                            Child = playback = new PlaybackControl {
                                                RelativeSizeAxes = Axes.Both
                                            },
                                        }
                                    },
                                }
                            },
                        }
                    }
                },
            };

            timeInfo.Beatmap.BindTo(Beatmap);
            timeline.Beatmap.BindTo(Beatmap);
            playback.Beatmap.BindTo(Beatmap);
            menuBar.Mode.ValueChanged += onModeChanged;
        }
Beispiel #2
0
        private void load(OsuColour colours)
        {
            // TODO: should probably be done at a RulesetContainer level to share logic with Player.
            var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();

            clock = new EditorClock(Beatmap, beatDivisor)
            {
                IsCoupled = false
            };
            clock.ChangeSource(sourceClock);

            dependencies.CacheAs <IFrameBasedClock>(clock);
            dependencies.CacheAs <IAdjustableClock>(clock);
            dependencies.Cache(beatDivisor);

            EditorMenuBar     menuBar;
            TimeInfoContainer timeInfo;
            SummaryTimeline   timeline;
            PlaybackControl   playback;

            Children = new[]
            {
                new Container
                {
                    Name             = "Screen container",
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = 40, Bottom = 60
                    },
                    Child = screenContainer = new Container
                    {
                        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,
                        Items            = new[]
                        {
                            new MenuItem("File")
                            {
                                Items = new[]
                                {
                                    new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap),
                                    new EditorMenuItemSpacer(),
                                    new EditorMenuItem("Exit", MenuItemType.Standard, Exit)
                                }
                            }
                        }
                    }
                },
                new Container
                {
                    Name             = "Bottom bar",
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Height           = 60,
                    Children         = new Drawable[]
                    {
                        bottomBackground = new Box {
                            RelativeSizeAxes = Axes.Both
                        },
                        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 = timeInfo = new TimeInfoContainer {
                                                RelativeSizeAxes = Axes.Both
                                            },
                                        },
                                        timeline = new SummaryTimeline
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                        },
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Padding          = new MarginPadding {
                                                Left = 10
                                            },
                                            Child = playback = new PlaybackControl {
                                                RelativeSizeAxes = Axes.Both
                                            },
                                        }
                                    },
                                }
                            },
                        }
                    }
                },
            };

            timeInfo.Beatmap.BindTo(Beatmap);
            timeline.Beatmap.BindTo(Beatmap);
            playback.Beatmap.BindTo(Beatmap);
            menuBar.Mode.ValueChanged += onModeChanged;

            bottomBackground.Colour = colours.Gray2;
        }