Esempio n. 1
0
        private void load()
        {
            Child = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.Both,
                Masking          = true,
                Child            = scroll = new OsuScrollContainer
                {
                    ScrollbarVisible = scrollbarVisible,
                    RelativeSizeAxes = Axes.Both,
                    // Some chat lines have effects that slightly protrude to the bottom,
                    // which we do not want to mask away, hence the padding.
                    Padding = new MarginPadding {
                        Bottom = 5
                    },
                    Child = ChatLineFlow = new FillFlowContainer
                    {
                        Padding = new MarginPadding {
                            Left = 20, Right = 20
                        },
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                    }
                },
            };

            newMessagesArrived(Channel.Messages);

            Channel.NewMessagesArrived     += newMessagesArrived;
            Channel.MessageRemoved         += messageRemoved;
            Channel.PendingMessageResolved += pendingMessageResolved;
        }
        private void createColourPalette(bool hasDescription = false)
        {
            AddStep("create component", () =>
            {
                Child = new OsuContextMenuContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = new Container
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        Width        = 500,
                        AutoSizeAxes = Axes.Y,
                        Child        = component = new LabelledColourPalette
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            ColourNamePrefix = "My colour #"
                        }
                    }
                };

                component.Label       = "a sample component";
                component.Description = hasDescription ? "this text describes the component" : string.Empty;

                component.Colours.AddRange(new[]
                {
                    Colour4.DarkRed,
                    Colour4.Aquamarine,
                    Colour4.Goldenrod,
                    Colour4.Gainsboro
                });
            });
        }
Esempio n. 3
0
        private void load(OsuColour colours)
        {
            InternalChild = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    headerText = new OsuTextFlowContainer
                    {
                        TextAnchor       = Anchor.TopCentre,
                        Padding          = new MarginPadding(20),
                        Anchor           = Anchor.TopCentre,
                        Origin           = Anchor.TopCentre,
                        RelativeSizeAxes = Axes.X
                    },
                    new SkinBlueprintContainer(target),
                }
            };

            headerText.AddParagraph("Skin editor (preview)", cp => cp.Font = OsuFont.Default.With(size: 24));
            headerText.AddParagraph("This is a preview of what is to come. Changes are lost on changing screens.", cp =>
            {
                cp.Font   = OsuFont.Default.With(size: 12);
                cp.Colour = colours.Yellow;
            });
        }
Esempio n. 4
0
 public BeatmapCarousel()
 {
     Child = new OsuContextMenuContainer
     {
         RelativeSizeAxes = Axes.X,
         AutoSizeAxes     = Axes.Y,
         Child            = scrollableContent = new Container <DrawableCarouselItem>
         {
             RelativeSizeAxes = Axes.X,
         }
     };
 }
Esempio n. 5
0
        public RoomsContainer()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            InternalChild = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Child            = roomFlow = new FillFlowContainer <DrawableRoom>
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Spacing          = new Vector2(2),
                }
            };
        }
Esempio n. 6
0
 private void load()
 {
     InternalChild = new OsuContextMenuContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = new OsuScrollContainer
         {
             RelativeSizeAxes = Axes.Both,
             ScrollbarVisible = false,
             Child            = panels = new FillFlowContainer <ParticipantPanel>
             {
                 RelativeSizeAxes = Axes.X,
                 AutoSizeAxes     = Axes.Y,
                 Direction        = FillDirection.Vertical,
                 Spacing          = new Vector2(0, 2)
             }
         }
     };
 }
Esempio n. 7
0
        private void load(AudioManager audio)
        {
            InternalChild = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new OsuScrollContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    ScrollbarVisible = false,
                    Child            = panels = new FillFlowContainer <ParticipantPanel>
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                        Spacing          = new Vector2(0, 2)
                    }
                }
            };

            userJoinSample   = audio.Samples.Get(@"Multiplayer/player-joined");
            userLeftSample   = audio.Samples.Get(@"Multiplayer/player-left");
            userKickedSample = audio.Samples.Get(@"Multiplayer/player-kicked");
        }
