Example #1
0
 public SpinnerSpmCounter()
 {
     Children = new Drawable[]
     {
         spmText = new OsuSpriteText
         {
             Anchor   = Anchor.TopCentre,
             Origin   = Anchor.TopCentre,
             Text     = @"0",
             Font     = @"Venera",
             TextSize = 24
         },
         new OsuSpriteText
         {
             Anchor   = Anchor.TopCentre,
             Origin   = Anchor.TopCentre,
             Text     = @"SPINS PER MINUTE",
             Font     = @"Venera",
             TextSize = 12,
             Y        = 30
         }
     };
 }
Example #2
0
        private void load(OverlayColourProvider colourProvider)
        {
            Child = new HomePanel
            {
                Child = text = new OsuSpriteText
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Margin = new MarginPadding {
                        Vertical = 20
                    },
                    Text = CommonStrings.ButtonsSeeMore
                }
            };

            IdleColour  = colourProvider.Light1;
            HoverColour = Color4.White;

            Action = () =>
            {
                overlay?.ShowFrontPage();
            };
        }
Example #3
0
 private void load(OverlayColourProvider colourProvider)
 {
     AutoSizeAxes = Axes.Both;
     Masking      = true;
     Children     = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = colourProvider.Background6
         },
         counter = new OsuSpriteText
         {
             Anchor = Anchor.Centre,
             Origin = Anchor.Centre,
             Margin = new MarginPadding {
                 Horizontal = 10, Bottom = 1
             },
             Font   = OsuFont.GetFont(size: 11.2f, weight: FontWeight.Bold),
             Colour = colourProvider.Foreground1
         }
     };
 }
Example #4
0
 public CounterPill()
 {
     AutoSizeAxes = Axes.Both;
     Alpha        = 0;
     Masking      = true;
     Children     = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = OsuColour.Gray(0.05f)
         },
         counter = new OsuSpriteText
         {
             Anchor = Anchor.Centre,
             Origin = Anchor.Centre,
             Margin = new MarginPadding {
                 Horizontal = 10, Vertical = 5
             },
             Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold)
         }
     };
 }
Example #5
0
            public KaraokeConfigHeaderTitle()
            {
                AutoSizeAxes = Axes.Both;

                InternalChildren = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        AutoSizeAxes = Axes.Both,
                        Spacing      = new Vector2(spacing, 0),
                        Direction    = FillDirection.Horizontal,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Font   = OsuFont.GetFont(size: 24),
                                Text   = "Karaoke"
                            },
                            dot = new OsuSpriteText
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Font   = OsuFont.GetFont(size: 24),
                                Text   = "·"
                            },
                            pageTitle = new OsuSpriteText
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Font   = OsuFont.GetFont(size: 24),
                            }
                        }
                    },
                };
            }
Example #6
0
        private void load(OsuColour colours)
        {
            SelectedColour   = colours.Green;
            DeselectedColour = SelectedColour.Opacity(0.5f);
            Text             = @"random";

            Action = () =>
            {
                if (rewindSearch)
                {
                    const double fade_time = 500;

                    OsuSpriteText rewindSpriteText;

                    TextContainer.Add(rewindSpriteText = new OsuSpriteText
                    {
                        Alpha         = 0,
                        Text          = @"rewind",
                        AlwaysPresent = true, // make sure the button is sized large enough to always show this
                        Anchor        = Anchor.Centre,
                        Origin        = Anchor.Centre,
                    });

                    rewindSpriteText.FadeOutFromOne(fade_time, Easing.In);
                    rewindSpriteText.MoveTo(Vector2.Zero).MoveTo(new Vector2(0, 10), fade_time, Easing.In);
                    rewindSpriteText.Expire();

                    SpriteText.FadeInFromZero(fade_time, Easing.In);

                    PreviousRandom.Invoke();
                }
                else
                {
                    NextRandom.Invoke();
                }
            };
        }
        public TestCaseHoldToConfirmOverlay()
        {
            bool fired = false;

            var firedText = new OsuSpriteText
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Text = "Fired!",
                Font = OsuFont.GetFont(size: 50),
                Alpha = 0,
            };

            var overlay = new TestHoldToConfirmOverlay
            {
                Action = () =>
                {
                    fired = true;
                    firedText.FadeTo(1).Then().FadeOut(1000);
                }
            };

            Children = new Drawable[]
            {
                overlay,
                firedText
            };

            AddStep("start confirming", () => overlay.Begin());
            AddStep("abort confirming", () => overlay.Abort());

            AddAssert("ensure aborted", () => !fired);

            AddStep("start confirming", () => overlay.Begin());

            AddUntilStep(() => fired, "wait until confirmed");
        }
        private void load(OsuColour colour)
        {
            var text = new OsuSpriteText
            {
                Text   = $"准确率: {Score.Accuracy:P2}",
                Anchor = Anchor.TopRight,
                Origin = Anchor.TopRight,
                Colour = colour.GrayA,
                Font   = OsuFont.GetFont(size: 13, weight: FontWeight.Regular, italics: true)
            };

            RightFlowContainer.Insert(1, text);

            LeftFlowContainer.Add(new ProfileScoreBeatmapMetadataContainer(Score.Beatmap));
            LeftFlowContainer.Add(new DrawableDate(Score.Date));

            foreach (Mod mod in Score.Mods)
            {
                modsContainer.Add(new ModIcon(mod)
                {
                    Scale = new Vector2(0.5f)
                });
            }
        }
Example #9
0
 public ScoreRankInfo(ScoreRank rank)
 {
     AutoSizeAxes  = Axes.Both;
     InternalChild = new FillFlowContainer
     {
         AutoSizeAxes = Axes.Y,
         Width        = 56,
         Direction    = FillDirection.Vertical,
         Children     = new Drawable[]
         {
             new DrawableRank(rank)
             {
                 RelativeSizeAxes = Axes.X,
                 Height           = 30,
             },
             rankCount = new OsuSpriteText
             {
                 Font   = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
                 Anchor = Anchor.TopCentre,
                 Origin = Anchor.TopCentre
             }
         }
     };
 }
Example #10
0
        private void load(OsuColour colours)
        {
            RelativeSizeAxes = Axes.Y;
            AutoSizeAxes     = Axes.X;

            Color4 colour = difficultyPoint.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    Colour           = colour,
                    Width            = 2,
                    RelativeSizeAxes = Axes.Y,
                },
                new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colour,
                            RelativeSizeAxes = Axes.Both,
                        },
                        speedMultiplierText = new OsuSpriteText
                        {
                            Font   = OsuFont.Default.With(weight: FontWeight.Bold),
                            Colour = Color4.White,
                        }
                    }
                },
            };

            speedMultiplier.BindValueChanged(multiplier => speedMultiplierText.Text = $"{multiplier.NewValue:n2}x", true);
        }
