private void load(OsuColour colours, LocalisationEngine localisation) { hoverColour = colours.Yellow; artistColour = colours.Gray9; var metadata = BeatmapSetInfo.Metadata; FilterTerms = metadata.SearchableTerms; Children = new Drawable[] { handle = new PlaylistItemHandle { Colour = colours.Gray5 }, text = new OsuTextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Left = 20 }, ContentIndent = 10f, }, }; titleBind = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); artistBind = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); artistBind.ValueChanged += newText => recreateText(); artistBind.TriggerChange(); }
private LocalisationEngine engine; //keep a reference to avoid GC of the engine public override void Reset() { base.Reset(); var config = new FakeFrameworkConfigManager(); engine = new LocalisationEngine(config); engine.AddLanguage("en", new FakeStorage()); engine.AddLanguage("zh-CHS", new FakeStorage()); engine.AddLanguage("ja", new FakeStorage()); Add(new FillFlowContainer <SpriteText> { Anchor = Anchor.Centre, Origin = Anchor.Centre, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 10), Padding = new MarginPadding(10), AutoSizeAxes = Axes.Both, Children = new[] { new SpriteText { Text = "Not localisable", TextSize = 48, Colour = Color4.White }, new SpriteText { Current = engine.GetLocalisedString("localisable"), TextSize = 48, Colour = Color4.White }, new SpriteText { Current = engine.GetUnicodePreference("Unicode on", "Unicode off"), TextSize = 48, Colour = Color4.White }, new SpriteText { Current = engine.GetUnicodePreference(null, "I miss unicode"), TextSize = 48, Colour = Color4.White }, new SpriteText { Current = engine.Format("{0}", DateTime.Now), TextSize = 48, Colour = Color4.White }, } }); AddStep("English", () => config.Set(FrameworkSetting.Locale, "en")); AddStep("Japanese", () => config.Set(FrameworkSetting.Locale, "ja")); AddStep("Simplified Chinese", () => config.Set(FrameworkSetting.Locale, "zh-CHS")); AddToggleStep("ShowUnicode", b => config.Set(FrameworkSetting.ShowUnicode, b)); }
private void displayBeatmap(BeatmapInfo value) { modeTypeInfo.Beatmap = value; if (value != null) { coverContainer.FadeIn(transition_duration); LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet) { Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }, coverContainer.Add); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { coverContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; beatmapTitle.Text = "Changing map"; beatmapDash.Text = beatmapArtist.Text = string.Empty; } }
private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) { coloredBackground.Colour = underscoreLine.Colour = colour.Gray4; Stats.Add(new OsuSpriteText { Text = $"accuracy: {Score.Accuracy:P2}", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, TextSize = 11, Font = "Exo2.0-RegularItalic", Depth = -1, }); metadata.Add(new MetadataContainer(Score.Beatmap.Metadata.Title, Score.Beatmap.Metadata.Artist) { AutoSizeAxes = Axes.Both, Action = () => { if (Score.Beatmap.OnlineBeatmapSetID.HasValue) { beatmapSetOverlay?.ShowBeatmapSet(Score.Beatmap.OnlineBeatmapSetID.Value); } }, Child = new FillFlowContainer { AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Current = locale.GetUnicodePreference( $"{Score.Beatmap.Metadata.TitleUnicode ?? Score.Beatmap.Metadata.Title} [{Score.Beatmap.Version}] ", $"{Score.Beatmap.Metadata.Title ?? Score.Beatmap.Metadata.TitleUnicode} [{Score.Beatmap.Version}] " ), TextSize = 15, Font = "Exo2.0-SemiBoldItalic", }, new OsuSpriteText { Current = locale.GetUnicodePreference(Score.Beatmap.Metadata.ArtistUnicode, Score.Beatmap.Metadata.Artist), TextSize = 12, Padding = new MarginPadding { Top = 3 }, Font = "Exo2.0-RegularItalic", }, }, }, }); foreach (Mod mod in Score.Mods) { modsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.5f) }); } }
private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) { if (localisation == null) { throw new ArgumentNullException(nameof(localisation)); } restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); dialogOverlay = overlay; if (beatmapOverlay != null) { viewDetails = beatmapOverlay.FetchAndShowBeatmapSet; } Children = new Drawable[] { new DelayedLoadUnloadWrapper(() => new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault())) { RelativeSizeAxes = Axes.Both, OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint), }, 300, 5000 ), new FillFlowContainer { Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Font = @"Exo2.0-BoldItalic", Current = localisation.GetUnicodePreference(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title), TextSize = 22, Shadow = true, }, new OsuSpriteText { Font = @"Exo2.0-SemiBoldItalic", Current = localisation.GetUnicodePreference(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist), TextSize = 17, Shadow = true, }, new FillFlowContainer <FilterableDifficultyIcon> { Margin = new MarginPadding { Top = 5 }, AutoSizeAxes = Axes.Both, Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() } } } }; }
private void load(OsuColour colours, LocalisationEngine localisation) { title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}"; title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); }
private void load(LocalisationEngine localisation) { if (localisation == null) { throw new ArgumentNullException(nameof(localisation)); } title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); }
private void load(OsuColour colours, LocalisationEngine localisation) { BeatmapMetadata metadata = BeatmapSetInfo.Metadata; FilterTerms = metadata.SearchableTerms; Children = new Drawable[] { handle = new TextAwesome { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, TextSize = 12, Colour = colours.Gray5, Icon = FontAwesome.fa_bars, Alpha = 0f, Margin = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Top = 2 }, }, new FillFlowContainer <OsuSpriteText> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Left = 20 }, Spacing = new Vector2(5f, 0f), Children = new [] { title = new OsuSpriteText { TextSize = 16, Font = @"Exo2.0-Regular", Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title), }, new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-Bold", Colour = colours.Gray9, Padding = new MarginPadding { Top = 1 }, Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist), } } }, }; hoverColour = colours.Yellow; }
private void updateText() { if (beatmap == null) { beatmapTitle.Current = beatmapArtist.Current = null; beatmapTitle.Text = "Changing map"; beatmapDash.Text = beatmapArtist.Text = string.Empty; } else { beatmapTitle.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } }
private void displayBeatmap(BeatmapInfo value) { if (value != null) { beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { beatmapTitle.Current = null; beatmapArtist.Current = null; beatmapTitle.Text = @"Changing map"; beatmapDash.Text = string.Empty; beatmapArtist.Text = string.Empty; } }
private void load(LocalisationEngine localisation) { if (localisation == null) { throw new ArgumentNullException(nameof(localisation)); } Children = new Drawable[] { new DelayedLoadWrapper( new PanelBackground(beatmap) { RelativeSizeAxes = Axes.Both, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }, 300), new FillFlowContainer { Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Font = @"Exo2.0-BoldItalic", Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title), TextSize = 22, Shadow = true, }, new OsuSpriteText { Font = @"Exo2.0-SemiBoldItalic", Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist), TextSize = 17, Shadow = true, }, difficultyIcons } } }; }
private void load(OsuColour colours, LocalisationEngine localisation) { hoverColour = colours.Yellow; artistColour = colours.Gray9; var metadata = BeatmapSetInfo.Metadata; FilterTerms = metadata.SearchableTerms; Children = new Drawable[] { handle = new TextAwesome { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, TextSize = 12, Colour = colours.Gray5, Icon = FontAwesome.fa_bars, Alpha = 0f, Margin = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Top = 2 }, }, text = new Paragraph { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Left = 20 }, ContentIndent = 10f, }, }; titleBind = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); artistBind = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); artistBind.ValueChanged += newText => recreateText(); artistBind.TriggerChange(); }
private void load(OsuColour colours, LocalisationEngine localisation) { title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; var creator = beatmap.Metadata.Author?.Username; if (!string.IsNullOrEmpty(creator)) { versionMapper.Text = $"mapped by {creator}"; if (!string.IsNullOrEmpty(beatmap.Version)) { versionMapper.Text = $"{beatmap.Version} - " + versionMapper.Text; } } title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); }
private void load(LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) { Action = () => { if (beatmap.OnlineBeatmapID != null) { beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); } else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) { beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); } }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Current = locale.GetUnicodePreference( $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] " ), TextSize = 15, Font = "Exo2.0-SemiBoldItalic", }, new OsuSpriteText { Current = locale.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist), TextSize = 12, Padding = new MarginPadding { Top = 3 }, Font = "Exo2.0-RegularItalic", }, }, }; }
private void load(LocalisationEngine localisation) { var beatmapInfo = working.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); PixelSnapping = true; CacheDrawnFrameBuffer = true; RelativeSizeAxes = Axes.Both; titleBinding = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); artistBinding = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); Children = new Drawable[] { // We will create the white-to-black gradient by modulating transparency and having // a black backdrop. This results in an sRGB-space gradient and not linear space, // transitioning from white to black more perceptually uniformly. new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, // We use a container, such that we can set the colour gradient to go across the // vertices of the masked container instead of the vertices of the (larger) sprite. new Container { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), Children = new[] { // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(working) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }, }, }, new DifficultyColourBar(beatmapInfo) { RelativeSizeAxes = Axes.Y, Width = 20, }, new FillFlowContainer { Name = "Top-aligned metadata", Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { VersionLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, TextSize = 24, }, } }, new FillFlowContainer { Name = "Centre-aligned metadata", Anchor = Anchor.CentreLeft, Origin = Anchor.TopLeft, Y = -22, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { TitleLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", TextSize = 28, }, ArtistLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", TextSize = 17, }, MapperContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Children = getMapper(metadata) }, InfoLabelContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(20, 0), AutoSizeAxes = Axes.Both, Children = getInfoLabels() } } } }; artistBinding.ValueChanged += value => setMetadata(metadata.Source); artistBinding.TriggerChange(); }
private void load(LocalisationEngine localisation) { var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata(); AutoSizeAxes = Axes.Both; Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Direction = FillDirection.Vertical, Children = new Drawable[] { new OsuSpriteText { Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title), TextSize = 36, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new OsuSpriteText { Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist), TextSize = 26, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new Container { Size = new Vector2(300, 60), Margin = new MarginPadding(10), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, CornerRadius = 10, Masking = true, Children = new[] { new Sprite { RelativeSizeAxes = Axes.Both, Texture = beatmap?.Background, Origin = Anchor.Centre, Anchor = Anchor.Centre, FillMode = FillMode.Fill, }, } }, new OsuSpriteText { Text = beatmap?.BeatmapInfo?.Version, TextSize = 26, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Margin = new MarginPadding { Bottom = 40 }, }, new MetadataLine("Source", metadata.Source) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new MetadataLine("Composer", string.Empty) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new MetadataLine("Mapper", metadata.AuthorString) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, }, } }; }
private void load(OsuColour colours, LocalisationEngine localisation) { this.colours = colours; ModeTypeInfo modeTypeInfo; OsuSpriteText participants, participantsSlash, maxParticipants, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"343138"), }, topFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 200, Masking = true, 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.5f), Color4.Black.Opacity(0)), }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(20), Children = new Drawable[] { participantNumbersFlow = new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Children = new[] { participants = new OsuSpriteText { TextSize = 30, Font = @"Exo2.0-Bold" }, participantsSlash = new OsuSpriteText { Text = @"/", TextSize = 30, Font = @"Exo2.0-Light" }, maxParticipants = new OsuSpriteText { TextSize = 30, Font = @"Exo2.0-Light" }, }, }, name = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, TextSize = 30, }, }, }, }, }, statusStrip = new Box { RelativeSizeAxes = Axes.X, Height = 5, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"28242d"), }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, LayoutDuration = transition_duration, Padding = contentPadding, Spacing = new Vector2(0f, 5f), Children = new Drawable[] { status = new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-Bold", }, infoPanelFlow = new FillFlowContainer { AutoSizeAxes = Axes.X, Height = 30, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { modeTypeInfo = new ModeTypeInfo(), new Container { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Margin = new MarginPadding { Left = 5 }, Children = new[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { beatmapTitle = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, beatmapDash = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, beatmapArtist = new OsuSpriteText { Font = @"Exo2.0-RegularItalic", }, }, }, beatmapAuthor = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, TextSize = 14, Colour = colours.Gray9, }, }, }, }, }, }, }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = contentPadding, Children = new Drawable[] { participantInfo = new ParticipantInfo(@"Rank Range "), }, }, }, }, participantsScroll = new OsuScrollContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Padding = new MarginPadding { Top = contentPadding.Top, Left = 38, Right = 37 }, Children = new[] { participantsFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, LayoutDuration = transition_duration, Spacing = new Vector2(5f), }, }, }, }; nameBind.ValueChanged += n => name.Text = n; hostBind.ValueChanged += h => participantInfo.Host = h; typeBind.ValueChanged += t => modeTypeInfo.Type = t; statusBind.ValueChanged += displayStatus; beatmapBind.ValueChanged += b => { modeTypeInfo.Beatmap = b; if (b != null) { coverContainer.FadeIn(transition_duration); LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }, coverContainer.Add); beatmapTitle.Current = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist); beatmapAuthor.Text = $"mapped by {b.Metadata.Author}"; } else { coverContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; beatmapTitle.Text = "Changing map"; beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty; } }; maxParticipantsBind.ValueChanged += m => { if (m == null) { participantsSlash.FadeOut(transition_duration); maxParticipants.FadeOut(transition_duration); } else { participantsSlash.FadeIn(transition_duration); maxParticipants.FadeIn(transition_duration); maxParticipants.Text = m.ToString(); } }; participantsBind.ValueChanged += p => { participants.Text = p.Length.ToString(); participantInfo.Participants = p; participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u)); }; updateState(); }
private void load(LocalisationEngine localisation) { Content.CornerRadius = 5; AddRange(new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.25f), Color4.Black.Opacity(0.75f)), }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = vertical_padding }, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new OsuSpriteText { Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Font = @"Exo2.0-BoldItalic", }, new FillFlowContainer { AutoSizeAxes = Axes.X, Height = 20, Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding }, Children = GetDifficultyIcons(), }, }, }, new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Margin = new MarginPadding { Right = height - vertical_padding * 2 + vertical_padding }, Children = new Drawable[] { new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0) { Margin = new MarginPadding { Right = 1 }, }, new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { new OsuSpriteText { Text = "mapped by ", TextSize = 14, }, new OsuSpriteText { Text = SetInfo.Metadata.Author, TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", }, }, }, new OsuSpriteText { Text = $"from {SetInfo.Metadata.Source}", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 14, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, }, new DownloadButton { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Size = new Vector2(height - vertical_padding * 2), Action = StartDownload }, }, }, }); }
private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) { stats.Add(new OsuSpriteText { Text = $"{Math.Round(score.PP ?? 0)}pp", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 18, Font = "Exo2.0-BoldItalic", }); if (weight.HasValue) { stats.Add(new OsuSpriteText { Text = $"weighted: {Math.Round(score.PP * weight ?? 0)}pp ({weight.Value.ToString("0%", CultureInfo.CurrentCulture)})", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, TextSize = 11, Font = "Exo2.0-RegularItalic", }); } stats.Add(new OsuSpriteText { Text = "accuracy: " + score.Accuracy.ToString("0.00%"), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, TextSize = 11, Font = "Exo2.0-RegularItalic", }); metadata.Add(new OsuHoverContainer { AutoSizeAxes = Axes.Both, Action = () => { if (score.Beatmap.OnlineBeatmapSetID.HasValue) { beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value); } }, Child = new FillFlowContainer { AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Current = locale.GetUnicodePreference( $"{score.Beatmap.Metadata.TitleUnicode ?? score.Beatmap.Metadata.Title} [{score.Beatmap.Version}] ", $"{score.Beatmap.Metadata.Title ?? score.Beatmap.Metadata.TitleUnicode} [{score.Beatmap.Version}] " ), TextSize = 15, Font = "Exo2.0-SemiBoldItalic", }, new OsuSpriteText { Current = locale.GetUnicodePreference(score.Beatmap.Metadata.ArtistUnicode, score.Beatmap.Metadata.Artist), TextSize = 12, Padding = new MarginPadding { Top = 3 }, Font = "Exo2.0-RegularItalic", }, }, }, }); foreach (Mod mod in score.Mods) { modContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, Scale = new Vector2(0.5f), }); } }
private void load(LocalisationEngine localisation, OsuColour colours) { Content.CornerRadius = 5; AddRange(new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.25f), Color4.Black.Opacity(0.75f)), }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = vertical_padding }, Children = new Drawable[] { new FillFlowContainer { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, LayoutEasing = Easing.OutQuint, LayoutDuration = transition_duration, Spacing = new Vector2(10, 0), Children = new Drawable[] { playButton = new PlayButton(SetInfo) { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Size = new Vector2(height / 2), FillMode = FillMode.Fit, Alpha = 0, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new OsuSpriteText { Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Font = @"Exo2.0-BoldItalic", }, new FillFlowContainer { AutoSizeAxes = Axes.X, Height = 20, Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding }, Children = GetDifficultyIcons(), }, }, }, } }, new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, LayoutEasing = Easing.OutQuint, LayoutDuration = transition_duration, Children = new Drawable[] { downloadContainer = new Container { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Alpha = 0, Child = new DownloadButton(SetInfo) { Size = new Vector2(height - vertical_padding * 3), Margin = new MarginPadding { Left = vertical_padding, Right = vertical_padding }, }, }, new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0) { Margin = new MarginPadding { Right = 1 }, }, new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { new OsuSpriteText { Text = "mapped by ", TextSize = 14, }, new OsuSpriteText { Text = SetInfo.Metadata.Author.Username, TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", }, }, }, new OsuSpriteText { Text = SetInfo.Metadata.Source, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 14, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, }, }, }, }, }, progressBar = new Box { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, BypassAutoSizeAxes = Axes.Y, Size = new Vector2(0, 3), Alpha = 0, Colour = colours.Yellow, }, }); }
private void load(OsuColour colours, LocalisationEngine localisation) { Box sideStrip; Container coverContainer; OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist; ParticipantInfo participantInfo; ModeTypeInfo modeTypeInfo; Children = new Drawable[] { selectionBox, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(selection_border_width), Child = new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = corner_radius, 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", }, new FillFlowContainer <OsuSpriteText> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Colour = colours.Gray9, 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 += n => name.Text = n; hostBind.ValueChanged += h => participantInfo.Host = h; typeBind.ValueChanged += m => modeTypeInfo.Type = m; participantsBind.ValueChanged += p => participantInfo.Participants = p; statusBind.ValueChanged += s => { status.Text = s.Message; foreach (Drawable d in new Drawable[] { selectionBox, sideStrip, status }) { d.FadeColour(s.GetAppropriateColour(colours), 100); } }; beatmapBind.ValueChanged += b => { modeTypeInfo.Beatmap = b; if (b != null) { coverContainer.FadeIn(transition_duration); LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet) { Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), }, coverContainer.Add); beatmapTitle.Current = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist); } else { coverContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; beatmapTitle.Text = "Changing map"; beatmapDash.Text = beatmapArtist.Text = string.Empty; } }; nameBind.BindTo(Room.Name); hostBind.BindTo(Room.Host); statusBind.BindTo(Room.Status); typeBind.BindTo(Room.Type); beatmapBind.BindTo(Room.Beatmap); participantsBind.BindTo(Room.Participants); }
private void load(LocalisationEngine localisation) { title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); }
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures) { Children = new[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, GetBackground(textures), new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(0.5f), }, bottomPanel = new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, vertical_padding), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Padding = new MarginPadding { Left = horizontal_padding, Right = horizontal_padding }, Direction = FillDirection.Vertical, Children = new[] { new OsuSpriteText { Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Font = @"Exo2.0-BoldItalic", }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = horizontal_padding, }, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { new OsuSpriteText { Text = "mapped by ", TextSize = 14, Shadow = false, Colour = colours.Gray5, }, new OsuSpriteText { Text = SetInfo.Metadata.Author, TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", Shadow = false, Colour = colours.BlueDark, }, }, }, new Container { AutoSizeAxes = Axes.X, Height = 14, Children = new[] { new OsuSpriteText { Text = $"from {SetInfo.Metadata.Source}", TextSize = 14, Shadow = false, Colour = colours.Gray5, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, }, new FillFlowContainer { AutoSizeAxes = Axes.X, Height = 20, Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding }, Children = GetDifficultyIcons(), }, }, }, }, }, }, }, new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding }, Children = new[] { new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0) { Margin = new MarginPadding { Right = 1 }, }, new Statistic(FontAwesome.fa_heart, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.FavouriteCount ?? 0), }, }, }; }
private void load(OsuColour colours, LocalisationEngine localisation) { Content.CornerRadius = 4; AddRange(new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(0.5f), }, bottomPanel = new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, vertical_padding), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Padding = new MarginPadding { Left = horizontal_padding, Right = horizontal_padding }, Direction = FillDirection.Vertical, Children = new[] { new OsuSpriteText { Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), Font = @"Exo2.0-BoldItalic", }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, }, progressBar = new Box { Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, BypassAutoSizeAxes = Axes.Both, Size = new Vector2(0, 3), Alpha = 0, Colour = colours.Yellow, }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = horizontal_padding, }, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { new OsuSpriteText { Text = "mapped by ", TextSize = 14, Shadow = false, Colour = colours.Gray5, }, new OsuSpriteText { Text = SetInfo.Metadata.Author.Username, TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", Shadow = false, Colour = colours.BlueDark, }, }, }, new Container { AutoSizeAxes = Axes.X, Height = 14, Children = new[] { new OsuSpriteText { Text = $"from {SetInfo.Metadata.Source}", TextSize = 14, Shadow = false, Colour = colours.Gray5, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, }, new FillFlowContainer { AutoSizeAxes = Axes.X, Height = 20, Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding }, Children = GetDifficultyIcons(), }, }, }, new DownloadButton { Size = new Vector2(30), Margin = new MarginPadding(horizontal_padding), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Colour = colours.Gray5, Action = StartDownload }, }, }, }, }, new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding }, Children = new[] { new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0) { Margin = new MarginPadding { Right = 1 }, }, new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), }, }, playButton = new PlayButton(SetInfo) { Margin = new MarginPadding { Top = 5, Left = 10 }, Size = new Vector2(30), Alpha = 0, }, }); }