Esempio n. 8
0
        public RoomsContainer()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            // account for the fact we are in a scroll container and want a bit of spacing from the scroll bar.
            Padding = new MarginPadding {
                Right = 5
            };

            InternalChild = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Child            = roomFlow = new FillFlowContainer <DrawableLoungeRoom>
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Spacing          = new Vector2(10),
                }
            };
        }
Esempio n. 9
0
 private void load()
 {
     InternalChild = new OsuContextMenuContainer
     {
         RelativeSizeAxes = Axes.Both,
         Children         = new Drawable[]
         {
             headerText = new OsuTextFlowContainer
             {
                 TextAnchor       = Anchor.TopCentre,
                 Padding          = new MarginPadding(20),
                 Anchor           = Anchor.TopCentre,
                 Origin           = Anchor.TopCentre,
                 RelativeSizeAxes = Axes.X
             },
             new GridContainer
             {
                 RelativeSizeAxes = Axes.Both,
                 ColumnDimensions = new[]
                 {
                     new Dimension(GridSizeMode.AutoSize),
                     new Dimension()
                 },
                 Content = new[]
                 {
                     new Drawable[]
                     {
                         new SkinComponentToolbox(600)
                         {
                             Anchor           = Anchor.CentreLeft,
                             Origin           = Anchor.CentreLeft,
                             RequestPlacement = placeComponent
                         },
                         new Container
                         {
                             RelativeSizeAxes = Axes.Both,
                             Children         = new Drawable[]
                             {
                                 new SkinBlueprintContainer(targetScreen),
                                 new FillFlowContainer
                                 {
                                     Direction    = FillDirection.Horizontal,
                                     AutoSizeAxes = Axes.Both,
                                     Anchor       = Anchor.TopRight,
                                     Origin       = Anchor.TopRight,
                                     Spacing      = new Vector2(5),
                                     Padding      = new MarginPadding
                                     {
                                         Top  = 10,
                                         Left = 10,
                                     },
                                     Margin = new MarginPadding
                                     {
                                         Right  = 10,
                                         Bottom = 10,
                                     },
                                     Children = new Drawable[]
                                     {
                                         new TriangleButton
                                         {
                                             Text   = "Save Changes",
                                             Width  = 140,
                                             Action = Save,
                                         },
                                         new DangerousTriangleButton
                                         {
                                             Text   = "Revert to default",
                                             Width  = 140,
                                             Action = revert,
                                         },
                                     }
                                 },
                             }
                         },
                     }
                 }
             }
         }
     };
 }
Esempio n. 10
0
        private void load(OsuColour colours, GameHost host)
        {
            this.host = host;

            beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
            beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);

            // Todo: should probably be done at a DrawableRuleset level to share logic with Player.
            var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();

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

            playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
            editorBeatmap   = new EditorBeatmap(playableBeatmap);

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

            EditorMenuBar menuBar;

            var fileMenuItems = new List <MenuItem>();

            if (RuntimeInfo.IsDesktop)
            {
                fileMenuItems.Add(new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap));
                fileMenuItems.Add(new EditorMenuItemSpacer());
            }

            fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit));

            InternalChild = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.Both,
                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 = fileMenuItems
                                }
                            }
                        }
                    },
                    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 = new TimeInfoContainer {
                                                    RelativeSizeAxes = Axes.Both
                                                },
                                            },
                                            new SummaryTimeline
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Left = 10
                                                },
                                                Child = new PlaybackControl {
                                                    RelativeSizeAxes = Axes.Both
                                                },
                                            }
                                        },
                                    }
                                },
                            }
                        }
                    },
                }
            };

            menuBar.Mode.ValueChanged += onModeChanged;

            bottomBackground.Colour = colours.Gray2;
        }