Example #11
0
        protected FillFlowContainer CreateStatusMessage(bool rightAlignedChildren)
        {
            var statusContainer = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Vertical
            };

            var alignment = rightAlignedChildren ? Anchor.CentreRight : Anchor.CentreLeft;

            statusContainer.Add(LastVisitMessage = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)).With(text =>
            {
                text.Anchor       = alignment;
                text.Origin       = alignment;
                text.AutoSizeAxes = Axes.Both;
                text.Alpha        = 0;

                if (User.LastVisit.HasValue)
                {
                    text.AddText(@"Last seen ");
                    text.AddText(new DrawableDate(User.LastVisit.Value, italic: false)
                    {
                        Shadow = false
                    });
                }
            }));

            statusContainer.Add(statusMessage = new OsuSpriteText
            {
                Anchor = alignment,
                Origin = alignment,
                Font   = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
            });

            return(statusContainer);
        }
Example #12
0
        public ParticipantCountDisplay()
        {
            AutoSizeAxes = Axes.Both;

            OsuSpriteText count;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes   = Axes.Both,
                Direction      = FillDirection.Horizontal,
                LayoutDuration = transition_duration,
                Children       = new[]
                {
                    count = new OsuSpriteText
                    {
                        TextSize = text_size,
                        Font     = @"Exo2.0-Bold"
                    },
                    slash = new OsuSpriteText
                    {
                        Text     = @"/",
                        TextSize = text_size,
                        Font     = @"Exo2.0-Light"
                    },
                    maxText = new OsuSpriteText
                    {
                        TextSize = text_size,
                        Font     = @"Exo2.0-Light"
                    },
                }
            };

            Participants.BindValueChanged(v => count.Text = v.Count().ToString());
            MaxParticipants.BindValueChanged(_ => updateMax(), true);
            ParticipantCount.BindValueChanged(v => count.Text = v.ToString("#,0"));
        }
Example #13
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[]
                        {
                            // 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.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.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
                                                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.
                                                    },
                                                },
                                            },
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
                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),
                            }
                        }
                    }
                }
            };
        }
Example #14
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            bool hasBackground = senderHasBackground;

            Drawable effectedUsername = username = new OsuSpriteText
            {
                Font     = @"Exo2.0-BoldItalic",
                Colour   = hasBackground ? customUsernameColour : username_colours[message.Sender.Id % username_colours.Length],
                TextSize = text_size,
            };

            if (hasBackground)
            {
                // Background effect
                effectedUsername = new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Masking      = true,
                    CornerRadius = 4,
                    EdgeEffect   = new EdgeEffectParameters
                    {
                        Roundness = 1,
                        Offset    = new Vector2(0, 3),
                        Radius    = 3,
                        Colour    = Color4.Black.Opacity(0.3f),
                        Type      = EdgeEffectType.Shadow,
                    },
                    // Drop shadow effect
                    Child = new Container
                    {
                        AutoSizeAxes = Axes.Both,
                        Masking      = true,
                        CornerRadius = 4,
                        EdgeEffect   = new EdgeEffectParameters
                        {
                            Radius = 1,
                            Colour = OsuColour.FromHex(message.Sender.Colour),
                            Type   = EdgeEffectType.Shadow,
                        },
                        Padding = new MarginPadding {
                            Left = 3, Right = 3, Bottom = 1, Top = -3
                        },
                        Y     = 3,
                        Child = username,
                    }
                };
            }

            Children = new Drawable[]
            {
                new Container
                {
                    Size     = new Vector2(message_padding, text_size),
                    Children = new Drawable[]
                    {
                        timestamp = new OsuSpriteText
                        {
                            Anchor     = Anchor.CentreLeft,
                            Origin     = Anchor.CentreLeft,
                            Font       = @"Exo2.0-SemiBold",
                            FixedWidth = true,
                            TextSize   = text_size * 0.75f,
                        },
                        new MessageSender(message.Sender)
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.TopRight,
                            Anchor       = Anchor.TopRight,
                            Child        = effectedUsername,
                        },
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Left = message_padding + padding
                    },
                    Children = new Drawable[]
                    {
                        contentFlow = new OsuTextFlowContainer(t => { t.TextSize = text_size; })
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                        }
                    }
                }
            };

            updateMessageContent();
            FinishTransforms(true);
        }
Example #15
0
        public TestCaseScrollingHitObjects()
        {
            OsuSpriteText             timeRangeText;
            SpeedAdjustmentCollection adjustmentCollection;

            timeRangeBindable = new BindableDouble(2000)
            {
                MinValue = 200,
                MaxValue = 4000,
            };

            SliderBar <double> timeRange;

            Add(timeRange = new BasicSliderBar <double>
            {
                Size           = new Vector2(200, 20),
                SelectionColor = Color4.Pink,
                KeyboardStep   = 100
            });

            Add(timeRangeText = new OsuSpriteText
            {
                X        = 210,
                TextSize = 16,
            });

            timeRange.Current.BindTo(timeRangeBindable);
            timeRangeBindable.ValueChanged += v => timeRangeText.Text = $"Visible Range: {v:#,#.#}";
            timeRangeBindable.ValueChanged += v => bottomLabel.Text = $"t minus {v:#,#}";

            AddRange(new Drawable[]
            {
                new Container
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Size     = new Vector2(100, 500),
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Alpha            = 0.25f
                        },
                        adjustmentCollection = new SpeedAdjustmentCollection(Axes.Y)
                        {
                            RelativeSizeAxes = Axes.Both,
                            VisibleTimeRange = timeRangeBindable,
                            Masking          = true,
                        },
                        new OsuSpriteText
                        {
                            Text     = "t minus 0",
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.TopRight,
                        },
                        bottomLabel = new OsuSpriteText
                        {
                            Text     = "t minus x",
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.BottomRight,
                            Origin   = Anchor.BottomLeft,
                        },
                        topTime = new OsuSpriteText
                        {
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.TopLeft,
                            Origin   = Anchor.TopRight,
                        },
                        bottomTime = new OsuSpriteText
                        {
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.BottomLeft,
                            Origin   = Anchor.BottomRight,
                        },
                    }
                }
            });

            timeRangeBindable.TriggerChange();

            adjustmentCollection.Add(new TestSpeedAdjustmentContainer(new MultiplierControlPoint()));

            AddStep("Add hit object", () => adjustmentCollection.Add(new TestDrawableHitObject(new HitObject {
                StartTime = Time.Current + 2000
            })));
        }
