Skip to content

Commit

Permalink
Fixes the PnlRole bug introduced in the Chunithm update
Browse files Browse the repository at this point in the history
  • Loading branch information
AshtonMemer committed Jul 9, 2024
1 parent 2b2194e commit a0214c6
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 85 deletions.
121 changes: 61 additions & 60 deletions FavGirl.csproj
Original file line number Diff line number Diff line change
@@ -1,66 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<Target Name="CopyDLLs" AfterTargets="Build">
<Copy SourceFiles="$(TargetDir)$(ProjectName).dll" DestinationFolder="$(MD_NET6_DIRECTORY)\Mods" />
<Message Text="Copied DLL -&gt; $(MD_NET6_DIRECTORY)\Mods\$(ProjectName).dll" Importance="High" />
</Target>
<Target Name="CopyDLLs" AfterTargets="Build">
<Copy SourceFiles="$(TargetDir)$(ProjectName).dll" DestinationFolder="$(MD_DIRECTORY)\Mods" />
<Message Text="Copied DLL -&gt; $(MD_DIRECTORY)\Mods\$(ProjectName).dll" Importance="High" />
</Target>

<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\net6\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppPeroTools2">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\Il2CppPeroTools2.dll</HintPath>
</Reference>
<Reference Include="Il2CppPeroTools2.Resources">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\Il2CppPeroTools2.Resources.dll</HintPath>
</Reference>
<Reference Include="Il2CppSirenix.Serialization">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\Il2CppSirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\net6\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreModule">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\UnityEngine.TextCoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>D:\Steam\steamapps\common\Muse Dash\MelonLoader\Il2CppAssemblies\UnityEngine.UIModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(MD_DIRECTORY)\MelonLoader\net6\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>$(MD_DIRECTORY)\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppPeroTools2">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppPeroTools2.dll</HintPath>
</Reference>
<Reference Include="Il2CppPeroTools2.Resources">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppPeroTools2.Resources.dll</HintPath>
</Reference>
<Reference Include="Il2CppSirenix.Serialization">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppSirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>$(MD_DIRECTORY)\MelonLoader\net6\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreModule">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.TextCoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>$(MD_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.UIModule.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
10 changes: 8 additions & 2 deletions FavGirlMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ internal static class MelonBuildInfo
public const string Description =
"Adds the ability to 'favorite' a girl and/or elfin to lock in their visuals.";

public const string Author = "RobotLucca";
public const string Author = "RobotLucca & AshtonMemer";
public const string Company = null;
public const string Version = "2.4.1";
public const string Version = "2.4.2";
public const string DownloadLink = null;
}

Expand All @@ -26,5 +26,11 @@ public override void OnInitializeMelon() // Runs after Game Initialization.
instance = this;
FavSave.Load();
}

public override void OnApplicationQuit()
{
base.OnApplicationQuit();
MelonPreferences.Save();
}
}
}
51 changes: 35 additions & 16 deletions FavManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static void FancyScrollViewOnEnablePostfix(FancyScrollView __instance)
likeBtnGirl.graphic =
btnGirlObj.GetComponent<StageLikeToggle>().m_ImgLike.GetComponent<Image>();
likeBtnGirl.name = "TglLikeGirl";
likeBtnGirl.transform.position = new Vector3(-6f, 1.75f, 100f);
likeBtnGirl.transform.localPosition = new Vector3(700f, 340f, 100f);
likeBtnGirl.GetComponent<StageLikeToggle>().enabled = false;
Object.DestroyImmediate(btnGirlObj.GetComponent<StageLikeToggle>());

Expand All @@ -170,7 +170,7 @@ private static void FancyScrollViewOnEnablePostfix(FancyScrollView __instance)
if (trans.name == "ImgLikeOn") trans.gameObject.SetActive(true);
}

var pnlRole = __instance.transform.parent.GetComponent<PnlRole>();
var pnlRole = __instance.transform.parent.parent.GetComponent<PnlRole>();

likeBtnGirl.onValueChanged.AddListener((UnityAction<bool>)OnValueChangedGirl);

Expand Down Expand Up @@ -204,7 +204,7 @@ private static void FancyScrollViewOnEnablePostfix(FancyScrollView __instance)
else if (__instance.animName.Equals("CharScrollView") && likeBtnGirl != null)
try
{
var pnlRole = __instance.transform.parent.GetComponent<PnlRole>();
var pnlRole = __instance.transform.parent.parent.GetComponent<PnlRole>();
var cell = pnlRole.m_FancyPanel.GetCellComponent<PnlRoleSubControl>();
likeBtnGirl.gameObject.SetActive(ValidGirl(cell != null ? cell.m_RoleIndex : (int)GirlID.NONE));
}
Expand All @@ -223,7 +223,7 @@ private static void FancyScrollViewOnEnablePostfix(FancyScrollView __instance)
likeBtnElfin.graphic =
btnElfinObj.GetComponent<StageLikeToggle>().m_ImgLike.GetComponent<Image>();
likeBtnElfin.name = "TglLikeElfin";
likeBtnElfin.transform.position = new Vector3(-3f, 3.4f, 100f);
likeBtnElfin.transform.localPosition = new Vector3(700f, 340f, 100f);
likeBtnElfin.GetComponent<StageLikeToggle>().enabled = false;
Object.DestroyImmediate(btnElfinObj.GetComponent<StageLikeToggle>());

