示例#1
0
        private void load()
        {
            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(0.2f),
                },
                new OsuScrollContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.9f,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Child            = flow = new FillFlowContainer <TDrawable>
                    {
                        Direction        = FillDirection.Vertical,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Spacing          = new Vector2(20)
                    },
                },
                ControlPanel = new ControlPanel
                {
                    Children = new Drawable[]
                    {
                        new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Add new",
                            Action           = () => Storage.Add(new TModel())
                        },
                        new DangerousSettingsButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Clear all",
                            Action           = Storage.Clear
                        },
                    }
                }
            });

            Storage.CollectionChanged += (_, args) =>
            {
                switch (args.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    args.NewItems.Cast <TModel>().ForEach(i => flow.Add(CreateDrawable(i)));
                    break;

                case NotifyCollectionChangedAction.Remove:
                    args.OldItems.Cast <TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i));
                    break;
                }
            };

            foreach (var model in Storage)
            {
                flow.Add(CreateDrawable(model));
            }
        }
示例#2
0
 public bool DimEqual(float expectedDimLevel) => Content.Colour == OsuColour.Gray(1f - expectedDimLevel);
示例#3
0
        public TestSceneRankGraph()
        {
            RankGraph graph;

            var data          = new int[89];
            var dataWithZeros = new int[89];
            var smallData     = new int[89];
            var edgyData      = new int[89];

            for (int i = 0; i < 89; i++)
            {
                data[i] = dataWithZeros[i] = (i + 1) * 1000;
            }

            for (int i = 20; i < 60; i++)
            {
                dataWithZeros[i] = 0;
            }

            for (int i = 79; i < 89; i++)
            {
                smallData[i] = 100000 - i * 1000;
            }

            bool edge = true;

            for (int i = 0; i < 20; i++)
            {
                edgyData[i] = 100000 + (edge ? 1000 : -1000) * (i + 1);
                edge        = !edge;
            }

            Add(new Container
            {
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                Size     = new Vector2(300, 150),
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.Gray(0.2f)
                    },
                    graph = new RankGraph
                    {
                        RelativeSizeAxes = Axes.Both,
                    }
                }
            });

            AddStep("null user", () => graph.User.Value = null);
            AddStep("rank only", () =>
            {
                graph.User.Value = new User
                {
                    Statistics = new UserStatistics
                    {
                        Ranks = new UserStatistics.UserRanks {
                            Global = 123456
                        },
                        PP = 12345,
                    }
                };
            });

            AddStep("with rank history", () =>
            {
                graph.User.Value = new User
                {
                    Statistics = new UserStatistics
                    {
                        Ranks = new UserStatistics.UserRanks {
                            Global = 89000
                        },
                        PP = 12345,
                    },
                    RankHistory = new User.RankHistoryData
                    {
                        Data = data,
                    }
                };
            });

            AddStep("with zero values", () =>
            {
                graph.User.Value = new User
                {
                    Statistics = new UserStatistics
                    {
                        Ranks = new UserStatistics.UserRanks {
                            Global = 89000
                        },
                        PP = 12345,
                    },
                    RankHistory = new User.RankHistoryData
                    {
                        Data = dataWithZeros,
                    }
                };
            });

            AddStep("small amount of data", () =>
            {
                graph.User.Value = new User
                {
                    Statistics = new UserStatistics
                    {
                        Ranks = new UserStatistics.UserRanks {
                            Global = 12000
                        },
                        PP = 12345,
                    },
                    RankHistory = new User.RankHistoryData
                    {
                        Data = smallData,
                    }
                };
            });

            AddStep("graph with edges", () =>
            {
                graph.User.Value = new User
                {
                    Statistics = new UserStatistics
                    {
                        Ranks = new UserStatistics.UserRanks {
                            Global = 12000
                        },
                        PP = 12345,
                    },
                    RankHistory = new User.RankHistoryData
                    {
                        Data = edgyData,
                    }
                };
            });
        }
示例#4
0
        public ButtonSystem()
        {
            RelativeSizeAxes = Axes.Both;

            Children = new Drawable[]
            {
                buttonArea = new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    Size             = new Vector2(1, BUTTON_AREA_HEIGHT),
                    Alpha            = 0,
                    Children         = new Drawable[]
                    {
                        buttonAreaBackground = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(2, 1),
                            Colour           = OsuColour.Gray(50),
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                        },
                        buttonFlow = new FlowContainerWithOrigin
                        {
                            Direction    = FillDirection.Horizontal,
                            Spacing      = new Vector2(-WEDGE_WIDTH, 0),
                            Anchor       = Anchor.Centre,
                            AutoSizeAxes = Axes.Both,
                            Children     = new[]
                            {
                                settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
                                backButton     = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH),
                                iconFacade     = new Container //need a container to make the osu! icon flow properly.
                                {
                                    Size = new Vector2(0, BUTTON_AREA_HEIGHT)
                                }
                            },
                            CentreTarget = iconFacade
                        }
                    }
                },
                osuLogo = new OsuLogo
                {
                    Action = onOsuLogo,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.Centre,
                }
            };

            buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
            buttonsPlay.Add(new Button(@"multi", @"multiplayer", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M));
            buttonsPlay.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));

            buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, WEDGE_WIDTH, Key.P));
            buttonsTopLevel.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
            buttonsTopLevel.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
            buttonsTopLevel.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q));

            buttonFlow.Add(buttonsPlay);
            buttonFlow.Add(buttonsTopLevel);
        }
示例#5
0
        private void load()
        {
            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(0.2f),
                },
                new OsuScrollContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Child            = flow = new FillFlowContainer <TDrawable>
                    {
                        Direction        = FillDirection.Vertical,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Spacing          = new Vector2(20),
                    },
                },
                ControlPanel = new ControlPanel
                {
                    Children = new Drawable[]
                    {
                        new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Add new",
                            Action           = () => Storage.Add(new TModel())
                        },
                        new DangerousSettingsButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Clear all",
                            Action           = Storage.Clear
                        },
                    }
                }
            });

            if (parentScreen != null)
            {
                AddInternal(backButton = new BackButton
                {
                    Anchor = Anchor.BottomLeft,
                    Origin = Anchor.BottomLeft,
                    State  = { Value = Visibility.Visible },
                    Action = () => sceneManager?.SetScreen(parentScreen.GetType())
                });

                flow.Padding = new MarginPadding {
                    Bottom = backButton.Height * 2
                };
            }

            Storage.CollectionChanged += (_, args) =>
            {
                switch (args.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    args.NewItems.Cast <TModel>().ForEach(i => flow.Add(CreateDrawable(i)));
                    break;

                case NotifyCollectionChangedAction.Remove:
                    args.OldItems.Cast <TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i));
                    break;
                }
            };

            foreach (var model in Storage)
            {
                flow.Add(CreateDrawable(model));
            }
        }