Example #16
0
        private void load(TextureStore textures, Storage storage)
        {
            this.storage = storage;

            TextureStore flagStore = new TextureStore();

            // Local flag store
            flagStore.AddStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(new StorageBackedResourceStore(storage), "Drawings")));
            // Default texture store
            flagStore.AddStore(textures);

            dependencies.Cache(flagStore);

            if (TeamList == null)
            {
                TeamList = new StorageBackedTeamList(storage);
            }

            if (!TeamList.Teams.Any())
            {
                Exit();
                return;
            }

            drawingsConfig = new DrawingsConfigManager(storage);

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Color4(77, 77, 77, 255)
                },
                new Sprite
                {
                    RelativeSizeAxes = Axes.Both,
                    FillMode         = FillMode.Fill,
                    Texture          = textures.Get(@"Backgrounds/Drawings/background.png")
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Horizontal,

                    Children = new Drawable[]
                    {
                        // Main container
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.85f,

                            Children = new Drawable[]
                            {
                                // Visualiser
                                new VisualiserContainer
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,

                                    RelativeSizeAxes = Axes.X,
                                    Size             = new Vector2(1, 10),

                                    Colour = new Color4(255, 204, 34, 255),

                                    Lines = 6
                                },
                                // Groups
                                groupsContainer = new GroupContainer(drawingsConfig.Get <int>(DrawingsConfig.Groups), drawingsConfig.Get <int>(DrawingsConfig.TeamsPerGroup))
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,

                                    RelativeSizeAxes = Axes.Y,
                                    AutoSizeAxes     = Axes.X,

                                    Padding = new MarginPadding
                                    {
                                        Top    = 35f,
                                        Bottom = 35f
                                    }
                                },
                                // Scrolling teams
                                teamsContainer = new ScrollingTeamContainer
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,

                                    RelativeSizeAxes = Axes.X,
                                },
                                // Scrolling team name
                                fullTeamNameText = new OsuSpriteText
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.TopCentre,

                                    Position = new Vector2(0, 45f),

                                    Alpha = 0,

                                    Font     = "Exo2.0-Light",
                                    TextSize = 42f
                                }
                            }
                        },
                        // Control panel container
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.15f,

                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = new Color4(54, 54, 54, 255)
                                },
                                new OsuSpriteText
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,

                                    Text     = "Control Panel",
                                    TextSize = 22f,
                                    Font     = "Exo2.0-Bold"
                                },
                                new FillFlowContainer
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,

                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Width            = 0.75f,

                                    Position = new Vector2(0, 35f),

                                    Direction = FillDirection.Vertical,
                                    Spacing   = new Vector2(0, 5f),

                                    Children = new Drawable[]
                                    {
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Begin random",
                                            Action = teamsContainer.StartScrolling,
                                        },
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Stop random",
                                            Action = teamsContainer.StopScrolling,
                                        },
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Reload",
                                            Action = reloadTeams
                                        }
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Anchor = Anchor.BottomCentre,
                                    Origin = Anchor.BottomCentre,

                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Width            = 0.75f,

                                    Position = new Vector2(0, -5f),

                                    Direction = FillDirection.Vertical,
                                    Spacing   = new Vector2(0, 5f),

                                    Children = new Drawable[]
                                    {
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Reset",
                                            Action = () => reset()
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            teamsContainer.OnSelected      += onTeamSelected;
            teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200);

            reset(true);
        }
Example #17
0
        private void load(OsuColour colours)
        {
            Add(new Container
            {
                Size         = new Vector2(120, 20),
                CornerRadius = 10,
                Masking      = true,
                Margin       = new MarginPadding {
                    Left = circleSize + 10
                },
                Origin   = Anchor.CentreLeft,
                Anchor   = Anchor.CentreLeft,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colours.Gray1,
                        Alpha            = 0.9f,
                    },
                    new OsuSpriteText
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Font   = "Exo2.0-Bold",
                        Text   = name
                    }
                }
            });

            CircularProgress bgProgress;

            Add(new CircularContainer
            {
                Masking  = true,
                Size     = new Vector2(circleSize),
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colours.Gray1,
                        Alpha            = 0.9f,
                    },
                    bgProgress = new CircularProgress
                    {
                        RelativeSizeAxes = Axes.Both,
                        InnerRadius      = 0.05f,
                        Rotation         = 180,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Colour           = colours.Gray2,
                        Size             = new Vector2(0.8f)
                    },
                    (volumeCircle = new CircularProgress
                    {
                        RelativeSizeAxes = Axes.Both,
                        InnerRadius = 0.05f,
                        Rotation = 180,
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Size = new Vector2(0.8f)
                    }).WithEffect(new GlowEffect
                    {
                        Colour   = meterColour,
                        Strength = 2
                    }),
                    maxGlow = (text = new OsuSpriteText
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Font = "Venera",
                        TextSize = 0.16f * circleSize
                    }).WithEffect(new GlowEffect
                    {
                        Colour    = Color4.Transparent,
                        PadExtent = true,
                    })
                }
            });

            Bindable.ValueChanged   += newVolume => { this.TransformTo("DisplayVolume", newVolume, 400, Easing.OutQuint); };
            bgProgress.Current.Value = 0.75f;
        }
