mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Streams3
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -12,6 +13,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
private ChangelogOverlay changelog;
|
private ChangelogOverlay changelog;
|
||||||
private int releaseStreamCount;
|
private int releaseStreamCount;
|
||||||
private int index;
|
private int index;
|
||||||
|
private void indexIncrement() => index = (index == releaseStreamCount - 1) ? 0 : index + 1;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
@ -22,16 +24,46 @@ namespace osu.Game.Tests.Visual
|
|||||||
releaseStreamCount = changelog.streams.badgesContainer.Children.Count;
|
releaseStreamCount = changelog.streams.badgesContainer.Children.Count;
|
||||||
|
|
||||||
AddStep(@"Show", changelog.Show);
|
AddStep(@"Show", changelog.Show);
|
||||||
AddRepeatStep(@"Toggle Release Stream", () => {
|
AddRepeatStep(@"Toggle Release Stream", () =>
|
||||||
|
{
|
||||||
changelog.streams.badgesContainer.Children[index].Activate();
|
changelog.streams.badgesContainer.Children[index].Activate();
|
||||||
index = (index == releaseStreamCount - 1) ? 0 : index + 1;
|
indexIncrement();
|
||||||
}, releaseStreamCount);
|
}, releaseStreamCount);
|
||||||
AddStep(@"Listing", changelog.header.ActivateListing);
|
AddStep(@"Listing", changelog.ActivateListing);
|
||||||
|
AddStep(@"Hide", changelog.Hide);
|
||||||
|
AddWaitStep(4);
|
||||||
|
AddStep(@"Show with Release Stream", () =>
|
||||||
|
{
|
||||||
|
changelog.streams.badgesContainer.Children[index].Activate();
|
||||||
|
changelog.Show();
|
||||||
|
indexIncrement();
|
||||||
|
});
|
||||||
|
AddWaitStep(4);
|
||||||
|
AddStep(@"Hide", changelog.Hide);
|
||||||
|
AddWaitStep(4);
|
||||||
|
AddStep(@"Show with listing", () =>
|
||||||
|
{
|
||||||
|
// .maybe changelog should have a function that does header.ActivateListing()
|
||||||
|
changelog.ActivateListing();
|
||||||
|
changelog.Show();
|
||||||
|
});
|
||||||
|
AddWaitStep(4);
|
||||||
|
AddStep(@"Hide", changelog.Hide);
|
||||||
|
AddWaitStep(4);
|
||||||
|
AddStep(@"Activate release", () =>
|
||||||
|
{
|
||||||
|
changelog.streams.badgesContainer.Children[index].Activate();
|
||||||
|
indexIncrement();
|
||||||
|
});
|
||||||
|
AddStep(@"Show with listing", () =>
|
||||||
|
{
|
||||||
|
changelog.ActivateListing();
|
||||||
|
changelog.Show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestCaseChangelog()
|
public TestCaseChangelog()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,9 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
{
|
{
|
||||||
Top = 10,
|
Top = 10,
|
||||||
Left = 7,
|
Left = 7,
|
||||||
Right = 9,
|
// + chevron size, and account for gained space on left by
|
||||||
|
// listing's font draw width being smaller
|
||||||
|
Right = 18,
|
||||||
Bottom = 15,
|
Bottom = 15,
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -37,18 +37,10 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
|
|
||||||
public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(displayText))
|
lineBadge.IsCollapsed = false;
|
||||||
{
|
if (!string.IsNullOrEmpty(displayText)) text.Text = displayText;
|
||||||
text.Text = displayText;
|
|
||||||
}
|
|
||||||
|
|
||||||
text.MoveToY(0, duration, easing)
|
text.MoveToY(0, duration, easing)
|
||||||
.FadeIn(duration, easing)
|
.FadeIn(duration, easing);
|
||||||
.Finally(d => {
|
|
||||||
// waiting until text is drawn to use its DrawWidth
|
|
||||||
UpdateBadgeWidth();
|
|
||||||
lineBadge.IsCollapsed = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <param name="duration">
|
/// <param name="duration">
|
||||||
@ -61,19 +53,15 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
.FadeOut(duration, easing)
|
.FadeOut(duration, easing)
|
||||||
.Then()
|
.Then()
|
||||||
.MoveToY(0, duration, easing)
|
.MoveToY(0, duration, easing)
|
||||||
.FadeIn(duration, easing)
|
.FadeIn(duration, easing);
|
||||||
.OnComplete(dd => {
|
|
||||||
UpdateBadgeWidth();
|
|
||||||
lineBadge.IsCollapsed = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// since using .finally/.oncomplete after first fadeout made the badge
|
// since using .finally/.oncomplete after first fadeout made the badge
|
||||||
// not hide sometimes in visual tests(because FinishTransforms()/CancelTransforms()
|
// not hide sometimes in visual tests(because FinishTransforms()/CancelTransforms()
|
||||||
// didn't apply to transforms that come after the .finally), I'm using a scheduler here
|
// didn't apply to transforms that come after the .finally), I'm using a scheduler here
|
||||||
Scheduler.AddDelayed(() =>
|
Scheduler.AddDelayed(() =>
|
||||||
{
|
{
|
||||||
//lineBadge.ResizeWidthTo(0); // resizes when not visible
|
|
||||||
if (!string.IsNullOrEmpty(displayText)) text.Text = displayText;
|
if (!string.IsNullOrEmpty(displayText)) text.Text = displayText;
|
||||||
|
lineBadge.IsCollapsed = false;
|
||||||
}, duration);
|
}, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,13 +81,13 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
{
|
{
|
||||||
Top = 5,
|
Top = 5,
|
||||||
Bottom = 15,
|
Bottom = 15,
|
||||||
Left = 10,
|
|
||||||
Right = 10,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lineBadge = new LineBadge(startCollapsed)
|
lineBadge = new LineBadge(startCollapsed)
|
||||||
{
|
{
|
||||||
|
Width = 1,
|
||||||
Colour = badgeColour,
|
Colour = badgeColour,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -115,7 +103,5 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
lineBadge.IsCollapsed = false;
|
lineBadge.IsCollapsed = false;
|
||||||
text.Font = "Exo2.0-Bold";
|
text.Font = "Exo2.0-Bold";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateBadgeWidth() => lineBadge.ResizeWidthTo(text.DrawWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,11 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
text.Anchor = Anchor.TopCentre;
|
text.Anchor = Anchor.TopCentre;
|
||||||
text.Origin = Anchor.TopCentre;
|
text.Origin = Anchor.TopCentre;
|
||||||
|
|
||||||
|
// I'm using this for constant badge width here, so that the whole
|
||||||
|
// thing doesn't jump left/right when listing's size changes
|
||||||
|
// due to different font weight (and thus width)
|
||||||
|
lineBadge.RelativeSizeAxes = Axes.None;
|
||||||
|
|
||||||
// this doesn't work without the scheduler
|
// this doesn't work without the scheduler
|
||||||
// (because the text isn't yet fully drawn when it's loaded?)
|
// (because the text isn't yet fully drawn when it's loaded?)
|
||||||
text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth);
|
text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth);
|
||||||
@ -57,5 +62,7 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
if (lineBadge.IsCollapsed) lineBadge.ResizeHeightTo(1, lineBadge.TransitionDuration);
|
if (lineBadge.IsCollapsed) lineBadge.ResizeHeightTo(1, lineBadge.TransitionDuration);
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateBadgeWidth() => lineBadge.ResizeWidthTo(text.DrawWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
|
|
||||||
public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText)
|
public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText)
|
||||||
{
|
{
|
||||||
this.listingBadge = listingBadge;
|
|
||||||
text.Font = "Exo2.0-Bold";
|
text.Font = "Exo2.0-Bold";
|
||||||
text.Y = 20;
|
text.Y = 20;
|
||||||
text.Alpha = 0;
|
text.Alpha = 0;
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
private readonly ScrollContainer scroll;
|
private readonly ScrollContainer scroll;
|
||||||
|
|
||||||
public readonly ChangelogHeader header;
|
private ChangelogHeader header;
|
||||||
public readonly ChangelogStreams streams;
|
public readonly ChangelogStreams streams;
|
||||||
|
|
||||||
protected Color4 purple = new Color4(191, 4, 255, 255);
|
protected Color4 purple = new Color4(191, 4, 255, 255);
|
||||||
@ -87,6 +87,8 @@ namespace osu.Game.Overlays
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ActivateListing() => header.ActivateListing();
|
||||||
|
|
||||||
// receive input outside our bounds so we can trigger a close event on ourselves.
|
// receive input outside our bounds so we can trigger a close event on ourselves.
|
||||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user