Skip to content

Commit

Permalink
fix/master: BeatSaberDownloader was broken so I feex it
Browse files Browse the repository at this point in the history
  • Loading branch information
Shoko84 committed Feb 12, 2020
1 parent dd247ac commit 604cabf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
16 changes: 11 additions & 5 deletions ImageCoverExpander/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,22 @@ private static void RefreshButtonsBackgrounds<T>(Component bdscc) where T : Segm
}

private static void OnMenuSceneLoadedFresh()
{
var mmvc = Resources.FindObjectsOfTypeAll<MainMenuViewController>().FirstOrDefault();
if (!mmvc) return;
mmvc.didFinishEvent += OnDidFinishEvent;
}

private static void OnDidFinishEvent(MainMenuViewController mmvc, MainMenuViewController.MenuButton _)
{
var sldvc = Resources.FindObjectsOfTypeAll<StandardLevelDetailViewController>().FirstOrDefault();
var ldvc = Resources.FindObjectsOfTypeAll<StandardLevelDetailView>().FirstOrDefault();
if (!sldvc || !ldvc) return;
var bcscc = ReflectionUtil.GetPrivateField<BeatmapCharacteristicSegmentedControlController>(ldvc, "_beatmapCharacteristicSegmentedControlController");
var bdscc = ReflectionUtil.GetPrivateField<BeatmapDifficultySegmentedControlController>(ldvc, "_beatmapDifficultySegmentedControlController");
if (!bcscc || !bdscc) return;
sldvc.didPresentContentEvent += (controller, type) => {
bcscc.didSelectBeatmapCharacteristicEvent += (controlController, so) => {
RefreshButtonsBackgrounds<TextSegmentedControlCellNew>(bdscc);
};
sldvc.didPresentContentEvent += (sldvcController, type) => {
bcscc.didSelectBeatmapCharacteristicEvent += (controlController, so) => { RefreshButtonsBackgrounds<TextSegmentedControlCellNew>(bdscc); };
RefreshButtonsBackgrounds<IconSegmentedControlCell>(bcscc);
RefreshButtonsBackgrounds<TextSegmentedControlCellNew>(bdscc);
};
Expand All @@ -81,7 +86,7 @@ private static void OnMenuSceneLoadedFresh()
var pscLayout = playerStatsContainer.GetComponent<LayoutElement>();
var playContainer = bdscc.transform.parent;
var levelInfoLayout = levelInfo.GetComponent<LayoutElement>();
if (!coverImage || !levelInfo || ! playerStatsContainer || !pscLayout || !playContainer || !levelInfoLayout) return;
if (!coverImage || !levelInfo || !playerStatsContainer || !pscLayout || !playContainer || !levelInfoLayout) return;
coverImage.transform.localPosition = new Vector3(0, 0, coverImage.transform.localPosition.z);
coverImage.transform.localScale = Vector3.one;
coverImage.GetComponent<RectTransform>().sizeDelta = new Vector2(11, 11);
Expand All @@ -95,6 +100,7 @@ private static void OnMenuSceneLoadedFresh()
pscLayout.transform.SetParent(levelInfo);
pscLayout.transform.localPosition = new Vector3(0, -10);
levelInfoLayout.preferredHeight = 60;
mmvc.didFinishEvent -= OnDidFinishEvent;
}

public void OnApplicationStart() { }
Expand Down
4 changes: 2 additions & 2 deletions ImageCoverExpander/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
2 changes: 1 addition & 1 deletion ImageCoverExpander/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"gameVersion": "1.7.0",
"id": "ImageCoverExpander",
"name": "ImageCoverExpander",
"version": "1.0.0",
"version": "1.0.1",
"dependsOn": {
"BS Utils": "^1.4.1"
},
Expand Down

0 comments on commit 604cabf

Please sign in to comment.