Example #18
0
        private void load(OsuColour colours)
        {
            Color4 backgroundColour = colours.Gray1;

            CircularProgress bgProgress;

            const float progress_start_radius = 0.75f;
            const float progress_size         = 0.03f;
            const float progress_end_radius   = progress_start_radius + progress_size;

            const float blur_amount = 5;

            Children = new Drawable[]
            {
                new Container
                {
                    Size     = new Vector2(circleSize),
                    Children = new Drawable[]
                    {
                        new BufferedContainer
                        {
                            Alpha            = 0.9f,
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                new Circle
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = backgroundColour,
                                },
                                new CircularContainer
                                {
                                    Masking          = true,
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    RelativeSizeAxes = Axes.Both,
                                    Size             = new Vector2(progress_end_radius),
                                    Children         = new Drawable[]
                                    {
                                        bgProgress = new CircularProgress
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            RelativeSizeAxes = Axes.Both,
                                            Rotation         = 180,
                                            Colour           = backgroundColour,
                                        },
                                        new Container
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            Name             = "Progress under covers for smoothing",
                                            RelativeSizeAxes = Axes.Both,
                                            Rotation         = 180,
                                            Child            = volumeCircle = new CircularProgress
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                            }
                                        },
                                    }
                                },
                                new Circle
                                {
                                    Name             = "Inner Cover",
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = backgroundColour,
                                    Size             = new Vector2(progress_start_radius),
                                },
                                new Container
                                {
                                    Name             = "Progress overlay for glow",
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    RelativeSizeAxes = Axes.Both,
                                    Size             = new Vector2(progress_start_radius + progress_size / 1.5f),
                                    Rotation         = 180,
                                    Padding          = new MarginPadding(-Blur.KernelSize(blur_amount)),
                                    Child            = (volumeCircleGlow = new CircularProgress
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        InnerRadius = progress_size * 0.8f,
                                    }).WithEffect(new GlowEffect
                                    {
                                        Colour    = meterColour,
                                        BlurSigma = new Vector2(blur_amount),
                                        Strength  = 5,
                                        PadExtent = true
                                    }),
                                },
                            },
                        },
                        maxGlow = (text = new OsuSpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Font = "Venera",
                            TextSize = 0.16f * circleSize
                        }).WithEffect(new GlowEffect
                        {
                            Colour    = Color4.Transparent,
                            PadExtent = true,
                        })
                    }
                },
                new Container
                {
                    Size         = new Vector2(120, 20),
                    CornerRadius = 10,
                    Masking      = true,
                    Margin       = new MarginPadding {
                        Left = circleSize + 10
                    },
                    Origin   = Anchor.CentreLeft,
                    Anchor   = Anchor.CentreLeft,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Alpha            = 0.9f,
                            RelativeSizeAxes = Axes.Both,
                            Colour           = backgroundColour,
                        },
                        new OsuSpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Font   = "Exo2.0-Bold",
                            Text   = name
                        }
                    }
                }
            };
            Bindable.ValueChanged += newVolume =>
            {
                this.TransformTo("DisplayVolume",
                                 newVolume,
                                 400,
                                 Easing.OutQuint);
            };
            bgProgress.Current.Value = 0.75f;
        }
Example #19
0
 public UserRatings()
 {
     Children = new Drawable[]
     {
         header = new FillFlowContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Direction        = FillDirection.Vertical,
             Children         = new Drawable[]
             {
                 new OsuSpriteText
                 {
                     Anchor   = Anchor.TopCentre,
                     Origin   = Anchor.TopCentre,
                     Text     = "User Rating",
                     TextSize = 13,
                 },
                 ratingsBar = new Bar
                 {
                     RelativeSizeAxes = Axes.X,
                     Height           = 5,
                     Margin           = new MarginPadding {
                         Top = 5
                     },
                 },
                 new Container
                 {
                     RelativeSizeAxes = Axes.X,
                     AutoSizeAxes     = Axes.Y,
                     Children         = new[]
                     {
                         negativeRatings = new OsuSpriteText
                         {
                             Text     = "0",
                             TextSize = 13,
                         },
                         positiveRatings = new OsuSpriteText
                         {
                             Anchor   = Anchor.TopRight,
                             Origin   = Anchor.TopRight,
                             Text     = @"0",
                             TextSize = 13,
                         },
                     },
                 },
                 new OsuSpriteText
                 {
                     Anchor   = Anchor.TopCentre,
                     Origin   = Anchor.TopCentre,
                     Text     = "Rating Spread",
                     TextSize = 13,
                     Margin   = new MarginPadding {
                         Top = 10, Bottom = 5
                     },
                 },
             },
         },
         graphContainer = new Container
         {
             Anchor           = Anchor.BottomLeft,
             Origin           = Anchor.BottomLeft,
             RelativeSizeAxes = Axes.Both,
             Child            = graph = new BarGraph
             {
                 RelativeSizeAxes = Axes.Both,
             },
         },
     };
 }
Example #20
0
File: Header.cs Project: ljmf00/osu
        public Header()
        {
            RelativeSizeAxes = Axes.X;
            Height           = 400;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Colour = Color4.Black.Opacity(0.25f),
                Type   = EdgeEffectType.Shadow,
                Radius = 3,
                Offset = new Vector2(0f, 1f),
            };
            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = tabs_height,
                    Children         = new[]
                    {
                        tabsBg = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = tabs_height
                    },
                    Children = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                },
                                coverContainer = new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.8f)),
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 20, Bottom = 30, Horizontal = BeatmapSetOverlay.X_PADDING
                            },
                            Child = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 113,
                                        Child            = Picker = new BeatmapPicker(),
                                    },
                                    title = new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-BoldItalic",
                                        TextSize = 37,
                                    },
                                    artist = new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-SemiBoldItalic",
                                        TextSize = 25,
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Margin           = new MarginPadding {
                                            Top = 20
                                        },
                                        Child = author = new AuthorInfo(),
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = buttons_height,
                                        Margin           = new MarginPadding {
                                            Top = 10
                                        },
                                        Children = new Drawable[]
                                        {
                                            new FavouriteButton(),
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Left = buttons_height + buttons_spacing
                                                },
                                                Children = new Drawable[]
                                                {
                                                    noVideoButtons = new Container
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Alpha            = 0f,
                                                        Child            = new DownloadButton("Download", @""),
                                                    },
                                                    videoButtons = new FillFlowContainer
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Spacing          = new Vector2(buttons_spacing),
                                                        Alpha            = 0f,
                                                        Children         = new[]
                                                        {
                                                            new DownloadButton("Download", "with Video"),
                                                            new DownloadButton("Download", "without Video"),
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        Details = new Details
                        {
                            Anchor = Anchor.BottomRight,
                            Origin = Anchor.BottomRight,
                            Margin = new MarginPadding {
                                Right = BeatmapSetOverlay.X_PADDING
                            },
                        },
                    },
                },
            };

            Picker.Beatmap.ValueChanged += b => Details.Beatmap = b;
        }
