Skip to content

Commit

Permalink
Use publicized access instead of reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
qe201020335 committed Sep 11, 2024
1 parent 7afcec3 commit cc87184
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions SongPlayHistory/SongPlayHistory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Main" HintPath="$(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll">
<Publicize>True</Publicize>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json" HintPath="$(BeatSaberDir)\Libs\Newtonsoft.Json.dll">
Expand Down
8 changes: 4 additions & 4 deletions SongPlayHistory/UI/SPHUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class SPHUI: IInitializable, IDisposable
[Inject]
private readonly IScoringCacheManager _scoringCacheManager = null!;

private readonly SiraLog _logger = null!;
private readonly SiraLog _logger;

private readonly StandardLevelDetailViewController _levelDetailViewController;

Expand All @@ -49,9 +49,9 @@ public SPHUI(PlatformLeaderboardViewController leaderboardViewController, Standa
_levelDetailViewController = levelDetailViewController;
_logger = logger;

var levelStatsView = leaderboardViewController.GetField<LevelStatsView, PlatformLeaderboardViewController>("_levelStatsView");
var levelDetailView = levelDetailViewController.GetField<StandardLevelDetailView, StandardLevelDetailViewController>("_standardLevelDetailView");
var levelParamsPanel = levelDetailView.GetField<LevelParamsPanel, StandardLevelDetailView>("_levelParamsPanel");
var levelStatsView = leaderboardViewController._levelStatsView;
var levelDetailView = levelDetailViewController._standardLevelDetailView;
var levelParamsPanel = levelDetailView._levelParamsPanel;

try
{
Expand Down
5 changes: 2 additions & 3 deletions SongPlayHistory/VoteTracker/InMenuVoteTrackingHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using HMUI;
using IPA.Utilities;
using SiraUtil.Logging;
using SongPlayHistory.Model;
using Zenject;
Expand All @@ -24,8 +23,8 @@ internal class InMenuVoteTrackingHelper: IInitializable, IDisposable

public InMenuVoteTrackingHelper(LevelCollectionViewController levelCollectionViewController)
{
var levelCollectionTableView = levelCollectionViewController.GetField<LevelCollectionTableView, LevelCollectionViewController>("_levelCollectionTableView");
_tableView = levelCollectionTableView.GetField<TableView, LevelCollectionTableView>("_tableView");
var levelCollectionTableView = levelCollectionViewController._levelCollectionTableView;
_tableView = levelCollectionTableView._tableView;
}

public void Initialize()
Expand Down

0 comments on commit cc87184

Please sign in to comment.