-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
The Everything Update (UI Overhaul + Bug Fixes) #30
base: main
Are you sure you want to change the base?
Conversation
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.
Finally got to review this. See the comments for details.
ScoreSaber/UI/Leaderboard/ScoreSaberLeaderboardViewController.cs
Outdated
Show resolved
Hide resolved
ScoreSaber/UI/Leaderboard/ScoreSaberLeaderboardViewController.cs
Outdated
Show resolved
Hide resolved
ScoreSaber/UI/Leaderboard/ScoreSaberLeaderboardViewController.cs
Outdated
Show resolved
Hide resolved
} | ||
|
||
return currentNode; | ||
_lastLocatedNode = _beatmapData.allBeatmapDataItems.Find(_beatmapDataItemsCache[Math.Max(0, high)]); |
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.
sorry to disappoint you, but this operation alone is O(n), completely making your binary search useless. You need to cache the actual LinkedList nodes, not just their content (please verify that those are actually consistent, i.e. can be cached).
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.
Furthermore it is not consistent with your old code. Your old code returned null if you scrolled to the start of the map.
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.
Fixed
ScoreSaber/UI/Leaderboard/ScoreSaberLeaderboardViewController.cs
Outdated
Show resolved
Hide resolved
gameMode = Services.GameMode.practice; | ||
|
||
// this is to privatise the practice mode song, as it would be exposed in the rich presence, still not shown in UI though. | ||
var songeventPrivate = new SongRichPresenceInfo(_richPresenceService.TimeRightNow, gameMode, |
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.
Nitpick but, songEventPrivate
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.
fixed
startTime = (int)__instance._practiceViewController._practiceSettings.startSongTime; | ||
} | ||
|
||
var songevent = CreateSongStartEvent(__instance.selectedBeatmapLevel, __instance.selectedBeatmapKey, gameplayModifiers, startTime, gameMode); |
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.
Same as above
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.
fixed
@@ -16,20 +18,25 @@ public LeaderboardService() { | |||
Plugin.Log.Debug("LeaderboardService Setup"); | |||
} | |||
|
|||
public async Task<LeaderboardMap> GetLeaderboardData(int maxMultipliedScore, BeatmapLevel beatmapLevel, BeatmapKey beatmapKey, PlatformLeaderboardsModel.ScoresScope scope, int page, PlayerSpecificSettings playerSpecificSettings, bool filterAroundCountry = false) { | |||
public async Task<LeaderboardMap> GetLeaderboardData(int maxMultipliedScore, BeatmapLevel beatmapLevel, BeatmapKey beatmapKey, ScoreSaber.UI.Leaderboard.ScoreSaberLeaderboardViewController.ScoreSaberScoresScope scope, int page, PlayerSpecificSettings playerSpecificSettings) { |
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.
We've imported ScoreSaber.UI.Leaderboard
above, why are we accessing it the long way here.
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.
fixed
|
||
try { | ||
var socketOptions = new Socket.Options(new JsonMessageSerializer()); | ||
var socketAddress = "wss://ssrt.bzaz.au/socket"; // change to scoresaber subdomain once ready. |
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.
wss://realtime.scoresaber.com/socket
Should be a constant defined outside of the method, should build off of the baseUrl defined Plugin.cs
however this was implemented
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.
i made it a constant within the file, building off of the baseUrl would be difficult because its the api url, where this is the socket
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 baseUrl should look like scoresaber.com
, everything else should build off of this base.
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.
implemented
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.
Wouldn't it make more sense to have not a single baseUrl, but instead multiple baseUrls for the different parts (still all stored at the same spot). That way it would be much easier to test individual component changes locally without having to deploy a full blown backend with all parts/components each time.
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.
Create a new namespace and folder for this. Organize it properly e.g: models go in a Models folder, and classes should be in separate files and well-structured. The current setup isn’t scalable since our realtime functionality will expand beyond live presence in the 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.
Fixed
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.
Services
usually refer to ScoreSaber communicating with an external source or larger functionality, while I'm not happy with our current structure and it does need refactoring, this is a UI utility.
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.
Made it TweeningUtils
mapPresence.gameObject.SetActive(true); | ||
mapPresenceTitle.gameObject.SetActive(true); | ||
mapImagePresence.SetImageAsync($"https://cdn.scoresaber.com/covers/{_richPresence.state.currentMap.Hash}.png").RunTask(); | ||
} |
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.
Build this url from a constant baseUrl
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.
Fixed
Plugin.Log.Error($"BeatmapDownloader is null, install a mod to [APP] that injects IScoreSaberBeatmapDownloader"); | ||
} | ||
// load sprites | ||
UnityMainThreadTaskScheduler.Factory.StartNew(() => BeatSaberMarkupLanguage.Utilities.LoadSpriteFromAssemblyAsync("ScoreSaber.Resources.Online.png")).ContinueWith(x => { _onlineSprite = x.Result.Result; }); |
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.
We reference these strings quite frequently (later on in the file too). We should have one source of truth for them.
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.
Made constants
|
||
[UIAction("OpenLeaderboardPage")] | ||
internal void OpenLeaderboardPage() { | ||
Application.OpenURL($"https://scoresaber.com/leaderboard/{_leaderboardService.currentLoadedLeaderboard.leaderboardInfoMap.leaderboardInfo.id}"); |
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.
Build from BaseURL
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.
Fixed
_panelView.statusWasSelected = delegate () { | ||
if (_leaderboardService.currentLoadedLeaderboard == null) { return; } | ||
_parserParams.EmitEvent("close-modals"); | ||
Application.OpenURL($"https://scoresaber.com/leaderboard/{_leaderboardService.currentLoadedLeaderboard.leaderboardInfoMap.leaderboardInfo.id}"); |
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.
Build from BaseURL
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.
fixed
|
||
UnityMainThreadTaskScheduler.Factory.StartNew(async () => { | ||
if (!Plugin.Settings.hasAcceptedRichPresenceDisclaimer) { | ||
await Task.Delay(500); |
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.
Do we have a runtime issue if this delay doesn't exist or is it purely for UX? If it's for UX, this is fine. But if we're avoiding a runtime issue this isn't a stable fix and should be addressed correctly.
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.
without the delay, the modal doesnt have the foreground effect for some reason. Im not sure why
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.
All it needs is a single millisecond after some testing
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.
This implies that we're needing to wait a frame. Try await Task.Yield();
instead.
Or, use a coroutine which begins with yield return null;
to wait until the next frame before ShowRichPresenceDisclaimer()
I have probably forgotten something...