Esempio n. 11
0
        private void load()
        {
            RelativeSizeAxes = Axes.Both;

            const float menu_height = 40;

            InternalChild = new OsuContextMenuContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(),
                    },

                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                Name             = "Menu container",
                                RelativeSizeAxes = Axes.X,
                                Depth            = float.MinValue,
                                Height           = menu_height,
                                Children         = new Drawable[]
                                {
                                    new EditorMenuBar
                                    {
                                        Anchor           = Anchor.CentreLeft,
                                        Origin           = Anchor.CentreLeft,
                                        RelativeSizeAxes = Axes.Both,
                                        Items            = new[]
                                        {
                                            new MenuItem("File")
                                            {
                                                Items = new[]
                                                {
                                                    new EditorMenuItem("Save", MenuItemType.Standard, Save),
                                                    new EditorMenuItem("Revert to default", MenuItemType.Destructive, revert),
                                                    new EditorMenuItemSpacer(),
                                                    new EditorMenuItem("Exit", MenuItemType.Standard, () => skinEditorOverlay?.Hide()),
                                                },
                                            },
                                        }
                                    },
                                    headerText = new OsuTextFlowContainer
                                    {
                                        TextAnchor       = Anchor.TopRight,
                                        Padding          = new MarginPadding(5),
                                        Anchor           = Anchor.TopRight,
                                        Origin           = Anchor.TopRight,
                                        AutoSizeAxes     = Axes.X,
                                        RelativeSizeAxes = Axes.Y,
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            new SkinEditorSceneLibrary
                            {
                                RelativeSizeAxes = Axes.X,
                            },
                        },
                        new Drawable[]
                        {
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                ColumnDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize),
                                    new Dimension(),
                                    new Dimension(GridSizeMode.AutoSize),
                                },
                                Content = new[]
                                {
                                    new Drawable[]
                                    {
                                        componentsSidebar = new EditorSidebar(),
                                        content           = new Container
                                        {
                                            Depth            = float.MaxValue,
                                            RelativeSizeAxes = Axes.Both,
                                        },
                                        settingsSidebar = new EditorSidebar(),
                                    }
                                }
                            }
                        },
                    }
                }
            };
        }
Esempio n. 12
0
 private void load()
 {
     InternalChild = new OsuContextMenuContainer
     {
         RelativeSizeAxes = Axes.Both,
         Children         = new Drawable[]
         {
             new Container
             {
                 Name             = "Top bar",
                 RelativeSizeAxes = Axes.X,
                 Depth            = float.MinValue,
                 Height           = 40,
                 Children         = new Drawable[]
                 {
                     new EditorMenuBar
                     {
                         Anchor           = Anchor.CentreLeft,
                         Origin           = Anchor.CentreLeft,
                         RelativeSizeAxes = Axes.Both,
                         Items            = new[]
                         {
                             new MenuItem("File")
                             {
                                 Items = new[]
                                 {
                                     new EditorMenuItem("Save", MenuItemType.Standard, Save),
                                     new EditorMenuItem("Revert to default", MenuItemType.Destructive, revert),
                                     new EditorMenuItemSpacer(),
                                     new EditorMenuItem("Exit", MenuItemType.Standard, Hide),
                                 },
                             },
                         }
                     },
                     headerText = new OsuTextFlowContainer
                     {
                         TextAnchor       = Anchor.TopRight,
                         Padding          = new MarginPadding(5),
                         Anchor           = Anchor.TopRight,
                         Origin           = Anchor.TopRight,
                         AutoSizeAxes     = Axes.X,
                         RelativeSizeAxes = Axes.Y,
                     },
                 },
             },
             new GridContainer
             {
                 RelativeSizeAxes = Axes.Both,
                 ColumnDimensions = new[]
                 {
                     new Dimension(GridSizeMode.AutoSize),
                     new Dimension(),
                     new Dimension(GridSizeMode.AutoSize),
                 },
                 Content = new[]
                 {
                     new Drawable[]
                     {
                         new SkinComponentToolbox(600)
                         {
                             Anchor           = Anchor.CentreLeft,
                             Origin           = Anchor.CentreLeft,
                             RequestPlacement = placeComponent
                         },
                         content = new Container
                         {
                             RelativeSizeAxes = Axes.Both,
                         },
                         settingsToolbox = new SkinSettingsToolbox
                         {
                             Anchor = Anchor.CentreRight,
                             Origin = Anchor.CentreRight,
                         }
                     }
                 }
             }
         }
     };
 }