mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Refactor3
This commit is contained in:
@ -23,7 +23,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep(@"Show", changelog.Show);
|
AddStep(@"Show", changelog.Show);
|
||||||
AddRepeatStep(@"Toggle Release Stream", () =>
|
AddRepeatStep(@"Toggle Release Stream", () =>
|
||||||
{
|
{
|
||||||
if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate();
|
if (isLoaded)
|
||||||
|
changelog.Streams.BadgesContainer.Children[index].Activate();
|
||||||
indexIncrement();
|
indexIncrement();
|
||||||
}, 6);
|
}, 6);
|
||||||
AddStep(@"Listing", changelog.ActivateListing);
|
AddStep(@"Listing", changelog.ActivateListing);
|
||||||
@ -31,7 +32,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddWaitStep(3);
|
AddWaitStep(3);
|
||||||
AddStep(@"Show with Release Stream", () =>
|
AddStep(@"Show with Release Stream", () =>
|
||||||
{
|
{
|
||||||
if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate();
|
if (isLoaded)
|
||||||
|
changelog.Streams.BadgesContainer.Children[index].Activate();
|
||||||
changelog.Show();
|
changelog.Show();
|
||||||
indexIncrement();
|
indexIncrement();
|
||||||
});
|
});
|
||||||
@ -48,7 +50,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddWaitStep(3);
|
AddWaitStep(3);
|
||||||
AddStep(@"Activate release", () =>
|
AddStep(@"Activate release", () =>
|
||||||
{
|
{
|
||||||
if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate();
|
if (isLoaded)
|
||||||
|
changelog.Streams.BadgesContainer.Children[index].Activate();
|
||||||
indexIncrement();
|
indexIncrement();
|
||||||
});
|
});
|
||||||
AddStep(@"Show with listing", () =>
|
AddStep(@"Show with listing", () =>
|
||||||
@ -56,6 +59,18 @@ namespace osu.Game.Tests.Visual
|
|||||||
changelog.ActivateListing();
|
changelog.ActivateListing();
|
||||||
changelog.Show();
|
changelog.Show();
|
||||||
});
|
});
|
||||||
|
AddStep(@"Activate Release", () =>
|
||||||
|
{
|
||||||
|
if (isLoaded)
|
||||||
|
changelog.Streams.BadgesContainer.Children[index].Activate();
|
||||||
|
});
|
||||||
|
AddStep(@"Activate Listing", changelog.ActivateListing);
|
||||||
|
AddStep(@"Activate Release", () =>
|
||||||
|
{
|
||||||
|
if (isLoaded)
|
||||||
|
changelog.Streams.BadgesContainer.Children[index].Activate();
|
||||||
|
indexIncrement();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string TooltipText { get; set; }
|
public string TooltipText { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,6 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty("created_at")]
|
[JsonProperty("created_at")]
|
||||||
public DateTimeOffset CreatedAt { get; set; }
|
public DateTimeOffset CreatedAt { get; set; }
|
||||||
|
|
||||||
[JsonProperty("disqus_id")]
|
|
||||||
public string DisqusId { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("disqus_title")]
|
|
||||||
public string DisqusTitle { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("update_stream")]
|
[JsonProperty("update_stream")]
|
||||||
public UpdateStream UpdateStream { get; set; }
|
public UpdateStream UpdateStream { get; set; }
|
||||||
|
|
||||||
|
@ -60,9 +60,8 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
{
|
{
|
||||||
SelectedRelease = streamBadge.ChangelogEntry;
|
SelectedRelease = streamBadge.ChangelogEntry;
|
||||||
foreach (StreamBadge item in BadgesContainer.Children)
|
foreach (StreamBadge item in BadgesContainer.Children)
|
||||||
{
|
if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id)
|
||||||
if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) item.Deactivate();
|
item.Deactivate();
|
||||||
}
|
|
||||||
OnSelection?.Invoke();
|
OnSelection?.Invoke();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -77,11 +76,10 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
if (SelectedRelease != null)
|
if (SelectedRelease != null)
|
||||||
{
|
{
|
||||||
if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.Id)
|
if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.Id)
|
||||||
{
|
|
||||||
streamBadge.Deactivate();
|
streamBadge.Deactivate();
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else streamBadge.Deactivate();
|
streamBadge.Deactivate();
|
||||||
}
|
}
|
||||||
return base.OnHover(state);
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
@ -89,9 +87,8 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
if (SelectedRelease == null)
|
if (SelectedRelease == null)
|
||||||
{
|
foreach (StreamBadge streamBadge in BadgesContainer.Children)
|
||||||
foreach (StreamBadge streamBadge in BadgesContainer.Children) streamBadge.Activate(true);
|
streamBadge.Activate(true);
|
||||||
}
|
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ 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)
|
||||||
{
|
{
|
||||||
LineBadge.IsCollapsed = false;
|
LineBadge.IsCollapsed = false;
|
||||||
if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText;
|
if (!string.IsNullOrEmpty(displayText))
|
||||||
|
Text.Text = displayText;
|
||||||
Text.MoveToY(0, duration, easing)
|
Text.MoveToY(0, duration, easing)
|
||||||
.FadeIn(duration, easing);
|
.FadeIn(duration, easing);
|
||||||
}
|
}
|
||||||
@ -111,7 +112,8 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
if (!IsActivated) sampleHover?.Play();
|
if (!IsActivated)
|
||||||
|
sampleHover?.Play();
|
||||||
return base.OnHover(state);
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
if (IsActivated == false) LineBadge.ResizeHeightTo(1, LineBadge.TransitionDuration, Easing.Out);
|
if (!IsActivated)
|
||||||
|
LineBadge.ResizeHeightTo(1, LineBadge.TransitionDuration, Easing.Out);
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +23,12 @@ namespace osu.Game.Overlays.Changelog.Header
|
|||||||
{
|
{
|
||||||
if (IsActivated)
|
if (IsActivated)
|
||||||
{
|
{
|
||||||
if (displayText != Text.Text) ChangeText(transition_duration, displayText);
|
if (displayText != Text.Text)
|
||||||
|
ChangeText(transition_duration, displayText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ShowText(transition_duration, displayText);
|
ShowText(transition_duration, displayText);
|
||||||
IsActivated = true;
|
IsActivated = true;
|
||||||
}
|
|
||||||
SampleActivate?.Play();
|
SampleActivate?.Play();
|
||||||
OnActivation?.Invoke();
|
OnActivation?.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Text = ChangelogEntry.Users > 0 ?
|
Text = ChangelogEntry.Users > 0 ?
|
||||||
string.Join(" ", ChangelogEntry.Users.ToString("N0"), "users online"):
|
string.Format($"{ChangelogEntry.Users:N0} users online") :
|
||||||
null,
|
null,
|
||||||
TextSize = 12,
|
TextSize = 12,
|
||||||
Font = @"Exo2.0-Regular",
|
Font = @"Exo2.0-Regular",
|
||||||
@ -87,7 +87,8 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
isActivated = true;
|
isActivated = true;
|
||||||
this.FadeIn(transition_duration);
|
this.FadeIn(transition_duration);
|
||||||
lineBadge.IsCollapsed = false;
|
lineBadge.IsCollapsed = false;
|
||||||
if (!withoutHeaderUpdate) OnActivation?.Invoke();
|
if (!withoutHeaderUpdate)
|
||||||
|
OnActivation?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
|
@ -96,9 +96,11 @@ namespace osu.Game.Overlays
|
|||||||
content.Clear();
|
content.Clear();
|
||||||
// should add listing to content here
|
// should add listing to content here
|
||||||
if (!Streams.IsHovered)
|
if (!Streams.IsHovered)
|
||||||
foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Activate(true);
|
foreach (StreamBadge item in Streams.BadgesContainer.Children)
|
||||||
|
item.Activate(true);
|
||||||
else
|
else
|
||||||
foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate();
|
foreach (StreamBadge item in Streams.BadgesContainer.Children)
|
||||||
|
item.Deactivate();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,13 +114,10 @@ namespace osu.Game.Overlays
|
|||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case GlobalAction.Back:
|
case GlobalAction.Back:
|
||||||
if (header.IsListingActivated()) State = Visibility.Hidden;
|
if (header.IsListingActivated())
|
||||||
|
State = Visibility.Hidden;
|
||||||
// the problem here is that when hovering over the builds' container
|
else
|
||||||
// and pressing back, they don't lower their opacity they're rehovered on
|
header.ActivateListing();
|
||||||
else header.ActivateListing();
|
|
||||||
return true;
|
|
||||||
case GlobalAction.Select:
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,9 +149,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Streams.BadgesContainer.Clear();
|
Streams.BadgesContainer.Clear();
|
||||||
foreach (APIChangelog item in res)
|
foreach (APIChangelog item in res)
|
||||||
{
|
|
||||||
Streams.BadgesContainer.Add(new StreamBadge(item));
|
Streams.BadgesContainer.Add(new StreamBadge(item));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
api.Queue(req);
|
api.Queue(req);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user