private void load(OverlayColourProvider colourProvider) { TextFlowContainer textFlow; AutoSizeAxes = Axes.Both; Anchor = Anchor.TopRight; Origin = Anchor.TopRight; InternalChild = textFlow = new TextFlowContainer(t => { t.Colour = colourProvider.Light1; }) { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Margin = new MarginPadding { Vertical = 5 } }; textFlow.AddText($"{date:dd}", t => { t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold); }); textFlow.AddText($"{date: MMM}", t => { t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular); }); }
private void load(TextureStore textures) { InternalChildren = new Drawable[] { new FillFlowContainer { Width = 400, Anchor = Anchor.Centre, Origin = Anchor.Centre, Spacing = new Vector2(0, 20), AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { branding = new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(20, 0), Children = new Drawable[] { new Sprite { Texture = textures.Get("branding"), Size = new Vector2(64), }, new Container { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Child = new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = Spartan.Bold.With(size: 56), Text = "Vignette", }, } } }, disclaimer = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, TextAnchor = Anchor.TopCentre, Anchor = Anchor.Centre, Origin = Anchor.Centre, } } } }; disclaimer.AddText("This project is ", t => t.Font = SegoeUI.Regular.With(size: 16)); disclaimer.AddText("under heavy development", t => t.Font = SegoeUI.Bold.With(size: 16)); disclaimer.AddText(".", t => t.Font = SegoeUI.Regular.With(size: 16)); disclaimer.NewParagraph(); disclaimer.AddText("Please direct all bug and crash reports to our GitHub repository.", t => t.Font = SegoeUI.Regular.With(size: 16)); }
public TestCaseButton(Type test) : this() { TestType = test; text.AddText(test.Name.Replace("TestCase", "")); var description = test.GetCustomAttribute<DescriptionAttribute>()?.Description; if (description != null) { text.NewLine(); text.AddText(description, t => t.TextSize = 15); } }
private void load(TextureStore store) { Children = new Drawable[] { new BufferedContainer { RelativeSizeAxes = Axes.Both, BackgroundColour = Color4.Black, BlurSigma = new Vector2(5), Child = background.CreateView().With(d => { d.RelativeSizeAxes = Axes.Both; d.SynchronisedDrawQuad = true; }) }, new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.White.Opacity(0.8f) }, new Sprite { Texture = store.Get("AcrylicNoise.png"), Colour = Color4.Black.Opacity(0.05f), Scale = new Vector2(2) }, new Container { Padding = new MarginPadding(5), RelativeSizeAxes = Axes.Both, Children = new Drawable[] { textContainer = new TextFlowContainer { Direction = FillDirection.Horizontal } } } }; textContainer.AddText(new SpriteText { Text = "mapped by ", Colour = Color4.Black }); textContainer.AddText(new SpriteTextLink(null) { Text = beatmap.Metadata.Level.CreatorName }); }
private void Load() { RelativePositionAxes = Axes.X; Add(new Box { RelativeSizeAxes = Axes.Both, Size = new Vector2(1f), }); if (Parent) { return; } Add(textFlowContainer = new TextFlowContainer { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativePositionAxes = Axes.Both, Colour = Color4.Black.Opacity(0.8f), TextAnchor = Anchor.Centre, X = 0.01f, Depth = -1f, Size = new Vector2(0f, this.DrawHeight), AutoSizeAxes = Axes.X } ); textFlowContainer.AddText($"Title: {map.DifficultyName}", x => x.Font = new FontUsage("Roboto-Medium", 20)); }
private void recreateText() { text.Clear(); //space after the title to put a space between the title and artist titleSprites = text.AddText(titleBind.Value + @" ", sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)).OfType <SpriteText>(); text.AddText(artistBind.Value, sprite => { sprite.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold); sprite.Colour = artistColour; sprite.Padding = new MarginPadding { Top = 1 }; }); }
private void log(LogEntry logEntry) { if (logEntry.Level < LogLevel.Important && logEntry.LoggerName != CONSOLE_LOG_TYPE) { return; } Color4 color; switch (logEntry.Message.Substring(0, 2)) { default: color = Color4.White; break; case "\01": color = Color4.Green; break; case "\02": color = Color4.Yellow; break; case "\03": color = Color4.Red; break; } consoleLog.AddText(logEntry.Message.StartsWith("\0") ? logEntry.Message.Substring(2) : logEntry.Message, spriteText => spriteText.Colour = color); consoleLog.NewLine(); }
public TestCaseButton(Type test) { Masking = true; TestType = test; CornerRadius = 5; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; AddRange(new Drawable[] { box = new Box { RelativeSizeAxes = Axes.Both, Colour = new Color4(140, 140, 140, 255), Alpha = 0.7f }, text = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Left = 4, Right = 4, Bottom = 2, }, } }); text.AddText(test.Name.Replace("TestCase", "")); var description = test.GetCustomAttribute <DescriptionAttribute>()?.Description; if (description != null) { text.NewLine(); text.AddText(description, t => t.TextSize = 15); } }
private void recreateText() { text.Clear(); //space after the title to put a space between the title and artist titleSprites = text.AddText(titleBind.Value + @" ", sprite => { sprite.TextSize = 16; sprite.Font = @"Exo2.0-Regular"; }); text.AddText(artistBind.Value, sprite => { sprite.TextSize = 14; sprite.Font = @"Exo2.0-Bold"; sprite.Colour = artistColour; sprite.Padding = new MarginPadding { Top = 1 }; }); }
protected override void LoadComplete() { base.LoadComplete(); Model.PerformRead(m => { var metadata = m.Metadata; var title = new RomanisableString(metadata.TitleUnicode, metadata.Title); var artist = new RomanisableString(metadata.ArtistUnicode, metadata.Artist); titlePart = text.AddText(title, sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)); titlePart.DrawablePartsRecreated += _ => updateSelectionState(true); text.AddText(@" "); // to separate the title from the artist. text.AddText(artist, sprite => { sprite.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold); sprite.Colour = colours.Gray9; sprite.Padding = new MarginPadding { Top = 1 }; }); SelectedSet.BindValueChanged(set => { bool newSelected = set.NewValue?.Equals(Model) == true; if (newSelected == selected) { return; } selected = newSelected; updateSelectionState(false); }); updateSelectionState(true); }); }
protected override void LoadAsyncComplete() { base.LoadAsyncComplete(); var title = new RomanisableString(Model.Metadata.TitleUnicode, Model.Metadata.Title); var artist = new RomanisableString(Model.Metadata.ArtistUnicode, Model.Metadata.Artist); titlePart = text.AddText(title, sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)); updateSelectionState(true); titlePart.DrawablePartsRecreated += _ => updateSelectionState(true); text.AddText(@" "); // to separate the title from the artist. text.AddText(artist, sprite => { sprite.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold); sprite.Colour = colours.Gray9; sprite.Padding = new MarginPadding { Top = 1 }; }); }
protected void MostrarAlerta(string texto, bool autoExit = false, bool autoHide = false) { contentChild.ShouldHandleInput = false; alertText.Text = ""; alertText.AddText(texto, font => { font.Font = new FontUsage(size: 50); font.Shadow = true; font.ShadowColour = Color4.Black; }); alertContainer.FadeIn(200); if (autoHide) { Scheduler.AddDelayed(() => handleAlert(false), 4000); } alertAutoExit = autoExit; alertAutoHide = autoHide; }
public EngineDisclaimer(KanojoWorksScreen nextScreen = null) { this.nextScreen = nextScreen; ValidForResume = false; InternalChildren = new Drawable[] { textFlow = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, TextAnchor = Anchor.Centre, Anchor = Anchor.Centre, Origin = Anchor.Centre, Spacing = new Vector2(0, 10), Alpha = 0 } }; textFlow.AddText("This game runs on the KanojoWorks engine built on osu!framework.", t => t.Font = KanojoWorksFont.GetFont(size: 30)); textFlow.NewParagraph(); textFlow.AddText("KanojoWorks is still a work in progress, so weirdness and bugs may occur.", t => t.Font = KanojoWorksFont.GetFont(size: 30)); }
protected override void PopIn() { _text.Scale = new Vector2(0f); _text.MoveTo(new Vector2(0f)); _text.Text = string.Empty; _text.AddText("Here are some mods!", x => x.Font = new FontUsage("Roboto", 100)); this.FadeInFromZero(1000, Easing.In); _text.FadeInFromZero(1000, Easing.InBack); _text.ScaleTo(1f, 1250, Easing.OutElastic); _text.MoveToOffset(new Vector2(0f, -0.25f), 1000, Easing.OutElastic); base.PopIn(); }
/// <summary> /// Drawable Notification /// </summary> /// <param name="text"></param> /// <param name="colourInfo"></param> /// <param name="duration">Hide after X amount of MS, -1 = PositiveInfinity</param> /// <param name="clickAction"></param> public DrawableNotification(LocalisedString text, ColourInfo colourInfo, int duration = -1, Action clickAction = null) { _clock = new StopwatchClock(); _clickAction = clickAction; _borderColour = colourInfo; _textFlowContainer = new TextFlowContainer { Direction = FillDirection.Full, AutoSizeAxes = Axes.Both, MaximumSize = new Vector2(290, float.MaxValue), Padding = new MarginPadding(10) }; _duration = duration == -1 ? Math.Max(3000, (double)(text.ToString().Length * 100)) : duration; _textFlowContainer.AddText(text); }
private Drawable createMessage() { if (string.IsNullOrEmpty(entry.MessageHtml)) { return(Empty()); } var message = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; // todo: use markdown parsing once API returns markdown message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t => { t.Font = fontMedium; t.Colour = colourProvider.Foreground1; }); return(message); }
public MainMenu() { InternalChild = new BackgroundAdjustmentHelper { OnUserDrag = handleUserDrag, OnUserScroll = handleUserScroll, Children = new Drawable[] { blurContainer = new BufferedContainer { RelativeSizeAxes = Axes.Both, Child = new Background { RelativeSizeAxes = Axes.Both }, }, helperInstructions = new Container { Alpha = 0, Margin = new MarginPadding(20), Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, AutoSizeAxes = Axes.Both, Masking = true, CornerRadius = 5.0f, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.Black, Alpha = 0.5f, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Spacing = new Vector2(0, 20), Direction = FillDirection.Vertical, Children = new Drawable[] { textFlow = new TextFlowContainer { AutoSizeAxes = Axes.Both, TextAnchor = Anchor.TopLeft, Margin = new MarginPadding { Horizontal = 20, Top = 20 }, }, new ThemedTextButton { Width = 100, Text = "Apply", Action = commitBackgroundAdjustment, Margin = new MarginPadding { Horizontal = 20, Bottom = 20 }, } }, }, }, }, }, }; textFlow.AddText("Left Mouse Button ", s => s.Font = SegoeUI.Black.With(size: 14)); textFlow.AddText("to move the background.", s => s.Font = SegoeUI.Regular.With(size: 14)); textFlow.NewParagraph(); textFlow.AddText("Mouse Scroll ", s => s.Font = SegoeUI.Black.With(size: 14)); textFlow.AddText("to resize the background.", s => s.Font = SegoeUI.Regular.With(size: 14)); AllowBackgroundAdjustments.BindValueChanged(e => helperInstructions.FadeTo(e.NewValue ? 1 : 0, 500, Easing.OutQuint)); }
private void load(OverlayColourProvider colourProvider, GameHost host) { if (post.Slug != null) { TooltipText = "view in browser"; Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug); } NewsPostBackground bg; AddRange(new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 160, Masking = true, CornerRadius = 6, Children = new Drawable[] { new DelayedLoadWrapper(bg = new NewsPostBackground(post.FirstImage) { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0 }) { RelativeSizeAxes = Axes.Both }, new DateContainer(post.PublishedAt) { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding { Top = 10, Right = 15 } } } }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 15, Vertical = 10 }, Child = main = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y } } } } }); IdleColour = colourProvider.Background4; HoverColour = colourProvider.Background3; bg.OnLoadComplete += d => d.FadeIn(250, Easing.In); main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold)); main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12)); main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)); }
public ChangelogBuild(APIChangelogBuild build) { Build = build; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; Padding = new MarginPadding { Horizontal = HORIZONTAL_PADDING }; Children = new Drawable[] { CreateHeader(), ChangelogEntries = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, }, }; foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key)) { ChangelogEntries.Add(new OsuSpriteText { Text = categoryEntries.Key, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); var fontLarge = OsuFont.GetFont(size: 18); var fontMedium = OsuFont.GetFont(size: 14); var fontSmall = OsuFont.GetFont(size: 12); foreach (APIChangelogEntry entry in categoryEntries) { LinkFlowContainer title = new LinkFlowContainer { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 5 }, }; title.AddIcon(FontAwesome.Solid.Check, t => { t.Font = fontSmall; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); title.AddText(entry.Title, t => { t.Font = fontLarge; }); if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText(" (", t => t.Font = fontLarge); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, creationParameters: t => { t.Font = fontLarge; }); title.AddText(")", t => t.Font = fontLarge); } title.AddText(" by ", t => t.Font = fontMedium); if (entry.GithubUser.UserId != null) { title.AddUserLink(new User { Username = entry.GithubUser.OsuUsername, Id = entry.GithubUser.UserId.Value }, t => t.Font = fontMedium); } else if (entry.GithubUser.GithubUrl != null) { title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = fontMedium); } else { title.AddText(entry.GithubUser.DisplayName, t => t.Font = fontSmall); } ChangelogEntries.Add(title); if (!string.IsNullOrEmpty(entry.MessageHtml)) { TextFlowContainer message = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; // todo: use markdown parsing once API returns markdown message.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => { t.Font = fontSmall; t.Colour = new Color4(235, 184, 254, 255); }); ChangelogEntries.Add(message); } } } }
private void load() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Masking = true; CornerRadius = 6; NewsBackground bg; InternalChildren = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4 }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 160, Masking = true, CornerRadius = 6, Children = new Drawable[] { new DelayedLoadWrapper(bg = new NewsBackground(post.FirstImage) { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0 }) { RelativeSizeAxes = Axes.Both }, new DateContainer(post.PublishedAt) { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding { Top = 10, Right = 15 } } } }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 15, Vertical = 10 }, Child = main = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y } } } }, new HoverClickSounds() }; bg.OnLoadComplete += d => d.FadeIn(250, Easing.In); main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold)); main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12)); main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)); }
private void Load(GameHost gameHost, CachedMap cachedMap) { IResourceStore <byte[]> store = new StorageBackedResourceStore(gameHost.Storage); ITrackStore trackStore = audio.GetTrackStore(store); var audioFile = $"{Path.GetDirectoryName(_map.Path)}{Path.DirectorySeparatorChar}{_map.AFileName}"; track = trackStore.Get(audioFile); if (track != null) { track.Volume.Value = Gameini.Get <double>(SettingsConfig.Volume); } InternalChildren = new Drawable[] { GameplayScreenLoader = new GameplayScreenLoader { RelativeSizeAxes = Axes.Both, Size = new Vector2(1f), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, rhythmBoxClockContainer = new RhythmBoxClockContainer(0) { RelativeSizeAxes = Axes.Both, Size = new Vector2(1f) }, BreakOverlay = new BreakOverlay(new Action[] { () => BreakOverlay.State.Value = Visibility.Hidden, () => ReturntoSongSelectionAfterFail.Value = true }) { RelativePositionAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(1f), Alpha = 0f, }, KeyPress[0] = GetSprite("Skin/K1", 0.3f), KeyPress[1] = GetSprite("Skin/K2", 0.4f), KeyPress[2] = GetSprite("Skin/K3", 0.5f), KeyPress[3] = GetSprite("Skin/K4", 0.6f), volume = new Volume(new Bindable <Track>(track)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(1f, 0.3f), X = 0.4f, Y = 0.2f, Alpha = 0f, }, }; BreakOverlay.State.Value = Visibility.Hidden; BreakOverlay.State.ValueChanged += async(e) => { if (e.NewValue == Visibility.Hidden) { BreakOverlay.AnimationOut(); await Task.Delay(1500); Resuming.Value = true; rhythmBoxClockContainer.Start(); track.Start(); _RbPlayfield.Clock = rhythmBoxClockContainer.RhythmBoxClock; } }; rhythmBoxClockContainer.Children = new Drawable[] { _RbPlayfield = new Playfield.Playfield(ToApplyMods) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(0.6f, 0.9f), Map = _map, Y = 0.02f }, hpbar = new HPBar(ToApplyMods) { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.8f, 1f), Colour = Color4.AliceBlue }, DispayCombo = new TextFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(0.1f), TextAnchor = Anchor.BottomLeft, }, DispayScore = new TextFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(0.1f), TextAnchor = Anchor.TopRight, X = -0.01f }, }; rhythmBoxClockContainer.IsPaused.BindTo(IsPaused); rhythmBoxClockContainer.UserPlaybackRate.BindTo(UserPlaybackRate); _RbPlayfield.Clock = rhythmBoxClockContainer.RhythmBoxClock; DispayScore.Clock = rhythmBoxClockContainer.RhythmBoxClock; DispayCombo.Clock = rhythmBoxClockContainer.RhythmBoxClock; hpbar.Clock = rhythmBoxClockContainer.RhythmBoxClock; _RbPlayfield.Resuming.BindTo(Resuming); DispayCombo.AddText("0x", x => x.Font = new FontUsage("Roboto", 40)); DispayScore.AddText("000000", x => x.Font = new FontUsage("Roboto", 40)); Score.Combo.PrivateComboBindable.ValueChanged += (e) => hpbar.CurrentValue.Value += hpbar.CalcValue(Score.Combo.currentHit); _RbPlayfield.HasFinished.ValueChanged += (e) => { if (!e.NewValue) { return; } rhythmBoxClockContainer.Stop(); var currentTime = track?.CurrentTime; track?.Stop(); _RbPlayfield.HasFinished.UnbindEvents(); cachedMap.Map = _map; cachedMap.LoadTrackFile(); cachedMap.Seek(currentTime.GetValueOrDefault()); Scheduler.AddDelayed(() => this.Expire(), 1000); LoadComponentAsync(new ResultScreen(), this.Push); }; ReturntoSongSelectionAfterFail.ValueChanged += (e) => { cachedMap.Map = _map; cachedMap.LoadTrackFile(); cachedMap.Seek(track.CurrentTime); Selection songSelction; LoadComponent(songSelction = new Selection()); Schedule(() => this.Push(songSelction)); }; _RbPlayfield.CanStart.ValueChanged += (e) => { if (e.NewValue) { Load(1000); } }; }
public void TestAddTextWithTextAnchor() { AddStep("change text anchor", () => textContainer.TextAnchor = Anchor.TopCentre); AddStep("add text", () => textContainer.AddText("added text")); AddAssert("children have correct anchors", () => textContainer.Children.All(c => c.Anchor == Anchor.TopCentre && c.Origin == Anchor.TopCentre)); }
private void load(OsuColour colours, OverlayColourProvider colourProvider) { foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key)) { ChangelogEntries.Add(new OsuSpriteText { Text = categoryEntries.Key, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); var fontLarge = OsuFont.GetFont(size: 16); var fontMedium = OsuFont.GetFont(size: 12); foreach (var entry in categoryEntries) { var entryColour = entry.Major ? colours.YellowLight : Color4.White; LinkFlowContainer title; var titleContainer = new Container { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Vertical = 5 }, Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Size = new Vector2(10), Icon = entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus, Colour = entryColour.Opacity(0.5f), Margin = new MarginPadding { Right = 5 }, }, title = new LinkFlowContainer { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, } } }; title.AddText(entry.Title, t => { t.Font = fontLarge; t.Colour = entryColour; }); if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText(" (", t => { t.Font = fontLarge; t.Colour = entryColour; }); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, creationParameters: t => { t.Font = fontLarge; t.Colour = entryColour; }); title.AddText(")", t => { t.Font = fontLarge; t.Colour = entryColour; }); } title.AddText("by ", t => { t.Font = fontMedium.With(italics: true); t.Colour = entryColour; t.Padding = new MarginPadding { Left = 10 }; }); if (entry.GithubUser.UserId != null) { title.AddUserLink(new User { Username = entry.GithubUser.OsuUsername, Id = entry.GithubUser.UserId.Value }, t => { t.Font = fontMedium.With(italics: true); t.Colour = entryColour; }); } else if (entry.GithubUser.GithubUrl != null) { title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t => { t.Font = fontMedium.With(italics: true); t.Colour = entryColour; }); } else { title.AddText(entry.GithubUser.DisplayName, t => { t.Font = fontMedium.With(italics: true); t.Colour = entryColour; }); } ChangelogEntries.Add(titleContainer); if (!string.IsNullOrEmpty(entry.MessageHtml)) { var message = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; // todo: use markdown parsing once API returns markdown message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t => { t.Font = fontMedium; t.Colour = colourProvider.Foreground1; }); ChangelogEntries.Add(message); } } } }
private void load(OsuColour colours) { foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key)) { ChangelogEntries.Add(new OsuSpriteText { Text = categoryEntries.Key, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); var fontLarge = OsuFont.GetFont(size: 18); var fontMedium = OsuFont.GetFont(size: 14); var fontSmall = OsuFont.GetFont(size: 12); foreach (APIChangelogEntry entry in categoryEntries) { LinkFlowContainer title = new LinkFlowContainer { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 5 }, }; var entryColour = entry.Major ? colours.YellowLight : Color4.White; title.AddIcon(entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus, t => { t.Font = fontSmall; t.Colour = entryColour; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); title.AddText(entry.Title, t => { t.Font = fontLarge; t.Colour = entryColour; }); if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText(" (", t => { t.Font = fontLarge; t.Colour = entryColour; }); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, creationParameters: t => { t.Font = fontLarge; t.Colour = entryColour; }); title.AddText(")", t => { t.Font = fontLarge; t.Colour = entryColour; }); } title.AddText(" by ", t => { t.Font = fontMedium; t.Colour = entryColour; }); if (entry.GithubUser.UserId != null) { title.AddUserLink(new User { Username = entry.GithubUser.OsuUsername, Id = entry.GithubUser.UserId.Value }, t => { t.Font = fontMedium; t.Colour = entryColour; }); } else if (entry.GithubUser.GithubUrl != null) { title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => { t.Font = fontMedium; t.Colour = entryColour; }); } else { title.AddText(entry.GithubUser.DisplayName, t => { t.Font = fontSmall; t.Colour = entryColour; }); } ChangelogEntries.Add(title); if (!string.IsNullOrEmpty(entry.MessageHtml)) { TextFlowContainer message = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; // todo: use markdown parsing once API returns markdown message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t => { t.Font = fontSmall; t.Colour = new Color4(235, 184, 254, 255); }); ChangelogEntries.Add(message); } } } }
private void Load() { RelativeSizeAxes = Axes.X; Size = new Vector2(1f, 0f); AutoSizeAxes = Axes.Y; Children = new Drawable[] { parentBox = new MapPackBox { RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.X, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Size = new Vector2(1f, YSize), Colour = Colour, Parent = true, filter = filter, Depth = 0, map = Maps[0], }, textFlowContainer = new TextFlowContainer { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativePositionAxes = Axes.X, Size = new Vector2(0f, parentBox.Height), AutoSizeAxes = Axes.X, TextAnchor = Anchor.Centre, X = parentBox.X, Y = parentBox.Y, Depth = -1f, Text = string.Empty, }, textFlowContainer2 = new TextFlowContainer { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativePositionAxes = Axes.X, Size = new Vector2(0f, parentBox.Height), AutoSizeAxes = Axes.X, TextAnchor = Anchor.Centre, X = parentBox.X, Y = parentBox.Y, Depth = -1f, Text = string.Empty, }, }; textFlowContainer.Colour = Color4.Black.Opacity(0.8f); textFlowContainer2.Colour = Color4.Black.Opacity(0.5f); textFlowContainer2.Height = textFlowContainer.Height = parentBox.Height; textFlowContainer.AddText($"Title: {Maps[0].Title}", x => x.Font = new FontUsage("Roboto", 30)); textFlowContainer2.AddText($"Artist: {Maps[0].Artist}", x => x.Font = new FontUsage("Roboto", 25)); textFlowContainer.MoveToOffset(new Vector2(0f, -(textFlowContainer.Height / 5))); textFlowContainer2.MoveToOffset(new Vector2(0f, (textFlowContainer2.Height / 4))); //TODO: float - int for (float i = 0; i < Maps.Length; i++) { Add(new MapPackBox((parentBox.Height * (i + 1)) - (((i + 1) * 10) - 10f)) { RelativeSizeAxes = Axes.X, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Size = new Vector2(0.9f - (i / (i + Maps.Length)), YChildSize), Colour = Color4.DarkGreen, filter = filter, map = Maps[(int)i], Invoke = InvokeBox, bindablePath = bindablePath, }); } }
private void load(TextureStore textures) { RelativeSizeAxes = Axes.Both; Masking = true; BorderColour = Colour4.Black; BorderThickness = 3.5f; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Colour4(106, 100, 104, 255) }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Padding = new MarginPadding(40), Spacing = new Vector2(20), Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Width = .3f, Child = gameImage = new Sprite { RelativeSizeAxes = Axes.Both, Texture = textures.Get("Images/gtg") } }, new Container { RelativeSizeAxes = Axes.Both, Width = .5f, Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Child = text = new TextFlowContainer { RelativeSizeAxes = Axes.Both } }, }, }, }, }, new Container { RelativeSizeAxes = Axes.Both, Width = .2f, Padding = new MarginPadding { Right = 80 }, Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(30), Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Width = .5f, Icon = FontAwesome.Solid.Users, }, new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = game.Minplayers + "-" + game.Maxplayers, Font = new FontUsage(size: GameNameSize), }, }, }, }, }, }, }; Schedule(async() => { gameImage.Texture = await textures.GetAsync(@$ "https://gamestogo.company/api/Games/DownloadFile/{game.Image}"); }); text.AddText(game.Name, f => f.Font = new FontUsage(size: GameNameSize)); text.AddParagraph(@$ "Hecho por: {game.Creator.Username}", t => t.Font = new FontUsage(size: MadeBySize)); }
public DrawableMedal(Medal medal) { this.medal = medal; Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); FillFlowContainer infoFlow; Children = new Drawable[] { medalContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Alpha = 0f, Children = new Drawable[] { medalSprite = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(0.81f), }, medalGlow = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, }, }, }, unlocked = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "Medal Unlocked".ToUpperInvariant(), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, Scale = new Vector2(1f / scale_when_unlocked), }, infoFlow = new FillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.6f, Direction = FillDirection.Vertical, Spacing = new Vector2(0f, 5f), Children = new Drawable[] { name = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = medal.Name, TextSize = 20, Font = @"Exo2.0-Bold", Alpha = 0f, Scale = new Vector2(1f / scale_when_full), }, description = new OsuTextFlowContainer { TextAnchor = Anchor.TopCentre, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Alpha = 0f, Scale = new Vector2(1f / scale_when_full), }, }, }, }; description.AddText(medal.Description, s => { s.Anchor = Anchor.TopCentre; s.Origin = Anchor.TopCentre; s.TextSize = 16; }); medalContainer.OnLoadComplete = d => { unlocked.Position = new Vector2(0f, medalContainer.DrawSize.Y / 2 + 10); infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90); }; }
public BeatmapUsecase(PAMetadata Metadata) { meta = Metadata; switch (meta.Song.Difficulty) { case 0: difficultyColor = StreamToolColors.Easy; break; case 1: difficultyColor = StreamToolColors.Normal; break; case 2: difficultyColor = StreamToolColors.Hard; break; case 3: difficultyColor = StreamToolColors.Expert; break; case 4: difficultyColor = StreamToolColors.ExpertPlus; break; default: difficultyColor = StreamToolColors.Unknown; break; } Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.X, Size = new Vector2(1f, 5), Colour = difficultyColor, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre }, new Container { Padding = new MarginPadding(5), RelativeSizeAxes = Axes.Both, Children = new Drawable[] { textContainer = new TextFlowContainer { Direction = FillDirection.Horizontal }, useButton = new Button { BackgroundColour = StreamToolColors.Primary, Text = "Set", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, CornerRadius = 5, Masking = true, Size = new Vector2(50, 23), Action = () => { Select?.Invoke(); Selected.Value = !Selected.Value; //useButton.TransformTo(nameof(useButton.BackgroundColour), Selected.Value ? StreamToolColors.Used : StreamToolColors.Primary, 200); } } } } }; textContainer.AddText(new SpriteText { Text = "mapped by ", Colour = Color4.Black }); textContainer.AddText(new SpriteTextLink(null) { Text = meta.Creator.Name, TooltipText = "Link is not working due to some inconveniences." }); }