示例#6
0
 private void updateBlockingOverlayFade() =>
 screenContainer.FadeColour(visibleBlockingOverlays.Any() ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint);
示例#7
0
 private void load(OsuColour colours)
 {
     colourActive = colours.Blue;
     Colour       = colourInactive = OsuColour.Gray(0.5f);
     Height       = 5;
 }
示例#8
0
            public SeedingResultRow(TournamentTeam team, SeedingResult round)
            {
                Model = round;

                Masking      = true;
                CornerRadius = 10;

                SeedingBeatmapEditor beatmapEditor = new SeedingBeatmapEditor(round)
                {
                    Width = 0.95f
                };

                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        Colour           = OsuColour.Gray(0.1f),
                        RelativeSizeAxes = Axes.Both,
                    },
                    new FillFlowContainer
                    {
                        Margin  = new MarginPadding(5),
                        Padding = new MarginPadding {
                            Right = 160
                        },
                        Spacing          = new Vector2(5),
                        Direction        = FillDirection.Full,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            new SettingsTextBox
                            {
                                LabelText = "Mod",
                                Width     = 0.33f,
                                Current   = Model.Mod
                            },
                            new SettingsSlider <int>
                            {
                                LabelText = "Seed",
                                Width     = 0.33f,
                                Current   = Model.Seed
                            },
                            new SettingsButton
                            {
                                Width  = 0.2f,
                                Margin = new MarginPadding(10),
                                Text   = "Add beatmap",
                                Action = () => beatmapEditor.CreateNew()
                            },
                            beatmapEditor
                        }
                    },
                    new DangerousSettingsButton
                    {
                        Anchor           = Anchor.CentreRight,
                        Origin           = Anchor.CentreRight,
                        RelativeSizeAxes = Axes.None,
                        Width            = 150,
                        Text             = "Delete result",
                        Action           = () =>
                        {
                            Expire();
                            team.SeedingResults.Remove(Model);
                        },
                    }
                };

                RelativeSizeAxes = Axes.X;
                AutoSizeAxes     = Axes.Y;
            }
示例#9
0
        private void load(LadderInfo ladder, TextureStore textures)
        {
            currentMatch.BindValueChanged(matchChanged);
            currentMatch.BindTo(ladder.CurrentMatch);

            Masking = true;

            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Black,
                },
                new UpdateableOnlineBeatmapSetCover
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(0.5f),
                    OnlineInfo       = Beatmap.BeatmapSet,
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Padding      = new MarginPadding(15),
                    Direction    = FillDirection.Vertical,
                    Children     = new Drawable[]
                    {
                        new TournamentSpriteText
                        {
                            Text = Beatmap.GetDisplayTitleRomanisable(false, false),
                            Font = OsuFont.Torus.With(weight: FontWeight.Bold),
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Children     = new Drawable[]
                            {
                                new TournamentSpriteText
                                {
                                    Text    = "mapper",
                                    Padding = new MarginPadding {
                                        Right = 5
                                    },
                                    Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
                                },
                                new TournamentSpriteText
                                {
                                    Text    = Beatmap.Metadata.Author.Username,
                                    Padding = new MarginPadding {
                                        Right = 20
                                    },
                                    Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
                                },
                                new TournamentSpriteText
                                {
                                    Text    = "difficulty",
                                    Padding = new MarginPadding {
                                        Right = 5
                                    },
                                    Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
                                },
                                new TournamentSpriteText
                                {
                                    Text = Beatmap.DifficultyName,
                                    Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
                                },
                            }
                        }
                    },
                },
                flash = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Gray,
                    Blending         = BlendingParameters.Additive,
                    Alpha            = 0,
                },
            });

            if (!string.IsNullOrEmpty(mod))
            {
                AddInternal(new TournamentModIcon(mod)
                {
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                    Margin           = new MarginPadding(10),
                    Width            = 60,
                    RelativeSizeAxes = Axes.Y,
                });
            }
        }
