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