-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add replay / spectator mode scrolling text back #36911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8b51e0e
Add replay / spectator mode scrolling text back
peppy 08b64f5
Fix broken sizing
peppy 6c4fac1
Adjust text when replays are involved
peppy 6046143
Fix autoplay having nonsense timestamp
peppy 2d90e5e
Make scrolling message display underneath settings
peppy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
| // See the LICENCE file in the repository root for full licence text. | ||
|
|
||
| using osu.Framework.Graphics; | ||
| using osu.Framework.Graphics.Containers; | ||
|
|
||
| namespace osu.Game.Screens.Play | ||
| { | ||
| public partial class ScrollingMessage : CompositeDrawable | ||
| { | ||
| private readonly Drawable messageContent; | ||
|
|
||
| public ScrollingMessage(Drawable messageContent) | ||
| { | ||
| RelativeSizeAxes = Axes.X; | ||
| AutoSizeAxes = Axes.Y; | ||
|
|
||
| InternalChild = this.messageContent = messageContent; | ||
| } | ||
|
|
||
| protected override void LoadComplete() | ||
| { | ||
| base.LoadComplete(); | ||
|
|
||
| this.FadeInFromZero(2000, Easing.OutQuint); | ||
| resetMessagePosition(); | ||
| } | ||
|
|
||
| protected override void Update() | ||
| { | ||
| base.Update(); | ||
|
|
||
| if (messageContent.X + messageContent.DrawWidth > 0) | ||
| messageContent.X -= (float)Clock.ElapsedFrameTime * 0.05f; | ||
| else | ||
| resetMessagePosition(); | ||
| } | ||
|
|
||
| private void resetMessagePosition() | ||
| { | ||
| messageContent.X = DrawWidth + 10; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
| // See the LICENCE file in the repository root for full licence text. | ||
|
|
||
| using System; | ||
| using osu.Framework.Allocation; | ||
| using osu.Framework.Bindables; | ||
| using osu.Framework.Extensions.LocalisationExtensions; | ||
| using osu.Framework.Graphics; | ||
| using osu.Framework.Localisation; | ||
| using osu.Game.Configuration; | ||
| using osu.Game.Graphics; | ||
| using osu.Game.Graphics.Sprites; | ||
|
|
||
| namespace osu.Game.Screens.Ranking.Expanded | ||
| { | ||
| public partial class PlayedOnText : OsuSpriteText | ||
| { | ||
| private readonly DateTimeOffset time; | ||
| private readonly bool withPrefix; | ||
| private readonly Bindable<bool> prefer24HourTime = new Bindable<bool>(); | ||
|
|
||
| public PlayedOnText(DateTimeOffset time, bool withPrefix) | ||
| { | ||
| this.time = time; | ||
| this.withPrefix = withPrefix; | ||
|
|
||
| Anchor = Anchor.BottomCentre; | ||
| Origin = Anchor.BottomCentre; | ||
| Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold); | ||
| } | ||
|
|
||
| [BackgroundDependencyLoader] | ||
| private void load(OsuConfigManager configManager) | ||
| { | ||
| configManager.BindWith(OsuSetting.Prefer24HourTime, prefer24HourTime); | ||
| } | ||
|
|
||
| protected override void LoadComplete() | ||
| { | ||
| base.LoadComplete(); | ||
|
|
||
| prefer24HourTime.BindValueChanged(_ => updateDisplay(), true); | ||
| } | ||
|
|
||
| private void updateDisplay() | ||
| { | ||
| var timeText = time.ToLocalTime().ToLocalisableString(prefer24HourTime.Value ? @"d MMMM yyyy HH:mm" : @"d MMMM yyyy h:mm tt"); | ||
|
|
||
| if (withPrefix) | ||
| Text = LocalisableString.Format("Played on {0}", timeText); | ||
| else | ||
| Text = timeText; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For when is this TODO? Is it for this PR or for an indeterminate future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the latter. i'd want to get a designer involved. arguably that should be done before implementing this at all 🤷