示例#10
0
        public ModSelectOverlay()
        {
            Waves.FirstWaveColour  = Color4Extensions.FromHex(@"19b0e2");
            Waves.SecondWaveColour = Color4Extensions.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = Color4Extensions.FromHex(@"005774");
            Waves.FourthWaveColour = Color4Extensions.FromHex(@"003a4e");

            RelativeSizeAxes = Axes.Both;

            Padding = new MarginPadding {
                Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING
            };

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(36, 50, 68, 255)
                        },
                        new Triangles
                        {
                            TriangleScale    = 5,
                            RelativeSizeAxes = Axes.Both,
                            ColourLight      = new Color4(53, 66, 82, 255),
                            ColourDark       = new Color4(41, 54, 70, 255),
                        },
                    },
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Absolute, 90),
                        new Dimension(GridSizeMode.Distributed),
                        new Dimension(GridSizeMode.AutoSize),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.Gray(10).Opacity(100),
                                    },
                                    new FillFlowContainer
                                    {
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Width            = content_width,
                                        Padding          = new MarginPadding {
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                Text   = @"Gameplay Mods",
                                                Font   = OsuFont.GetFont(size: 22, weight: FontWeight.Bold),
                                                Shadow = true,
                                                Margin = new MarginPadding
                                                {
                                                    Bottom = 4,
                                                },
                                            },
                                            new OsuTextFlowContainer(text =>
                                            {
                                                text.Font   = text.Font.With(size: 18);
                                                text.Shadow = true;
                                            })
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Text             = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    // Body
                                    new OsuScrollContainer
                                    {
                                        ScrollbarVisible = false,
                                        Origin           = Anchor.TopCentre,
                                        Anchor           = Anchor.TopCentre,
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical   = 10,
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            ModSectionsContainer = new FillFlowContainer <ModSection>
                                            {
                                                Origin           = Anchor.TopCentre,
                                                Anchor           = Anchor.TopCentre,
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Spacing          = new Vector2(0f, 10f),
                                                Width            = content_width,
                                                LayoutDuration   = 200,
                                                LayoutEasing     = Easing.OutQuint,
                                                Children         = new ModSection[]
                                                {
                                                    new DifficultyReductionSection {
                                                        Action = modButtonPressed
                                                    },
                                                    new DifficultyIncreaseSection {
                                                        Action = modButtonPressed
                                                    },
                                                    new AutomationSection {
                                                        Action = modButtonPressed
                                                    },
                                                    new ConversionSection {
                                                        Action = modButtonPressed
                                                    },
                                                    new FunSection {
                                                        Action = modButtonPressed
                                                    },
                                                }
                                            },
                                        }
                                    },
                                    ModSettingsContainer = new ModSettingsContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Anchor           = Anchor.BottomRight,
                                        Origin           = Anchor.BottomRight,
                                        Width            = 0.3f,
                                        Alpha            = 0,
                                        Padding          = new MarginPadding(30),
                                        SelectedMods     = { BindTarget = SelectedMods },
                                    },
                                }
                            },
                        },
                        new Drawable[]
                        {
                            // Footer
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Color4(172, 20, 116, 255),
                                        Alpha            = 0.5f,
                                    },
                                    footerContainer = new FillFlowContainer
                                    {
                                        Origin           = Anchor.BottomCentre,
                                        Anchor           = Anchor.BottomCentre,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = content_width,
                                        Spacing          = new Vector2(footer_button_spacing, footer_button_spacing / 2),
                                        LayoutDuration   = 100,
                                        LayoutEasing     = Easing.OutQuint,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical   = 15,
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            DeselectAllButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Deselect All",
                                                Action = deselectAll,
                                                Origin = Anchor.CentreLeft,
                                                Anchor = Anchor.CentreLeft,
                                            },
                                            CustomiseButton = new TriangleButton
                                            {
                                                Width   = 180,
                                                Text    = "Customisation",
                                                Action  = () => ModSettingsContainer.ToggleVisibility(),
                                                Enabled = { Value = false },
                                                Origin  = Anchor.CentreLeft,
                                                Anchor  = Anchor.CentreLeft,
                                            },
                                            CloseButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Close",
                                                Action = Hide,
                                                Origin = Anchor.CentreLeft,
                                                Anchor = Anchor.CentreLeft,
                                            },
                                            new FillFlowContainer
                                            {
                                                AutoSizeAxes = Axes.Both,
                                                Spacing      = new Vector2(footer_button_spacing / 2, 0),
                                                Origin       = Anchor.CentreLeft,
                                                Anchor       = Anchor.CentreLeft,
                                                Children     = new Drawable[]
                                                {
                                                    new OsuSpriteText
                                                    {
                                                        Text   = @"Score Multiplier:",
                                                        Font   = OsuFont.GetFont(size: 30),
                                                        Origin = Anchor.CentreLeft,
                                                        Anchor = Anchor.CentreLeft,
                                                    },
                                                    MultiplierLabel = new OsuSpriteText
                                                    {
                                                        Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                        Origin = Anchor.CentreLeft,
                                                        Anchor = Anchor.CentreLeft,
                                                        Width  = 70, // make width fixed so reflow doesn't occur when multiplier number changes.
                                                    },
                                                },
                                            },
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
            };

            ((IBindable <bool>)CustomiseButton.Enabled).BindTo(ModSettingsContainer.HasSettingsForSelection);
        }
示例#11
0
                    public SeedingBeatmapRow(SeedingResult result, SeedingBeatmap beatmap)
                    {
                        this.result = result;
                        Model       = beatmap;

                        Margin = new MarginPadding(10);

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

                        Masking      = true;
                        CornerRadius = 5;

                        InternalChildren = new Drawable[]
                        {
                            new Box
                            {
                                Colour           = OsuColour.Gray(0.2f),
                                RelativeSizeAxes = Axes.Both,
                            },
                            new FillFlowContainer
                            {
                                Margin  = new MarginPadding(5),
                                Padding = new MarginPadding {
                                    Right = 160
                                },
                                Spacing      = new Vector2(5),
                                Direction    = FillDirection.Horizontal,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new SettingsNumberBox
                                    {
                                        LabelText        = "Beatmap ID",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Current          = beatmapId,
                                    },
                                    new SettingsSlider <int>
                                    {
                                        LabelText        = "Seed",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Current          = beatmap.Seed
                                    },
                                    new SettingsTextBox
                                    {
                                        LabelText        = "Score",
                                        RelativeSizeAxes = Axes.None,
                                        Width            = 200,
                                        Current          = score,
                                    },
                                    drawableContainer = new Container
                                    {
                                        Size = new Vector2(100, 70),
                                    },
                                }
                            },
                            new DangerousSettingsButton
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                RelativeSizeAxes = Axes.None,
                                Width            = 150,
                                Text             = "Delete Beatmap",
                                Action           = () =>
                                {
                                    Expire();
                                    result.Beatmaps.Remove(beatmap);
                                },
                            }
                        };
                    }
示例#12
0
        public FilterControl()
        {
            Children = new Drawable[]
            {
                Background = new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    RelativeSizeAxes = Axes.Both,
                },
                new Container
                {
                    Padding          = new MarginPadding(20),
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.5f,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Children         = new Drawable[]
                    {
                        searchTextBox = new SearchTextBox
                        {
                            RelativeSizeAxes = Axes.X,
                            Exit             = () => Exit?.Invoke(),
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 1,
                            Colour           = OsuColour.Gray(80),
                            Origin           = Anchor.BottomLeft,
                            Anchor           = Anchor.BottomLeft,
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            Direction        = FillDirection.Horizontal,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                groupTabs = new OsuTabControl <GroupMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 24,
                                    Width            = 0.5f,
                                    AutoSort         = true
                                },
                                //spriteText = new OsuSpriteText
                                //{
                                //    Font = @"Exo2.0-Bold",
                                //    Text = "Sort results by",
                                //    Size = 14,
                                //    Margin = new MarginPadding
                                //    {
                                //        Top = 5,
                                //        Bottom = 5
                                //    },
                                //},
                                sortTabs = new OsuTabControl <SortMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Width            = 0.5f,
                                    Height           = 24,
                                    AutoSort         = true,
                                }
                            }
                        },
                    }
                }
            };

            searchTextBox.Current.ValueChanged += t => FilterChanged?.Invoke(CreateCriteria());

            groupTabs.PinItem(GroupMode.All);
            groupTabs.PinItem(GroupMode.RecentlyPlayed);
            groupTabs.Current.ValueChanged += val => Group = val;
            sortTabs.Current.ValueChanged  += val => Sort = val;
        }
