Skip to content

Commit

Permalink
restore leaderboard for OSTs correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwasyx committed Nov 20, 2023
1 parent 228fe9e commit e3c878f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ScoreSaber/Patches/LeaderboardPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 57,17 @@ void PatchLeaderboardTableView(ref LeaderboardTableView __instance, TableCell __
LeaderboardTableCell tableCell = (LeaderboardTableCell)__result;

CellClicker existingCellClicker = tableCell.gameObject.GetComponent<CellClicker>();
if (existingCellClicker == null || existingCellClicker.index != row) {
if (existingCellClicker == null || existingCellClicker.index != row || _scoresaberLeaderboardViewController.isOST) {
if (existingCellClicker != null) {
GameObject.Destroy(existingCellClicker);
}

CellClicker cellClicker = tableCell.gameObject.AddComponent<CellClicker>();
cellClicker.onClick = _scoresaberLeaderboardViewController._infoButtons.InfoButtonClicked;
cellClicker.index = row;
cellClicker.seperator = tableCell.GetField<Image, LeaderboardTableCell>("_separatorImage") as ImageView;
if (!_scoresaberLeaderboardViewController.isOST) {
CellClicker cellClicker = tableCell.gameObject.AddComponent<CellClicker>();
cellClicker.onClick = _scoresaberLeaderboardViewController._infoButtons.InfoButtonClicked;
cellClicker.index = row;
cellClicker.seperator = tableCell.GetField<Image, LeaderboardTableCell>("_separatorImage") as ImageView;
}
}

TextMeshProUGUI _playerNameText = tableCell.GetField<TextMeshProUGUI, LeaderboardTableCell>("_playerNameText");
Expand All @@ -78,6 80,9 @@ void PatchLeaderboardTableView(ref LeaderboardTableView __instance, TableCell __
if (_scoresaberLeaderboardViewController.isOST) {
_playerNameText.richText = false;
_playerNameText.rectTransform.anchoredPosition = normalAnchor;
if (row == 9)
tableCell.showSeparator = false;
tableCell.interactable = false;
} else {
_playerNameText.richText = true;
Vector2 newPosition = new Vector2(normalAnchor.x 2.5f, 0f);
Expand All @@ -103,8 108,8 @@ void PatchPlatformLeaderboardDidActivatePostfix(ref bool firstActivation, ref Sp
_platformLeaderboardViewController?.InvokeMethod<object, PlatformLeaderboardViewController>("Refresh", true, true);
}
if (Plugin.Settings.enableCountryLeaderboards) {
____scopeSegmentedControl.SelectCellWithNumber(_lastScopeIndex);
UpdateScopeControl(____friendsLeaderboardIcon, ____globalLeaderboardIcon, ____aroundPlayerLeaderboardIcon, ____scopeSegmentedControl);
____scopeSegmentedControl.SelectCellWithNumber(_lastScopeIndex);
}
}

Expand Down

0 comments on commit e3c878f

Please sign in to comment.