Expand Down Expand Up @@ -278,36 +278,56 @@ private static void OnValueChangedGirl(bool val)
{
if (_instance == null) return;

var pnlRole = _instance.transform.parent.GetComponent<PnlRole>();
var pnlRole = _instance.transform.parent.parent.GetComponent<PnlRole>();

if(val) {
if (val)
{
var cell = pnlRole.m_FancyPanel.GetCellComponent<PnlRoleSubControl>(-1);
if(cell == null || !ValidGirl(cell.m_RoleIndex)) {
if (cell == null || !ValidGirl(cell.m_RoleIndex))
{
// reimu
FavGirlMelon.instance.LoggerInstance.Msg("Did you really think you could fool me?");
FavSave.FavGirl = GirlID.NONE;
} else {
}
else
{
var girlIdx = cell.m_RoleIndex;
FavSave.FavGirl = (GirlID)girlIdx;
}
} else {
}
else
{
FavSave.FavGirl = GirlID.NONE;
}
}

private static void OnUpdatePositionGirl(float val)
{
if (_instance == null)return;
if (_instance == null)
{
FavGirlMelon.instance.LoggerInstance.Error("Instance is null");
return;
}

var pnlRole = _instance.transform.parent.parent.GetComponent<PnlRole>();

var pnlRole = _instance.transform.parent.GetComponent<PnlRole>();
if (pnlRole == null)
{
FavGirlMelon.instance.LoggerInstance.Error("PnlRole is null");
return;
}

var cell = pnlRole.m_FancyPanel.GetCellComponent<PnlRoleSubControl>(-1);
if(cell != null) {
if (cell != null)
{
var girlIdx = cell.m_RoleIndex;
if(!ValidGirl(girlIdx)) {
if (!ValidGirl(girlIdx))
{
// reimu or new chars
likeBtnGirl.gameObject.SetActive(false);
} else if(!likeBtnGirl.gameObject.activeSelf) {
likeBtnGirl.gameObject.SetActive(false); return;
}
else if (!likeBtnGirl.gameObject.activeSelf)
{
likeBtnGirl.gameObject.SetActive(true);
}
likeBtnGirl.SetIsOnWithoutNotify((GirlID)girlIdx == FavSave.FavGirl);
Expand Down Expand Up @@ -651,7 +671,6 @@ private static void Prefix()
{
if (FavSave.FavElfin != ElfinID.NONE)
{
FavGirlMelon.instance.LoggerInstance.Msg("Replace Battle Elfin");
oldElfin = GlobalDataBase.s_DbBattleStage.m_SelectedElfin;
GlobalDataBase.s_DbBattleStage.m_SelectedElfin = (int)FavSave.FavElfin;
}
Expand Down
17 changes: 13 additions & 4 deletions FavSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ public static void Load()
"Whether to automatically hide girl/elfin choices when the ability matches the victory screen.\nFor if you want to get vanilla victory screens."
);

if (!Enum.IsDefined(typeof(GirlID), favGirl.Value)) FavGirl = GirlID.NONE;
if (!Enum.IsDefined(typeof(ElfinID), favElfin.Value)) FavElfin = ElfinID.NONE;
if (!Enum.IsDefined(typeof(GirlID), favGirl.Value))
{
FavGirlMelon.instance.LoggerInstance.Msg($"Favorite girl not defined");
FavGirl = GirlID.NONE;
}
if (!Enum.IsDefined(typeof(ElfinID), favElfin.Value))
{
FavGirlMelon.instance.LoggerInstance.Msg($"Favorite elfin not defined");
FavElfin = ElfinID.NONE;
}
}
}

Expand Down Expand Up @@ -97,6 +105,7 @@ public enum GirlID
AMIYA = 22,
MIKU_HATSUNE = 25
// RIN_LEN = 26
// RACER = 27
}

// List of valid Elfins selectable as favorites
Expand All @@ -115,8 +124,8 @@ public enum ElfinID
DRAGON = 6,
LILITH = 7,
PAIGE = 8,

SILENCER = 9
SILENCER = 9,
// NEON_EGG = 10
BETAGO = 11
}
}
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("2.4.1.0")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyVersion("2.4.2.0")]
[assembly: AssemblyFileVersion("2.4.2.0")]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ This mod adds a heart button next to characters and elfins in the selection menu
## Limitations
- Does not support Neon Egg elfin
- Does not support Kagamine Rin & Len character
- Does not support Racer Rin character
## Notes
I plan on getting around to rewriting FavGirl entirely, adding support for Kagamine Rin & Len and Neon Egg in the process. It might take a significant amount of time so I apologize if not being able to play as the new character disappoints some people, but they are the first character to be *two* characters, so there is some complication that comes with that.
I plan on getting around to rewriting FavGirl entirely, adding support for missing characters and elfins in the process. It might take a significant amount of time so I apologize if not being able to play as the new character disappoints some people, but they are the first character to be *two* characters, so there is some complication that comes with that.
## Disclaimer
This repository and its contributors maintain no affiliation with Muse Dash, PeroPeroGames (peropero Ltd.), hasuhasu, or any associated entities.

0 comments on commit a0214c6

Please sign in to comment.