示例#13
0
        public SimpleNotification()
        {
            IconContent.Add(new Drawable[]
            {
                IconBackgound = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    ColourInfo       = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.6f))
                },
                iconDrawable = new TextAwesome
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Icon     = icon,
                    TextSize = 20
                }
            });

            Content.Add(textDrawable = new OsuSpriteText
            {
                TextSize         = 16,
                Colour           = OsuColour.Gray(128),
                AutoSizeAxes     = Axes.Y,
                RelativeSizeAxes = Axes.X,
                Text             = text
            });
        }
示例#14
0
        private void load(OverlayColourProvider colourProvider)
        {
            LinkFlowContainer        username;
            FillFlowContainer        info;
            CommentMarkdownContainer message;
            GridContainer            content;
            VotePill votePill;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            InternalChildren = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = getPadding(Comment.IsTopLevel),
                    Child            = new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                        Children         = new Drawable[]
                        {
                            content = new GridContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                ColumnDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.Absolute, size: avatar_size + 10),
                                    new Dimension(),
                                },
                                RowDimensions = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize)
                                },
                                Content = new[]
                                {
                                    new Drawable[]
                                    {
                                        new Container
                                        {
                                            Size     = new Vector2(avatar_size),
                                            Children = new Drawable[]
                                            {
                                                new UpdateableAvatar(Comment.User)
                                                {
                                                    Size           = new Vector2(avatar_size),
                                                    Masking        = true,
                                                    CornerRadius   = avatar_size / 2f,
                                                    CornerExponent = 2,
                                                },
                                                votePill = new VotePill(Comment)
                                                {
                                                    Anchor = Anchor.CentreLeft,
                                                    Origin = Anchor.CentreRight,
                                                    Margin = new MarginPadding
                                                    {
                                                        Right = 5
                                                    }
                                                }
                                            }
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 4),
                                            Margin           = new MarginPadding
                                            {
                                                Vertical = 2
                                            },
                                            Children = new Drawable[]
                                            {
                                                new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Horizontal,
                                                    Spacing      = new Vector2(10, 0),
                                                    Children     = new Drawable[]
                                                    {
                                                        username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold))
                                                        {
                                                            AutoSizeAxes = Axes.Both
                                                        },
                                                        new ParentUsername(Comment),
                                                        new OsuSpriteText
                                                        {
                                                            Alpha = Comment.IsDeleted ? 1 : 0,
                                                            Font  = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
                                                            Text  = "deleted"
                                                        }
                                                    }
                                                },
                                                message = new CommentMarkdownContainer
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    DocumentMargin   = new MarginPadding(0),
                                                    DocumentPadding  = new MarginPadding(0),
                                                },
                                                info = new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Horizontal,
                                                    Spacing      = new Vector2(10, 0),
                                                    Children     = new Drawable[]
                                                    {
                                                        new DrawableDate(Comment.CreatedAt, 12, false)
                                                        {
                                                            Colour = colourProvider.Foreground1
                                                        }
                                                    }
                                                },
                                                new Container
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Children     = new Drawable[]
                                                    {
                                                        showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
                                                        {
                                                            Expanded = { BindTarget = childrenExpanded }
                                                        },
                                                        loadRepliesButton = new LoadRepliesButton
                                                        {
                                                            Action = () => RepliesRequested(this, ++currentPage)
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            childCommentsVisibilityContainer = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Direction        = FillDirection.Vertical,
                                Padding          = new MarginPadding {
                                    Left = 20
                                },
                                Children = new Drawable[]
                                {
                                    childCommentsContainer = new FillFlowContainer
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical
                                    },
                                    deletedCommentsCounter = new DeletedCommentsCounter
                                    {
                                        ShowDeleted = { BindTarget = ShowDeleted },
                                        Margin      = new MarginPadding
                                        {
                                            Top = 10
                                        }
                                    },
                                    showMoreButton = new ShowMoreRepliesButton
                                    {
                                        Action = () => RepliesRequested(this, ++currentPage)
                                    }
                                }
                            },
                        }
                    }
                },
                new Container
                {
                    Size   = new Vector2(70, 40),
                    Anchor = Anchor.TopRight,
                    Origin = Anchor.TopRight,
                    Margin = new MarginPadding {
                        Horizontal = 5
                    },
                    Child = chevronButton = new ChevronButton
                    {
                        Anchor   = Anchor.CentreLeft,
                        Origin   = Anchor.CentreLeft,
                        Expanded = { BindTarget = childrenExpanded },
                        Alpha    = 0
                    }
                }
            };

            if (Comment.UserId.HasValue)
            {
                username.AddUserLink(Comment.User);
            }
            else
            {
                username.AddText(Comment.LegacyName);
            }

            if (Comment.EditedAt.HasValue)
            {
                var font   = OsuFont.GetFont(size: 12, weight: FontWeight.Regular);
                var colour = colourProvider.Foreground1;

                info.Add(new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Font   = font,
                            Text   = "edited ",
                            Colour = colour
                        },
                        new DrawableDate(Comment.EditedAt.Value)
                        {
                            Font   = font,
                            Colour = colour
                        },
                        new OsuSpriteText
                        {
                            Font   = font,
                            Text   = $@" by {Comment.EditedUser.Username}",
                            Colour = colour
                        },
                    }
                });
            }

            if (Comment.HasMessage)
            {
                message.Text = Comment.Message;
            }

            if (Comment.IsDeleted)
            {
                content.FadeColour(OsuColour.Gray(0.5f));
                votePill.Hide();
            }

            if (Comment.IsTopLevel)
            {
                AddInternal(new Box
                {
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.X,
                    Height           = 1.5f,
                    Colour           = OsuColour.Gray(0.1f)
                });
            }

            if (Replies.Any())
            {
                onRepliesAdded(Replies);
            }

            Replies.CollectionChanged += (_, args) =>
            {
                switch (args.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    onRepliesAdded(args.NewItems.Cast <DrawableComment>());
                    break;

                default:
                    throw new NotSupportedException(@"You can only add replies to this list. Other actions are not supported.");
                }
            };
        }