Example #21
0
        public DrawableRoom(Room room)
        {
            Room = room;

            RelativeSizeAxes = Axes.X;
            Height           = height;
            CornerRadius     = 5;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Type   = EdgeEffectType.Shadow,
                Colour = Color4.Black.Opacity(40),
                Radius = 5,
            };

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(34),
                },
                sideStrip = new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = content_padding,
                },
                avatar = new UpdateableAvatar
                {
                    Size         = new Vector2(Height - content_padding * 2),
                    Masking      = true,
                    CornerRadius = 5f,
                    Margin       = new MarginPadding {
                        Left = content_padding * 2, Top = content_padding
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = content_padding, Bottom = content_padding, Left = Height + content_padding * 2, Right = content_padding
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(5f),
                            Children         = new Drawable[]
                            {
                                name = new OsuSpriteText
                                {
                                    TextSize = 18,
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 20f,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes     = Axes.X,
                                            RelativeSizeAxes = Axes.Y,
                                            Direction        = FillDirection.Horizontal,
                                            Spacing          = new Vector2(5f, 0f),
                                            Children         = new Drawable[]
                                            {
                                                flagContainer = new Container
                                                {
                                                    Width            = 30f,
                                                    RelativeSizeAxes = Axes.Y,
                                                },
                                                new Container
                                                {
                                                    Width            = 40f,
                                                    RelativeSizeAxes = Axes.Y,
                                                },
                                                new OsuSpriteText
                                                {
                                                    Text     = "hosted by",
                                                    Anchor   = Anchor.CentreLeft,
                                                    Origin   = Anchor.CentreLeft,
                                                    TextSize = 14,
                                                },
                                                host = new OsuSpriteText
                                                {
                                                    Anchor   = Anchor.CentreLeft,
                                                    Origin   = Anchor.CentreLeft,
                                                    TextSize = 14,
                                                    Font     = @"Exo2.0-BoldItalic",
                                                },
                                            },
                                        },
                                        rankBounds = new OsuSpriteText
                                        {
                                            Anchor   = Anchor.CentreRight,
                                            Origin   = Anchor.CentreRight,
                                            Text     = "#0 - #0",
                                            TextSize = 14,
                                            Margin   = new MarginPadding {
                                                Right = 10
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Margin           = new MarginPadding {
                                Bottom = content_padding
                            },
                            Children = new Drawable[]
                            {
                                status = new OsuSpriteText
                                {
                                    TextSize = 14,
                                    Font     = @"Exo2.0-Bold",
                                },
                                beatmapInfoFlow = new FillFlowContainer <OsuSpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Horizontal,
                                    Children         = new[]
                                    {
                                        beatmapTitle = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        beatmapDash = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-RegularItalic",
                                        },
                                        beatmapArtist = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-RegularItalic",
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
            };

            Room.Name.ValueChanged    += displayName;
            Room.Host.ValueChanged    += displayUser;
            Room.Status.ValueChanged  += displayStatus;
            Room.Beatmap.ValueChanged += displayBeatmap;
        }
Example #22
0
        private void load(OsuColour colours)
        {
            Children = new Drawable[]
            {
                dragContainer = new DragContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        playlist = new PlaylistOverlay
                        {
                            RelativeSizeAxes = Axes.X,
                            Y = player_height + 10,
                        },
                        playerContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = player_height,
                            Masking          = true,
                            CornerRadius     = 5,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(40),
                                Radius = 5,
                            },
                            Children = new[]
                            {
                                background = new Background(),
                                title      = new OsuSpriteText
                                {
                                    Origin   = Anchor.BottomCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 40),
                                    Font     = OsuFont.GetFont(size: 25, italics: true),
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                },
                                artist = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 45),
                                    Font     = OsuFont.GetFont(size: 15, weight: FontWeight.Bold, italics: true),
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                },
                                new Container
                                {
                                    Padding = new MarginPadding {
                                        Bottom = progress_height
                                    },
                                    Height           = bottom_black_area_height,
                                    RelativeSizeAxes = Axes.X,
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer <IconButton>
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(5),
                                            Origin       = Anchor.Centre,
                                            Anchor       = Anchor.Centre,
                                            Children     = new[]
                                            {
                                                prevButton = new MusicIconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = () => musicController.PrevTrack(),
                                                    Icon   = FontAwesome.Solid.StepBackward,
                                                },
                                                playButton = new MusicIconButton
                                                {
                                                    Anchor    = Anchor.Centre,
                                                    Origin    = Anchor.Centre,
                                                    Scale     = new Vector2(1.4f),
                                                    IconScale = new Vector2(1.4f),
                                                    Action    = () => musicController.TogglePause(),
                                                    Icon      = FontAwesome.Regular.PlayCircle,
                                                },
                                                nextButton = new MusicIconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = () => musicController.NextTrack(),
                                                    Icon   = FontAwesome.Solid.StepForward,
                                                },
                                            }
                                        },
                                        playlistButton = new MusicIconButton
                                        {
                                            Origin   = Anchor.Centre,
                                            Anchor   = Anchor.CentreRight,
                                            Position = new Vector2(-bottom_black_area_height / 2, 0),
                                            Icon     = FontAwesome.Solid.Bars,
                                            Action   = () => playlist.ToggleVisibility(),
                                        },
                                    }
                                },
                                progressBar = new HoverableProgressBar
                                {
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Height           = progress_height / 2,
                                    FillColour       = colours.Yellow,
                                    BackgroundColour = colours.YellowDarker.Opacity(0.5f),
                                    OnSeek           = musicController.SeekTo
                                }
                            },
                        },
                    }
                }
            };

            playlist.State.ValueChanged += s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
        }
Example #23
0
        public BeatmapPicker()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        difficulties = new DifficultiesContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Margin       = new MarginPadding {
                                Left = -(tile_icon_padding + tile_spacing / 2)
                            },
                            OnLostHover = () =>
                            {
                                showBeatmap(Beatmap.Value);
                                starRating.FadeOut(100);
                            },
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Margin       = new MarginPadding {
                                Top = 10
                            },
                            Spacing  = new Vector2(5f),
                            Children = new[]
                            {
                                version = new OsuSpriteText
                                {
                                    Anchor   = Anchor.BottomLeft,
                                    Origin   = Anchor.BottomLeft,
                                    TextSize = 20,
                                    Font     = @"Exo2.0-Bold",
                                },
                                starRating = new OsuSpriteText
                                {
                                    Anchor   = Anchor.BottomLeft,
                                    Origin   = Anchor.BottomLeft,
                                    TextSize = 13,
                                    Font     = @"Exo2.0-Bold",
                                    Text     = "Star Difficulty",
                                    Alpha    = 0,
                                    Margin   = new MarginPadding {
                                        Bottom = 1
                                    },
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Spacing          = new Vector2(10f),
                            Margin           = new MarginPadding {
                                Top = 5
                            },
                            Children = new[]
                            {
                                plays      = new Statistic(FontAwesome.fa_play_circle),
                                favourites = new Statistic(FontAwesome.fa_heart),
                            },
                        },
                    },
                },
            };

            Beatmap.ValueChanged += b =>
            {
                showBeatmap(b);
                updateDifficultyButtons();
            };
        }
