-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bookdude13/remastered
Remastered + UI revamp
- Loading branch information
Showing
29 changed files
with
985 additions
and
538 deletions.
There are no files selected for viewing
This file contains 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,3 @@ | ||
[submodule "SRModCore"] | ||
path = SRModCore | ||
url = [email protected]:bookdude13/SRModCore |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
SRPlaylistManager/Harmony/Patch_MultiplayerFavoritesController.ToggleFavorite.cs
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
SRPlaylistManager/Harmony/Patch_MultiplayerFavoritesController_OnPointerDown.cs
This file contains 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,30 @@ | ||
using HarmonyLib; | ||
using System; | ||
using Il2CppUtil.Controller; | ||
using UnityEngine.EventSystems; | ||
|
||
namespace SRPlaylistManager.Harmony | ||
{ | ||
|
||
[HarmonyPatch(typeof(MultiplayerFavoritesController), nameof(MultiplayerFavoritesController.OnPointerDown), new Type[] { typeof(PointerEventData) })] | ||
public class Patch_MultiplayerFavoritesController_OnPointerDown | ||
{ | ||
public static bool Prefix(MultiplayerFavoritesController __instance, PointerEventData eventData) | ||
{ | ||
// There isn't a SynthUIButton for this, it's handled directly... | ||
|
||
SRPlaylistManager.Instance?.Log("MP Favorites Toggle OnPointerDown"); | ||
|
||
__instance.tooltip = "Select Playlists"; | ||
|
||
// Treat the click as the end to the hover, to hide the tooltip | ||
//__instance.OnPointerExit(eventData); | ||
__instance.isHovered = false; | ||
|
||
SRPlaylistManager.Instance?.OnToggleMultiplayerPlaylistButton(); | ||
|
||
// Stop normal favorites triggering | ||
return false; | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
SRPlaylistManager/Harmony/Patch_MultiplayerFavoritesController_OnPointerEnter.cs
This file contains 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,23 @@ | ||
using HarmonyLib; | ||
using System; | ||
using Il2CppUtil.Controller; | ||
using UnityEngine.EventSystems; | ||
|
||
namespace SRPlaylistManager.Harmony | ||
{ | ||
[HarmonyPatch(typeof(MultiplayerFavoritesController), nameof(MultiplayerFavoritesController.OnPointerEnter), new Type[] { typeof(PointerEventData) })] | ||
public class Patch_MultiplayerFavoritesController_OnPointerEnter | ||
{ | ||
public static void Prefix(MultiplayerFavoritesController __instance, PointerEventData eventData) | ||
{ | ||
// Override tooltip text before any logic runs | ||
__instance.tooltip = "Select Playlists"; | ||
} | ||
|
||
public static void Postfix(MultiplayerFavoritesController __instance, PointerEventData eventData) | ||
{ | ||
// Make sure the tooltip stays overwritten after logic runs | ||
__instance.tooltip = "Select Playlists"; | ||
} | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
...anager/Harmony/Patch_PlaylistManagementController_Interface__TryDeleteSongFromPlaylist.cs
This file was deleted.
Oops, something went wrong.
60 changes: 49 additions & 11 deletions
60
...nager/Harmony/Patch_PlaylistManagementController_TryDisplayCorrectRemoveFavoriteButton.cs
This file contains 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 |
---|---|---|
@@ -1,26 +1,64 @@ | ||
using HarmonyLib; | ||
using Synth.SongSelection; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TMPro; | ||
using Il2CppTMPro; | ||
using Il2CppUtil.Controller; | ||
using Il2Cpp; | ||
using SRModCore; | ||
using UnityEngine; | ||
using Util.Controller; | ||
using static MelonLoader.MelonLogger; | ||
|
||
namespace SRPlaylistManager.Harmony | ||
{ | ||
[HarmonyPatch(typeof(PlaylistManagementController), nameof(PlaylistManagementController.TryDisplayCorrectRemoveFavoriteButton))] | ||
public class Patch_PlaylistManagementController_TryDisplayCorrectRemoveFavoriteButton | ||
{ | ||
public static void Postfix(GameObject ___pf_RemoveFromPlaylistButton, GameObject ___pf_SongAddFavoriteButton) | ||
public static void Prefix(PlaylistManagementController __instance) | ||
{ | ||
// Override the remove button text | ||
___pf_RemoveFromPlaylistButton?.GetComponentInChildren<TMP_Text>(true)?.SetText("Playlist", true); | ||
SetupToggleButton(__instance.pf_RemoveFromPlaylistButton); | ||
SetupToggleButton(__instance.pf_SongAddFavoriteButton); | ||
|
||
// TODO figure out how to do the heart visible or not based on if in _any_ playlist | ||
|
||
//// Override the remove button text | ||
//var btnText = __instance.pf_RemoveFromPlaylistButton?.GetComponentInChildren<TMP_Text>(true); | ||
//SRPlaylistManager.Instance.Log("Remove favorite btn text: " + btnText); | ||
//btnText?.SetText("Playlist", true); | ||
|
||
//// Also add in our own behavior | ||
//var button = __instance.pf_RemoveFromPlaylistButton?.GetComponentInChildren<SynthUIButton>(); | ||
//SRPlaylistManager.Instance.Log("Remove favorite btn: " + button); | ||
//button.WhenClicked = new UnityEngine.Events.UnityEvent(); | ||
//button.WhenClicked.AddListener(new Action(() => { SRPlaylistManager.Instance.OnToggleMainMenuPlaylistButton(); })); | ||
|
||
// Hide icon. Still off-center, but not as obviously a different button :) | ||
___pf_SongAddFavoriteButton?.transform.Find("Icon")?.gameObject.SetActive(false); | ||
//__instance.pf_SongAddFavoriteButton?.transform.Find("Icon")?.gameObject.SetActive(false); | ||
} | ||
|
||
private static void SetupToggleButton(GameObject buttonGO) | ||
{ | ||
if (buttonGO == null) | ||
return; | ||
|
||
// Override the remove button text | ||
var btnTexts = buttonGO.GetComponentsInChildren<TMP_Text>(true); | ||
foreach (var btnText in btnTexts) | ||
{ | ||
btnText?.SetText("Select Playlists", true); | ||
} | ||
|
||
// Make sure the tooltip doesn't linger when we open up the playlist selection | ||
var button = buttonGO.GetComponentInChildren<SynthUIButton>(); | ||
button.hideTooltipOnClick = true; | ||
|
||
// Also add in our own behavior | ||
if (button != null) | ||
{ | ||
button.WhenClicked = new UnityEngine.Events.UnityEvent(); | ||
button.WhenClicked.AddListener(new Action(() => { | ||
// Toggle playlist selection | ||
SRPlaylistManager.Instance.OnToggleMainMenuPlaylistButton(); | ||
})); | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
SRPlaylistManager/Harmony/Patch_SongSelectionManager_PlayPreviewAudio.cs
This file contains 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,16 @@ | ||
using HarmonyLib; | ||
using Il2CppSynth.SongSelection; | ||
using Il2CppUtil.Controller; | ||
|
||
namespace SRPlaylistManager.Harmony | ||
{ | ||
[HarmonyPatch(typeof(SongSelectionManager), nameof(SongSelectionManager.PlayPreviewAudio))] | ||
public class Patch_SongSelectionManager_PlayPreviewAudio | ||
{ | ||
public static void Prefix() | ||
{ | ||
// Force some UI refreshing on first load. This was the first hook I could make work. | ||
PlaylistManagementController.GetInstance?.TryDisplayCorrectRemoveFavoriteButton(); | ||
} | ||
} | ||
} |
This file contains 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
22 changes: 10 additions & 12 deletions
22
SRPlaylistManager/Harmony/Patch_SongSelectionManager_UpdateFavoriteButtonState.cs
This file contains 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 |
---|---|---|
@@ -1,26 +1,24 @@ | ||
using HarmonyLib; | ||
using Synth.SongSelection; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TMPro; | ||
using UnityEngine; | ||
using Util.Controller; | ||
using Il2CppSynth.SongSelection; | ||
using SRModCore; | ||
|
||
namespace SRPlaylistManager.Harmony | ||
{ | ||
[HarmonyPatch(typeof(SongSelectionManager), "UpdateFavoriteButtonState")] | ||
public class Patch_SongSelectionManager_UpdateFavoriteButtonState | ||
{ | ||
public static bool Prefix(TMP_Text ___favoriteBtnLabel) | ||
public static bool Prefix(SongSelectionManager __instance) | ||
{ | ||
// Don't follow the normal text changes | ||
// TODO better text and do translation | ||
___favoriteBtnLabel.SetText("Playlist", true); | ||
__instance.favoriteBtn.toolTipLabelNormal = "Select Playlists"; | ||
__instance.favoriteBtn.toolTipLabelSelected = "Select Playlists"; | ||
|
||
return false; | ||
__instance.favoriteBtn.synthUIButton.SetText("Select Playlists"); | ||
|
||
// TODO set state based on if the current song is in _any_ playlist, not just favorites? | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains 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
Oops, something went wrong.