示例#15
0
        public ToolbarButton()
        {
            Width            = WIDTH;
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                HoverBackground = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(80).Opacity(180),
                    BlendingMode     = BlendingMode.Additive,
                    Alpha            = 0,
                },
                Flow = new FillFlowContainer
                {
                    Direction = FillDirection.Horizontal,
                    Spacing   = new Vector2(5),
                    Anchor    = Anchor.TopCentre,
                    Origin    = Anchor.TopCentre,
                    Padding   = new MarginPadding {
                        Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2
                    },
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        DrawableIcon = new TextAwesome
                        {
                            Anchor   = Anchor.Centre,
                            Origin   = Anchor.Centre,
                            TextSize = 20
                        },
                        DrawableText = new OsuSpriteText
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                        },
                    },
                },
                tooltipContainer = new FillFlowContainer
                {
                    Direction        = FillDirection.Vertical,
                    RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
                    Anchor           = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
                    Origin           = TooltipAnchor,
                    Position         = new Vector2((TooltipAnchor & Anchor.x0) > 0 ? 5 : -5, 5),
                    Alpha            = 0,
                    Children         = new[]
                    {
                        tooltip1 = new OsuSpriteText
                        {
                            Anchor   = TooltipAnchor,
                            Origin   = TooltipAnchor,
                            Shadow   = true,
                            TextSize = 22,
                            Font     = @"Exo2.0-Bold",
                        },
                        tooltip2 = new OsuSpriteText
                        {
                            Anchor   = TooltipAnchor,
                            Origin   = TooltipAnchor,
                            Shadow   = true,
                            TextSize = 16
                        }
                    }
                }
            };
        }
示例#16
0
 private void load(OsuColour colour)
 {
     BackgroundUnfocused = Color4.Black.Opacity(0.5f);
     BackgroundFocused   = OsuColour.Gray(0.3f).Opacity(0.8f);
     BackgroundCommit    = BorderColour = colour.Yellow;
 }
示例#17
0
        private void load(Storage storage)
        {
            var stream = storage.GetStream($@"videos/{filename}.m4v");

            if (stream != null)
            {
                InternalChild = video = new VideoSprite(stream)
                {
                    RelativeSizeAxes = Axes.Both,
                    FillMode         = FillMode.Fit,
                    Clock            = new FramedClock(manualClock = new ManualClock()),
                    Loop             = loop,
                };
            }
            else if (drawFallbackGradient)
            {
                InternalChild = new Box
                {
                    Colour           = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
                    RelativeSizeAxes = Axes.Both,
                };
            }
        }
示例#18
0
        public ModSelectOverlay()
        {
            Waves.FirstWaveColour  = OsuColour.FromHex(@"19b0e2");
            Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = OsuColour.FromHex(@"005774");
            Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");

            Height  = 510;
            Padding = new MarginPadding
            {
                Left  = -overflow_padding,
                Right = -overflow_padding
            };

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(36, 50, 68, 255)
                        },
                        new Triangles
                        {
                            TriangleScale    = 5,
                            RelativeSizeAxes = Axes.X,
                            Height           = Height, //set the height from the start to ensure correct triangle density.
                            ColourLight      = new Color4(53, 66, 82, 255),
                            ColourDark       = new Color4(41, 54, 70, 255),
                        },
                    },
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Absolute, 90),
                        new Dimension(GridSizeMode.Distributed),
                        new Dimension(GridSizeMode.Absolute, 70),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.Gray(10).Opacity(100),
                                    },
                                    new FillFlowContainer
                                    {
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Width            = content_width,
                                        Padding          = new MarginPadding
                                        {
                                            Left  = overflow_padding,
                                            Right = overflow_padding
                                        },
                                        Children = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                Font     = @"Exo2.0-Bold",
                                                Text     = @"Gameplay Mods",
                                                TextSize = 22,
                                                Shadow   = true,
                                                Margin   = new MarginPadding
                                                {
                                                    Bottom = 4,
                                                },
                                            },
                                            new OsuTextFlowContainer(text =>
                                            {
                                                text.TextSize = 18;
                                                text.Shadow   = true;
                                            })
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Text             = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Body
                            new OsuScrollContainer
                            {
                                ScrollbarVisible = false,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical = 10,
                                    Left     = overflow_padding,
                                    Right    = overflow_padding
                                },
                                Child = ModSectionsContainer = new FillFlowContainer <ModSection>
                                {
                                    Origin           = Anchor.TopCentre,
                                    Anchor           = Anchor.TopCentre,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Spacing          = new Vector2(0f, 10f),
                                    Width            = content_width,
                                    Children         = new ModSection[]
                                    {
                                        new DifficultyReductionSection {
                                            Action = modButtonPressed
                                        },
                                        new DifficultyIncreaseSection {
                                            Action = modButtonPressed
                                        },
                                        new AutomationSection {
                                            Action = modButtonPressed
                                        },
                                        new ConversionSection {
                                            Action = modButtonPressed
                                        },
                                        new FunSection {
                                            Action = modButtonPressed
                                        },
                                    }
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Footer
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Color4(172, 20, 116, 255),
                                        Alpha            = 0.5f,
                                    },
                                    footerContainer = new FillFlowContainer
                                    {
                                        Origin           = Anchor.BottomCentre,
                                        Anchor           = Anchor.BottomCentre,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = content_width,
                                        Direction        = FillDirection.Horizontal,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical = 15,
                                            Left     = overflow_padding,
                                            Right    = overflow_padding
                                        },
                                        Children = new Drawable[]
                                        {
                                            DeselectAllButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Deselect All",
                                                Action = DeselectAll,
                                                Margin = new MarginPadding
                                                {
                                                    Right = 20
                                                }
                                            },
                                            new OsuSpriteText
                                            {
                                                Text     = @"Score Multiplier:",
                                                TextSize = 30,
                                                Margin   = new MarginPadding
                                                {
                                                    Top   = 5,
                                                    Right = 10
                                                }
                                            },
                                            MultiplierLabel = new OsuSpriteText
                                            {
                                                Font     = @"Exo2.0-Bold",
                                                TextSize = 30,
                                                Margin   = new MarginPadding
                                                {
                                                    Top = 5
                                                }
                                            },
                                            UnrankedLabel = new OsuSpriteText
                                            {
                                                Font     = @"Exo2.0-Bold",
                                                Text     = @"(Unranked)",
                                                TextSize = 30,
                                                Margin   = new MarginPadding
                                                {
                                                    Top  = 5,
                                                    Left = 10
                                                }
                                            }
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
            };
        }