Example #24
0
        private void load()
        {
            var user = User.User;

            var backgroundColour = Color4Extensions.FromHex("#33413C");

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 18),
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(),
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new[]
                {
                    new Drawable[]
                    {
                        crown = new SpriteIcon
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                            Icon   = FontAwesome.Solid.Crown,
                            Size   = new Vector2(14),
                            Colour = Color4Extensions.FromHex("#F7E65D"),
                            Alpha  = 0
                        },
                        new TeamDisplay(User),
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true,
                            CornerRadius     = 5,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = backgroundColour
                                },
                                new UserCoverBackground
                                {
                                    Anchor           = Anchor.CentreRight,
                                    Origin           = Anchor.CentreRight,
                                    RelativeSizeAxes = Axes.Both,
                                    Width            = 0.75f,
                                    User             = user,
                                    Colour           = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f))
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Spacing          = new Vector2(10),
                                    Direction        = FillDirection.Horizontal,
                                    Children         = new Drawable[]
                                    {
                                        new UpdateableAvatar
                                        {
                                            Anchor           = Anchor.CentreLeft,
                                            Origin           = Anchor.CentreLeft,
                                            RelativeSizeAxes = Axes.Both,
                                            FillMode         = FillMode.Fit,
                                            User             = user
                                        },
                                        new UpdateableFlag
                                        {
                                            Anchor  = Anchor.CentreLeft,
                                            Origin  = Anchor.CentreLeft,
                                            Size    = new Vector2(30, 20),
                                            Country = user?.Country
                                        },
                                        new OsuSpriteText
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Font   = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
                                            Text   = user?.Username
                                        },
                                        userRankText = new OsuSpriteText
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Font   = OsuFont.GetFont(size: 14),
                                        }
                                    }
                                },
                                new Container
                                {
                                    Anchor       = Anchor.CentreRight,
                                    Origin       = Anchor.CentreRight,
                                    AutoSizeAxes = Axes.Both,
                                    Margin       = new MarginPadding {
                                        Right = 70
                                    },
                                    Child = userModsDisplay = new ModDisplay
                                    {
                                        Scale         = new Vector2(0.5f),
                                        ExpansionMode = ExpansionMode.AlwaysContracted,
                                    }
                                },
                                userStateDisplay = new StateDisplay
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Margin = new MarginPadding {
                                        Right = 10
                                    },
                                }
                            }
                        },
                        kickButton = new KickButton
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Alpha  = 0,
                            Margin = new MarginPadding(4),
                            Action = () => Client.KickUser(User.UserID),
                        },
                    },
                }
            };
        }
Example #25
0
        public ChannelListItem(Channel channel)
        {
            this.channel = channel;

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

            Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); };

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Horizontal,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            Children = new[]
                            {
                                joinedCheckmark = new TextAwesome
                                {
                                    Anchor   = Anchor.TopRight,
                                    Origin   = Anchor.TopRight,
                                    Icon     = FontAwesome.fa_check_circle,
                                    TextSize = text_size,
                                    Shadow   = false,
                                    Margin   = new MarginPadding {
                                        Right = 10f
                                    },
                                    Alpha = 0f,
                                },
                            },
                        },
                        new Container
                        {
                            Width        = channel_width,
                            AutoSizeAxes = Axes.Y,
                            Children     = new[]
                            {
                                name = new OsuSpriteText
                                {
                                    Text     = channel.ToString(),
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-Bold",
                                    Shadow   = false,
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Width            = 0.7f,
                            AutoSizeAxes     = Axes.Y,
                            Margin           = new MarginPadding {
                                Left = width_padding
                            },
                            Children = new[]
                            {
                                topic = new OsuSpriteText
                                {
                                    Text     = channel.Topic,
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-SemiBold",
                                    Shadow   = false,
                                    Alpha    = 0.8f,
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Margin       = new MarginPadding {
                                Left = width_padding
                            },
                            Spacing  = new Vector2(3f, 0f),
                            Children = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    Icon     = FontAwesome.fa_user,
                                    TextSize = text_size - 2,
                                    Shadow   = false,
                                    Margin   = new MarginPadding {
                                        Top = 1
                                    },
                                },
                                new OsuSpriteText
                                {
                                    Text     = @"0",
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-SemiBold",
                                    Shadow   = false,
                                },
                            },
                        },
                    },
                },
            };
        }
Example #26
0
        private void load(Bindable <WorkingBeatmap> beatmap, BeatmapManager beatmaps, OsuColour colours)
        {
            this.beatmaps = beatmaps;

            Children = new Drawable[]
            {
                dragContainer = new DragContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        playlist = new PlaylistOverlay
                        {
                            RelativeSizeAxes = Axes.X,
                            Y            = player_height + 10,
                            OrderChanged = playlistOrderChanged
                        },
                        playerContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = player_height,
                            Masking          = true,
                            CornerRadius     = 5,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(40),
                                Radius = 5,
                            },
                            Children = new[]
                            {
                                background = new Background(),
                                title      = new OsuSpriteText
                                {
                                    Origin   = Anchor.BottomCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 40),
                                    Font     = OsuFont.GetFont(size: 25, italics: true),
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                },
                                artist = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 45),
                                    Font     = OsuFont.GetFont(size: 15, weight: FontWeight.Bold, italics: true),
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                },
                                new Container
                                {
                                    Padding = new MarginPadding {
                                        Bottom = progress_height
                                    },
                                    Height           = bottom_black_area_height,
                                    RelativeSizeAxes = Axes.X,
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer <IconButton>
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(5),
                                            Origin       = Anchor.Centre,
                                            Anchor       = Anchor.Centre,
                                            Children     = new[]
                                            {
                                                prevButton = new MusicIconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = prev,
                                                    Icon   = FontAwesome.Solid.StepBackward,
                                                },
                                                playButton = new MusicIconButton
                                                {
                                                    Anchor    = Anchor.Centre,
                                                    Origin    = Anchor.Centre,
                                                    Scale     = new Vector2(1.4f),
                                                    IconScale = new Vector2(1.4f),
                                                    Action    = play,
                                                    Icon      = FontAwesome.Regular.PlayCircle,
                                                },
                                                nextButton = new MusicIconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = () => next(),
                                                    Icon   = FontAwesome.Solid.StepForward,
                                                },
                                            }
                                        },
                                        playlistButton = new MusicIconButton
                                        {
                                            Origin   = Anchor.Centre,
                                            Anchor   = Anchor.CentreRight,
                                            Position = new Vector2(-bottom_black_area_height / 2, 0),
                                            Icon     = FontAwesome.Solid.Bars,
                                            Action   = () => playlist.ToggleVisibility(),
                                        },
                                    }
                                },
                                progressBar = new ProgressBar
                                {
                                    Origin     = Anchor.BottomCentre,
                                    Anchor     = Anchor.BottomCentre,
                                    Height     = progress_height,
                                    FillColour = colours.Yellow,
                                    OnSeek     = attemptSeek
                                }
                            },
                        },
                    }
                }
            };

            beatmapSets           = beatmaps.GetAllUsableBeatmapSets();
            beatmaps.ItemAdded   += handleBeatmapAdded;
            beatmaps.ItemRemoved += handleBeatmapRemoved;

            playlist.State.ValueChanged += s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
        }