示例#19
0
        public DialogButton()
        {
            RelativeSizeAxes = Axes.X;

            Children = new Drawable[]
            {
                backgroundContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Width = 1f,
                    Children = new Drawable[]
                    {
                        background = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = backgroundColour,
                        },
                    },
                },
                glowContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Width = 1f,
                    Alpha = 0f,
                    Children = new Drawable[]
                    {
                        leftGlow = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Origin = Anchor.TopLeft,
                            Anchor = Anchor.TopLeft,
                            Width = 0.125f,
                        },
                        centerGlow = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre,
                            Width = 0.75f,
                        },
                        rightGlow = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Origin = Anchor.TopRight,
                            Anchor = Anchor.TopRight,
                            Width = 0.125f,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.Centre,
                    Masking = true,
                    Children = new Drawable[]
                    {
                        colourContainer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre,
                            Width = 0.8f,
                            Masking = true,
                            MaskingSmoothness = 2,
                            EdgeEffect = new EdgeEffect
                            {
                                Type = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.2f),
                                Radius = 5,
                            },
                            Colour = ButtonColour,
                            Shear = new Vector2(0.2f, 0),
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    EdgeSmoothness = new Vector2(2, 0),
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Masking = true,
                                    MaskingSmoothness = 0,
                                    Children = new[]
                                    {
                                        new Triangles
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            TriangleScale = 4,
                                            ColourDark = OsuColour.Gray(0.88f),
                                            Shear = new Vector2(-0.2f, 0),
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                spriteText = new OsuSpriteText
                {
                    Text = Text,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    TextSize = 28,
                    Font = "Exo2.0-Bold",
                    Shadow = true,
                    ShadowColour = new Color4(0, 0, 0, 0.1f),
                    Colour = Color4.White,
                },
            };

            updateGlow();
        }
示例#20
0
 public GroupSortTabs()
 {
     RelativeSizeAxes = Axes.X;
     AutoSizeAxes     = Axes.Y;
     Children         = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.X,
             Height           = 1,
             Colour           = OsuColour.Gray(80),
             Origin           = Anchor.BottomLeft,
             Anchor           = Anchor.BottomLeft,
         },
         new FlowContainer
         {
             AutoSizeAxes = Axes.Both,
             Direction    = FlowDirections.Horizontal,
             Spacing      = new Vector2(10, 0),
             Children     = new Drawable[]
             {
                 new TabItem
                 {
                     Text   = "All",
                     Active = true,
                 },
                 new TabItem
                 {
                     Text   = "Recently Played",
                     Active = false,
                 },
                 new TabItem
                 {
                     Text   = "Collections",
                     Active = false,
                 },
                 groupsEllipsis = new TextAwesome
                 {
                     Icon     = FontAwesome.fa_ellipsis_h,
                     TextSize = 14,
                     Margin   = new MarginPadding {
                         Top = 5, Bottom = 5
                     },
                     Origin = Anchor.BottomLeft,
                     Anchor = Anchor.BottomLeft,
                 }
             }
         },
         new FlowContainer
         {
             AutoSizeAxes = Axes.Both,
             Direction    = FlowDirections.Horizontal,
             Spacing      = new Vector2(10, 0),
             Origin       = Anchor.TopRight,
             Anchor       = Anchor.TopRight,
             Children     = new Drawable[]
             {
                 sortLabel = new OsuSpriteText
                 {
                     Font     = @"Exo2.0-Bold",
                     Text     = "Sort results by",
                     TextSize = 14,
                     Margin   = new MarginPadding {
                         Top = 5, Bottom = 5
                     },
                 },
                 new TabItem
                 {
                     Text   = "Artist",
                     Active = true,
                 },
                 sortEllipsis = new TextAwesome
                 {
                     Icon     = FontAwesome.fa_ellipsis_h,
                     TextSize = 14,
                     Margin   = new MarginPadding {
                         Top = 5, Bottom = 5
                     },
                     Origin = Anchor.BottomLeft,
                     Anchor = Anchor.BottomLeft,
                 }
             }
         },
     };
 }
示例#21
0
 protected override void OnHoverLost(InputState state)
 {
     this.FadeColour(OsuColour.Gray(0.2f), 200);
     base.OnHoverLost(state);
 }
示例#22
0
 protected override void OnHoverLost(HoverLostEvent e)
 {
     this.FadeColour(OsuColour.Gray(0.2f), 200);
     base.OnHoverLost(e);
 }
        protected override void PopIn()
        {
            DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);

            this.FadeIn(FADE_DURATION, Easing.OutQuint);
        }
示例#24
0
        protected DrawableScore(Score score)
        {
            Score = score;

            RelativeSizeAxes = Axes.X;
            Height           = 60;
            Children         = new Drawable[]
            {
                background = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    CornerRadius     = 3,
                    Alpha            = 0,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type   = EdgeEffectType.Shadow,
                        Offset = new Vector2(0f, 1f),
                        Radius = 1f,
                        Colour = Color4.Black.Opacity(0.2f),
                    },
                    Child = coloredBackground = new Box {
                        RelativeSizeAxes = Axes.Both
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Width            = 0.97f,
                    Children         = new Drawable[]
                    {
                        underscoreLine = new Box
                        {
                            Anchor           = Anchor.BottomCentre,
                            Origin           = Anchor.BottomCentre,
                            RelativeSizeAxes = Axes.X,
                            Height           = 1,
                        },
                        new DrawableRank(score.Rank)
                        {
                            RelativeSizeAxes = Axes.Y,
                            Width            = 60,
                            FillMode         = FillMode.Fit,
                        },
                        Stats = new FillFlowContainer <OsuSpriteText>
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Anchor           = Anchor.CentreRight,
                            Origin           = Anchor.CentreRight,
                            Direction        = FillDirection.Vertical,
                        },
                        metadata = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Anchor           = Anchor.CentreLeft,
                            Origin           = Anchor.CentreLeft,
                            Margin           = new MarginPadding {
                                Left = 70
                            },
                            Direction = FillDirection.Vertical,
                            Child     = new OsuSpriteText
                            {
                                Text     = score.Date.LocalDateTime.ToShortDateString(),
                                TextSize = 11,
                                Colour   = OsuColour.Gray(0xAA),
                                Depth    = -1,
                            },
                        },
                        modContainer = new ModContainer
                        {
                            AutoSizeAxes = Axes.Y,
                            Anchor       = Anchor.CentreRight,
                            Origin       = Anchor.CentreRight,
                            Width        = 60,
                            Margin       = new MarginPadding {
                                Right = 160
                            }
                        }
                    }
                },
            };
        }