Example #27
0
        private void load(IAPIProvider api, OsuColour colour, ScoreManager scoreManager)
        {
            var user = Score.User;

            statisticsLabels = GetStatistics(Score).Select(s => new ScoreComponentLabel(s)).ToList();

            ClickableAvatar innerAvatar;

            Children = new Drawable[]
            {
                new RankLabel(rank)
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = rank_width,
                },
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = rank_width,
                    },
                    Children = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            CornerRadius     = corner_radius,
                            Masking          = true,
                            Children         = new[]
                            {
                                background = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = user.Id == api.LocalUser.Value.Id && allowHighlight ? colour.Green : Color4.Black,
                                    Alpha            = background_alpha,
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(edge_margin),
                            Children         = new[]
                            {
                                avatar          = new DelayedLoadWrapper(
                                    innerAvatar = new ClickableAvatar(user)
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    CornerRadius     = corner_radius,
                                    Masking          = true,
                                    EdgeEffect       = new EdgeEffectParameters
                                    {
                                        Type   = EdgeEffectType.Shadow,
                                        Radius = 1,
                                        Colour = Color4.Black.Opacity(0.2f),
                                    },
                                })
                                {
                                    RelativeSizeAxes = Axes.None,
                                    Size             = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2),
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Y,
                                    AutoSizeAxes     = Axes.X,
                                    Position         = new Vector2(HEIGHT - edge_margin, 0f),
                                    Children         = new Drawable[]
                                    {
                                        nameLabel = new OsuSpriteText
                                        {
                                            Text = user.Username,
                                            Font = OsuFont.GetFont(size: 23, weight: FontWeight.Bold, italics: true)
                                        },
                                        new FillFlowContainer
                                        {
                                            Origin       = Anchor.BottomLeft,
                                            Anchor       = Anchor.BottomLeft,
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(10f, 0f),
                                            Children     = new Drawable[]
                                            {
                                                flagBadgeContainer = new Container
                                                {
                                                    Origin   = Anchor.BottomLeft,
                                                    Anchor   = Anchor.BottomLeft,
                                                    Size     = new Vector2(87f, 20f),
                                                    Masking  = true,
                                                    Children = new Drawable[]
                                                    {
                                                        new UpdateableFlag(user.Country)
                                                        {
                                                            Width            = 30,
                                                            RelativeSizeAxes = Axes.Y,
                                                        },
                                                    },
                                                },
                                                new FillFlowContainer
                                                {
                                                    Origin       = Anchor.BottomLeft,
                                                    Anchor       = Anchor.BottomLeft,
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Horizontal,
                                                    Spacing      = new Vector2(10f, 0f),
                                                    Margin       = new MarginPadding {
                                                        Left = edge_margin
                                                    },
                                                    Children = statisticsLabels
                                                },
                                            },
                                        },
                                    },
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Anchor       = Anchor.TopRight,
                                    Origin       = Anchor.TopRight,
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(5f, 0f),
                                    Children     = new Drawable[]
                                    {
                                        scoreLabel = new GlowingSpriteText
                                        {
                                            TextColour = Color4.White,
                                            GlowColour = Color4Extensions.FromHex(@"83ccfa"),
                                            Current    = scoreManager.GetBindableTotalScoreString(Score),
                                            Font       = OsuFont.Numeric.With(size: 23),
                                        },
                                        RankContainer = new Container
                                        {
                                            Size     = new Vector2(40f, 20f),
                                            Children = new[]
                                            {
                                                scoreRank = new UpdateableRank(Score.Rank)
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Size   = new Vector2(40f)
                                                },
                                            },
                                        },
                                    },
                                },
                                modsContainer = new FillFlowContainer <ModIcon>
                                {
                                    Anchor             = Anchor.BottomRight,
                                    Origin             = Anchor.BottomRight,
                                    AutoSizeAxes       = Axes.Both,
                                    Direction          = FillDirection.Horizontal,
                                    Spacing            = new Vector2(1),
                                    ChildrenEnumerable = Score.Mods.Select(mod => new ModIcon(mod)
                                    {
                                        Scale = new Vector2(0.375f)
                                    })
                                },
                            },
                        },
                    },
                },
            };

            innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200);
        }