示例#25
0
 public TourneyVideo(Stream stream)
 {
     if (stream == null)
     {
         InternalChild = new Box
         {
             Colour           = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
             RelativeSizeAxes = Axes.Both,
         };
     }
     else
     {
         InternalChild = video = new VideoSprite(stream)
         {
             RelativeSizeAxes = Axes.Both,
             FillMode         = FillMode.Fit,
             Clock            = new FramedClock(manualClock = new ManualClock())
         }
     };
 }
示例#26
0
 protected override void LoadComplete()
 {
     base.LoadComplete();
     isVoted.Value    = comment.IsVoted;
     votesCount.Value = comment.VotesCount;
     isVoted.BindValueChanged(voted => background.Colour    = voted.NewValue ? AccentColour : OsuColour.Gray(0.05f), true);
     votesCount.BindValueChanged(count => votesCounter.Text = $"+{count.NewValue}", true);
 }
示例#27
0
            public TeamRow(TournamentTeam team, TournamentScreen parent)
            {
                Model = team;

                Masking      = true;
                CornerRadius = 10;

                PlayerEditor playerEditor = new PlayerEditor(Model)
                {
                    Width = 0.95f
                };

                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        Colour           = OsuColour.Gray(0.1f),
                        RelativeSizeAxes = Axes.Both,
                    },
                    drawableContainer = new Container
                    {
                        Size   = new Vector2(100, 50),
                        Margin = new MarginPadding(10),
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                    },
                    new FillFlowContainer
                    {
                        Margin           = new MarginPadding(5),
                        Spacing          = new Vector2(5),
                        Direction        = FillDirection.Full,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            new SettingsTextBox
                            {
                                LabelText = "Name",
                                Width     = 0.2f,
                                Current   = Model.FullName
                            },
                            new SettingsTextBox
                            {
                                LabelText = "Acronym",
                                Width     = 0.2f,
                                Current   = Model.Acronym
                            },
                            new SettingsTextBox
                            {
                                LabelText = "Flag",
                                Width     = 0.2f,
                                Current   = Model.FlagName
                            },
                            new SettingsTextBox
                            {
                                LabelText = "Seed",
                                Width     = 0.2f,
                                Current   = Model.Seed
                            },
                            new SettingsSlider <int>
                            {
                                LabelText = "Last Year Placement",
                                Width     = 0.33f,
                                Current   = Model.LastYearPlacing
                            },
                            new SettingsButton
                            {
                                Width  = 0.11f,
                                Margin = new MarginPadding(10),
                                Text   = "Add player",
                                Action = () => playerEditor.CreateNew()
                            },
                            new DangerousSettingsButton
                            {
                                Width  = 0.11f,
                                Text   = "Delete Team",
                                Margin = new MarginPadding(10),
                                Action = () =>
                                {
                                    Expire();
                                    ladderInfo.Teams.Remove(Model);
                                },
                            },
                            playerEditor,
                            new SettingsButton
                            {
                                Width  = 0.2f,
                                Margin = new MarginPadding(10),
                                Text   = "Edit seeding results",
                                Action = () =>
                                {
                                    sceneManager?.SetScreen(new SeedingEditorScreen(team, parent));
                                }
                            },
                        }
                    },
                };

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

                Model.FlagName.BindValueChanged(updateDrawable, true);
            }
示例#28
0
        public void ShowUser(User user, bool fetchOnline = true)
        {
            userReq?.Cancel();
            Clear();
            lastSection = null;

            sections = new ProfileSection[]
            {
                //new AboutSection(),
                //new RecentSection(),
                new RanksSection(),
                //new MedalsSection(),
                new HistoricalSection(),
                new BeatmapsSection(),
                new KudosuSection()
            };
            tabs = new ProfileTabControl
            {
                RelativeSizeAxes = Axes.X,
                Anchor           = Anchor.TopCentre,
                Origin           = Anchor.TopCentre,
                Height           = 30
            };

            Add(new Box
            {
                RelativeSizeAxes = Axes.Both,
                Colour           = OsuColour.Gray(0.2f)
            });

            Header = new ProfileHeader(user);

            Add(sectionsContainer = new SectionsContainer <ProfileSection>
            {
                RelativeSizeAxes = Axes.Both,
                ExpandableHeader = Header,
                FixedHeader      = tabs,
                HeaderBackground = new Box
                {
                    Colour           = OsuColour.Gray(34),
                    RelativeSizeAxes = Axes.Both
                }
            });
            sectionsContainer.SelectedSection.ValueChanged += s =>
            {
                if (lastSection != s)
                {
                    lastSection        = s;
                    tabs.Current.Value = lastSection;
                }
            };

            tabs.Current.ValueChanged += s =>
            {
                if (lastSection == null)
                {
                    lastSection = sectionsContainer.Children.FirstOrDefault();
                    if (lastSection != null)
                    {
                        tabs.Current.Value = lastSection;
                    }
                    return;
                }
                if (lastSection != s)
                {
                    lastSection = s;
                    sectionsContainer.ScrollTo(lastSection);
                }
            };

            if (fetchOnline)
            {
                userReq          = new GetUserRequest(user.Id);
                userReq.Success += userLoadComplete;
                api.Queue(userReq);
            }
            else
            {
                userReq = null;
                userLoadComplete(user);
            }

            Show();
            sectionsContainer.ScrollToTop();
        }
示例#29
0
        private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics)
        {
            holdDelay      = config.GetBindable <double>(OsuSetting.UIHoldActivationDelay);
            loginDisplayed = statics.GetBindable <bool>(Static.LoginOverlayDisplayed);

            if (host.CanExit)
            {
                AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
                {
                    Action = () =>
                    {
                        if (holdDelay.Value > 0)
                        {
                            confirmAndExit();
                        }
                        else
                        {
                            this.Exit();
                        }
                    }
                });
            }

            AddRangeInternal(new[]
            {
                buttonsContainer = new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children       = new Drawable[]
                    {
                        Buttons = new ButtonSystem
                        {
                            OnEdit = delegate
                            {
                                Beatmap.SetDefault();
                                this.Push(new EditorLoader());
                            },
                            OnSolo        = loadSoloSongSelect,
                            OnMultiplayer = () => this.Push(new Multiplayer()),
                            OnPlaylists   = () => this.Push(new Playlists()),
                            OnExit        = confirmAndExit,
                        }
                    }
                },
                sideFlashes = new MenuSideFlashes(),
                songTicker  = new SongTicker
                {
                    Anchor = Anchor.TopRight,
                    Origin = Anchor.TopRight,
                    Margin = new MarginPadding {
                        Right = 15, Top = 5
                    }
                },
                exitConfirmOverlay?.CreateProxy() ?? Empty()
            });

            Buttons.StateChanged += state =>
            {
                switch (state)
                {
                case ButtonSystemState.Initial:
                case ButtonSystemState.Exit:
                    ApplyToBackground(b => b.FadeColour(Color4.White, 500, Easing.OutSine));
                    break;

                default:
                    ApplyToBackground(b => b.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine));
                    break;
                }
            };

            Buttons.OnSettings       = () => settings?.ToggleVisibility();
            Buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility();

            LoadComponentAsync(background = new BackgroundScreenDefault());
            preloadSongSelect();
        }
示例#30
0
        public ModSelectOverlay()
        {
            Waves.FirstWaveColour  = OsuColour.FromHex(@"19b0e2");
            Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = OsuColour.FromHex(@"005774");
            Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");

            Height  = 510;
            Padding = new MarginPadding {
                Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING
            };

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(36, 50, 68, 255)
                        },
                        new Triangles
                        {
                            TriangleScale    = 5,
                            RelativeSizeAxes = Axes.X,
                            Height           = Height, //set the height from the start to ensure correct triangle density.
                            ColourLight      = new Color4(53, 66, 82, 255),
                            ColourDark       = new Color4(41, 54, 70, 255),
                        },
                    },
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Absolute, 90),
                        new Dimension(GridSizeMode.Distributed),
                        new Dimension(GridSizeMode.Absolute, 70),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.Gray(10).Opacity(100),
                                    },
                                    new FillFlowContainer
                                    {
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Width            = content_width,
                                        Padding          = new MarginPadding {
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                Text   = @"Gameplay Mods",
                                                Font   = OsuFont.GetFont(size: 22, weight: FontWeight.Bold),
                                                Shadow = true,
                                                Margin = new MarginPadding
                                                {
                                                    Bottom = 4,
                                                },
                                            },
                                            new OsuTextFlowContainer(text =>
                                            {
                                                text.Font   = text.Font.With(size: 18);
                                                text.Shadow = true;
                                            })
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Text             = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Body
                            new OsuScrollContainer
                            {
                                ScrollbarVisible = false,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical   = 10,
                                    Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                },
                                Child = ModSectionsContainer = new FillFlowContainer <ModSection>
                                {
                                    Origin           = Anchor.TopCentre,
                                    Anchor           = Anchor.TopCentre,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Spacing          = new Vector2(0f, 10f),
                                    Width            = content_width,
                                    LayoutDuration   = 200,
                                    LayoutEasing     = Easing.OutQuint,
                                    Children         = new ModSection[]
                                    {
                                        new DifficultyReductionSection {
                                            Action = modButtonPressed
                                        },
                                        new DifficultyIncreaseSection {
                                            Action = modButtonPressed
                                        },
                                        new AutomationSection {
                                            Action = modButtonPressed
                                        },
                                        new ConversionSection {
                                            Action = modButtonPressed
                                        },
                                        new FunSection {
                                            Action = modButtonPressed
                                        },
                                    }
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Footer
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Color4(172, 20, 116, 255),
                                        Alpha            = 0.5f,
                                    },
                                    footerContainer = new FillFlowContainer
                                    {
                                        Origin           = Anchor.BottomCentre,
                                        Anchor           = Anchor.BottomCentre,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = content_width,
                                        Direction        = FillDirection.Horizontal,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical   = 15,
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            DeselectAllButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Deselect All",
                                                Action = DeselectAll,
                                                Margin = new MarginPadding
                                                {
                                                    Right = 20
                                                }
                                            },
                                            CustomiseButton = new TriangleButton
                                            {
                                                Width   = 180,
                                                Text    = "Customisation",
                                                Action  = () => ModSettingsContainer.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
                                                Enabled = { Value = false },
                                                Margin  = new MarginPadding
                                                {
                                                    Right = 20
                                                }
                                            },
                                            CloseButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Close",
                                                Action = Hide,
                                                Margin = new MarginPadding
                                                {
                                                    Right = 20
                                                }
                                            },
                                            new OsuSpriteText
                                            {
                                                Text   = @"Score Multiplier:",
                                                Font   = OsuFont.GetFont(size: 30),
                                                Margin = new MarginPadding
                                                {
                                                    Top   = 5,
                                                    Right = 10
                                                }
                                            },
                                            MultiplierLabel = new OsuSpriteText
                                            {
                                                Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                Margin = new MarginPadding
                                                {
                                                    Top = 5
                                                }
                                            },
                                            UnrankedLabel = new OsuSpriteText
                                            {
                                                Text   = @"(Unranked)",
                                                Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                Margin = new MarginPadding
                                                {
                                                    Top  = 5,
                                                    Left = 10
                                                }
                                            }
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
                ModSettingsContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomRight,
                    Origin           = Anchor.BottomRight,
                    Width            = 0.25f,
                    Alpha            = 0,
                    X        = -100,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(0, 0, 0, 192)
                        },
                        new OsuScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Child            = ModSettingsContent = new FillFlowContainer <ModControlSection>
                            {
                                Anchor           = Anchor.TopCentre,
                                Origin           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Spacing          = new Vector2(0f, 10f),
                                Padding          = new MarginPadding(20),
                            }
                        }
                    }
                }
            };
        }