Example #28
0
        private void load(OsuColour colours)
        {
            Height = 150;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = colours.GreySeafoamDark,
                },
                new FillFlowContainer
                {
                    Direction = FillDirection.Horizontal,
                    Margin    = new MarginPadding {
                        Left = UserProfileOverlay.CONTENT_X_MARGIN
                    },
                    Height       = avatar_size,
                    AutoSizeAxes = Axes.X,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Children     = new Drawable[]
                    {
                        avatar = new UpdateableAvatar
                        {
                            Size            = new Vector2(avatar_size),
                            Masking         = true,
                            CornerRadius    = avatar_size * 0.25f,
                            OpenOnClick     = { Value = false },
                            ShowGuestOnNull = false,
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,
                            Padding          = new MarginPadding {
                                Left = 10
                            },
                            Children = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Children     = new Drawable[]
                                    {
                                        usernameText = new OsuSpriteText
                                        {
                                            Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular)
                                        },
                                        openUserExternally = new ExternalLinkButton
                                        {
                                            Margin = new MarginPadding {
                                                Left = 5
                                            },
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                        },
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Origin       = Anchor.BottomLeft,
                                    Anchor       = Anchor.BottomLeft,
                                    Direction    = FillDirection.Vertical,
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        titleText = new OsuSpriteText
                                        {
                                            Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular)
                                        },
                                        supporterTag = new SupporterIcon
                                        {
                                            Height = 20,
                                            Margin = new MarginPadding {
                                                Top = 5
                                            }
                                        },
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            Height           = 1.5f,
                                            Margin           = new MarginPadding {
                                                Top = 10
                                            },
                                            Colour = colours.GreySeafoamLighter,
                                        },
                                        new Container
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Margin       = new MarginPadding {
                                                Top = 5
                                            },
                                            Children = new Drawable[]
                                            {
                                                userFlag = new UpdateableFlag
                                                {
                                                    Size = new Vector2(30, 20),
                                                    ShowPlaceholderOnNull = false,
                                                },
                                                userCountryText = new OsuSpriteText
                                                {
                                                    Font   = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular),
                                                    Margin = new MarginPadding {
                                                        Left = 40
                                                    },
                                                    Origin = Anchor.CentreLeft,
                                                    Anchor = Anchor.CentreLeft,
                                                    Colour = colours.GreySeafoamLighter,
                                                }
                                            }
                                        },
                                    }
                                }
                            }
                        }
                    }
                },
                userStats = new FillFlowContainer
                {
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    AutoSizeAxes = Axes.Y,
                    Width        = 300,
                    Margin       = new MarginPadding {
                        Right = UserProfileOverlay.CONTENT_X_MARGIN
                    },
                    Padding = new MarginPadding {
                        Vertical = 15
                    },
                    Spacing = new Vector2(0, 2)
                }
            };

            User.BindValueChanged(user => updateUser(user.NewValue));
        }
Example #29
0
        public DirectOverlay()
        {
            RelativeSizeAxes = Axes.Both;

            // osu!direct colours are not part of the standard palette

            Waves.FirstWaveColour  = OsuColour.FromHex(@"19b0e2");
            Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = OsuColour.FromHex(@"005774");
            Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");

            ScrollFlow.Children = new Drawable[]
            {
                resultCountsContainer = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Margin       = new MarginPadding {
                        Top = 5
                    },
                    Children = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Text     = "Found ",
                            TextSize = 15,
                        },
                        resultCountsText = new OsuSpriteText
                        {
                            TextSize = 15,
                            Font     = @"Exo2.0-Bold",
                        },
                    }
                },
            };

            Filter.Search.Current.ValueChanged += text =>
            {
                if (text != string.Empty)
                {
                    Header.Tabs.Current.Value = DirectTab.Search;

                    if (Filter.Tabs.Current.Value == DirectSortCriteria.Ranked)
                    {
                        Filter.Tabs.Current.Value = DirectSortCriteria.Relevance;
                    }
                }
                else
                {
                    Header.Tabs.Current.Value = DirectTab.NewestMaps;

                    if (Filter.Tabs.Current.Value == DirectSortCriteria.Relevance)
                    {
                        Filter.Tabs.Current.Value = DirectSortCriteria.Ranked;
                    }
                }
            };
            ((FilterControl)Filter).Ruleset.ValueChanged             += ruleset => Scheduler.AddOnce(updateSearch);
            Filter.DisplayStyleControl.DisplayStyle.ValueChanged     += recreatePanels;
            Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch);

            Header.Tabs.Current.ValueChanged += tab =>
            {
                if (tab != DirectTab.Search)
                {
                    currentQuery.Value        = string.Empty;
                    Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value;
                    Scheduler.AddOnce(updateSearch);
                }
            };

            currentQuery.ValueChanged += v =>
            {
                queryChangedDebounce?.Cancel();

                if (string.IsNullOrEmpty(v))
                {
                    Scheduler.AddOnce(updateSearch);
                }
                else
                {
                    BeatmapSets   = null;
                    ResultAmounts = null;

                    queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500);
                }
            };

            currentQuery.BindTo(Filter.Search.Current);

            Filter.Tabs.Current.ValueChanged += sortCriteria =>
            {
                if (Header.Tabs.Current.Value != DirectTab.Search && sortCriteria != (DirectSortCriteria)Header.Tabs.Current.Value)
                {
                    Header.Tabs.Current.Value = DirectTab.Search;
                }

                Scheduler.AddOnce(updateSearch);
            };

            updateResultCounts();
        }
Example #30
0
        public DrawableRoom(Room room)
        {
            Room = room;

            RelativeSizeAxes = Axes.X;
            Height           = height;
            CornerRadius     = 5;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Type   = EdgeEffectType.Shadow,
                Colour = Color4.Black.Opacity(40),
                Radius = 5,
            };

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"212121"),
                },
                sideStrip = new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = side_strip_width,
                },
                new Container
                {
                    Width            = cover_width,
                    RelativeSizeAxes = Axes.Y,
                    Masking          = true,
                    Margin           = new MarginPadding {
                        Left = side_strip_width
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4.Black,
                        },
                        coverContainer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Vertical = content_padding,
                        Left     = side_strip_width + cover_width + content_padding,
                        Right    = content_padding,
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(5f),
                            Children         = new Drawable[]
                            {
                                name = new OsuSpriteText
                                {
                                    TextSize = 18,
                                },
                                participantInfo = new ParticipantInfo(),
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Children         = new Drawable[]
                            {
                                status = new OsuSpriteText
                                {
                                    TextSize = 14,
                                    Font     = @"Exo2.0-Bold",
                                },
                                beatmapInfoFlow = new FillFlowContainer <OsuSpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Horizontal,
                                    Children         = new[]
                                    {
                                        beatmapTitle = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        beatmapDash = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        beatmapArtist = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-RegularItalic",
                                        },
                                    },
                                },
                            },
                        },
                        modeTypeInfo = new ModeTypeInfo
                        {
                            Anchor = Anchor.BottomRight,
                            Origin = Anchor.BottomRight,
                        },
                    },
                },
            };

            nameBind.ValueChanged         += displayName;
            hostBind.ValueChanged         += displayUser;
            typeBind.ValueChanged         += displayGameType;
            participantsBind.ValueChanged += displayParticipants;

            nameBind.BindTo(Room.Name);
            hostBind.BindTo(Room.Host);
            statusBind.BindTo(Room.Status);
            typeBind.BindTo(Room.Type);
            beatmapBind.BindTo(Room.Beatmap);
            participantsBind.BindTo(Room.Participants);
        }