Skip to content

Commit 827f139

Browse files
committed
Initial commit
0 parents  commit 827f139

File tree

8 files changed

+270
-0
lines changed

8 files changed

+270
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vs
2+
bin
3+
obj
4+
*.sln

FadeIn.csproj

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>disable</Nullable>
7+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8+
</PropertyGroup>
9+
10+
<Target Name="CopyDLLs" AfterTargets="Build">
11+
<Copy SourceFiles="$(TargetDir)$(ProjectName).dll" DestinationFolder="$(MD_NET6_DIRECTORY)\Mods" />
12+
<Message Text="Copied DLL -&gt; $(MD_NET6_DIRECTORY)\Mods\$(ProjectName).dll" Importance="High" />
13+
</Target>
14+
15+
<ItemGroup>
16+
<Reference Include="0Harmony">
17+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\net6\0Harmony.dll</HintPath>
18+
</Reference>
19+
<Reference Include="Assembly-CSharp">
20+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
21+
</Reference>
22+
<Reference Include="Il2CppInterop.Runtime">
23+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
24+
</Reference>
25+
<Reference Include="Il2Cppmscorlib">
26+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
27+
</Reference>
28+
<Reference Include="Il2CppSystem">
29+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
30+
</Reference>
31+
<Reference Include="MelonLoader">
32+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\net6\MelonLoader.dll</HintPath>
33+
</Reference>
34+
<Reference Include="UnityEngine.CoreModule">
35+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
36+
</Reference>
37+
<Reference Include="UnityEngine.AnimationModule">
38+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.AnimationModule.dll</HintPath>
39+
</Reference>
40+
<Reference Include="Il2Cppspine-unity">
41+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2Cppspine-unity.dll</HintPath>
42+
</Reference>
43+
<Reference Include="UnityEngine.UI">
44+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
45+
</Reference>
46+
<Reference Include="Il2CppSirenix.Serialization">
47+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\Il2CppSirenix.Serialization.dll</HintPath>
48+
</Reference>
49+
<Reference Include="UnityEngine.ParticleSystemModule">
50+
<HintPath>$(MD_NET6_DIRECTORY)\MelonLoader\Il2CppAssemblies\UnityEngine.ParticleSystemModule.dll</HintPath>
51+
</Reference>
52+
</ItemGroup>
53+
54+
</Project>

Main.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using MelonLoader;
2+
using static FadeIn.ModManager;
3+
4+
namespace FadeIn
5+
{
6+
public class Main : MelonMod
7+
{
8+
9+
public override void OnInitializeMelon()
10+
{
11+
base.OnInitializeMelon();
12+
Enabled = false;
13+
LoggerInstance.Msg("FadeIn has loaded correctly!");
14+
}
15+
16+
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
17+
{
18+
battleScene = sceneName == "GameMain";
19+
if (!battleScene)
20+
{
21+
OnSceneWasLoadedFunc();
22+
}
23+
}
24+
public override void OnUpdate()
25+
{
26+
if (!battleScene) return;
27+
OnUpdateFunc();
28+
}
29+
}
30+
}

ModManager.cs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using Il2CppAssets.Scripts.PeroTools.Commons;
2+
using Il2CppFormulaBase;
3+
using Il2CppSpine;
4+
using Il2CppSpine.Unity;
5+
using System.Collections.Concurrent;
6+
using UnityEngine;
7+
8+
namespace FadeIn
9+
{
10+
internal static class ModManager
11+
{
12+
internal static bool _enabled;
13+
public static bool Enabled
14+
{
15+
get { return _enabled; }
16+
set
17+
{
18+
_enabled = value;
19+
if (_enabled)
20+
{
21+
OnSceneWasLoadedFunc = ClearSceneElements;
22+
EnableVisiblePatch = EnqueueSkeleton;
23+
OnUpdateFunc = UpdateQueueElements;
24+
}
25+
else
26+
{
27+
OnSceneWasLoadedFunc = () => { };
28+
EnableVisiblePatch = (_) => { };
29+
OnUpdateFunc = () => { };
30+
}
31+
}
32+
}
33+
34+
public static GameObject FadeToggle = null;
35+
36+
public static bool battleScene = false;
37+
public static readonly ConcurrentQueue<Skeleton> enemiesSkeletons = new();
38+
39+
internal delegate void OnSceneWasLoadedFuncType();
40+
public static OnSceneWasLoadedFuncType OnSceneWasLoadedFunc;
41+
42+
internal delegate void EnableVisiblePatchFuncType(GameObject beoc);
43+
public static EnableVisiblePatchFuncType EnableVisiblePatch;
44+
45+
internal delegate void OnUpdateFuncType();
46+
public static OnUpdateFuncType OnUpdateFunc;
47+
48+
public static readonly float frequency = 1f / Time.fixedDeltaTime;
49+
50+
internal static void ClearSceneElements()
51+
{
52+
enemiesSkeletons.Clear();
53+
}
54+
55+
internal static void EnqueueSkeleton(GameObject beoc)
56+
{
57+
Skeleton currentEnemySkeleton = beoc.GetComponent<SkeletonAnimation>().skeleton;
58+
currentEnemySkeleton.a = 0.7f;
59+
enemiesSkeletons.Enqueue(currentEnemySkeleton);
60+
// Check airmusicnodecontroller for note particles
61+
}
62+
63+
internal static void UpdateQueueElements()
64+
{
65+
StageBattleComponent sbc = Singleton<StageBattleComponent>.instance;
66+
if ((!sbc?.isInGame ?? true) || (sbc?.isPause ?? true)) return;
67+
float delta = 0.01f * frequency * Time.deltaTime;
68+
69+
foreach (Skeleton skeleton in enemiesSkeletons)
70+
{
71+
skeleton.a -= delta;
72+
if (skeleton.a <= 0)
73+
{
74+
skeleton.a = 0f;
75+
enemiesSkeletons.TryDequeue(out _);
76+
}
77+
}
78+
}
79+
}
80+
}

Patches/GetVisibleEnemiesPatch.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using HarmonyLib;
2+
using Il2Cpp;
3+
using static FadeIn.ModManager;
4+
5+
namespace FadeIn.Patches
6+
{
7+
[HarmonyPatch(typeof(BaseEnemyObjectController))]
8+
internal static class GetVisibleEnemiesPatch
9+
{
10+
[HarmonyPostfix]
11+
[HarmonyPatch(nameof(BaseEnemyObjectController.EnableVisible))]
12+
public static void PostfixBEOC(BaseEnemyObjectController __instance)
13+
{
14+
EnableVisiblePatch(__instance.gameObject);
15+
}
16+
}
17+
}

Patches/TogglePatch.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using HarmonyLib;
2+
using Il2Cpp;
3+
using Il2CppAssets.Scripts.PeroTools.Nice.Events;
4+
using UnityEngine;
5+
using UnityEngine.Events;
6+
using UnityEngine.UI;
7+
using static FadeIn.ModManager;
8+
9+
namespace FadeIn.Patches
10+
{
11+
[HarmonyPatch(typeof(PnlPreparation))]
12+
internal static class TogglePatch
13+
{
14+
[HarmonyPostfix]
15+
[HarmonyPatch(nameof(PnlPreparation.Awake))]
16+
public static void Postfix(PnlPreparation __instance)
17+
{
18+
if (FadeToggle != null) return;
19+
20+
FadeToggle = UnityEngine.Object.Instantiate(
21+
GameObject.Find("Forward").transform.Find("PnlVolume").Find("LogoSetting").Find("Toggles").Find("TglOn").gameObject,
22+
__instance.startButton.transform
23+
);
24+
FadeToggle.name = "FadeToggle";
25+
26+
Text txt = FadeToggle.transform.Find("Txt").GetComponent<Text>();
27+
Image checkBox = FadeToggle.transform.Find("Background").GetComponent<Image>();
28+
Image checkMark = FadeToggle.transform.Find("Background").GetChild(0).GetComponent<Image>();
29+
30+
FadeToggle.transform.position = new Vector3(-7.6f, -4.8f, 100f);
31+
FadeToggle.GetComponent<OnToggle>().enabled = false;
32+
FadeToggle.GetComponent<OnToggleOn>().enabled = false;
33+
FadeToggle.GetComponent<OnActivate>().enabled = false;
34+
35+
Toggle toggleComp = FadeToggle.GetComponent<Toggle>();
36+
toggleComp.onValueChanged.AddListener((UnityAction<bool>)
37+
((bool val) => { Enabled = val; })
38+
);
39+
toggleComp.group = null;
40+
toggleComp.SetIsOnWithoutNotify(Enabled);
41+
42+
txt.text = "Fade In";
43+
txt.fontSize = 40;
44+
txt.color = new Color(1, 1, 1, 76 / 255f);
45+
RectTransform rect = txt.transform.Cast<RectTransform>();
46+
Vector2 vect = rect.offsetMax;
47+
rect.offsetMax = new Vector2(txt.text.Length * 25, vect.y);
48+
49+
checkBox.color = new(60 / 255f, 40 / 255f, 111 / 255f);
50+
checkMark.color = new(103 / 255f, 93 / 255f, 130 / 255f);
51+
}
52+
}
53+
}

Properties/AssemblyInfo.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using MelonLoader;
2+
using System.Reflection;
3+
using Main = FadeIn.Main;
4+
5+
[assembly: MelonInfo(typeof(Main), "FadeIn", "0.1.0", "Asgragrt")]
6+
[assembly: MelonGame("PeroPeroGames", "MuseDash")]
7+
[assembly: MelonColor(255, 241, 196, 15)]
8+
9+
[assembly: AssemblyTitle("FadeIn")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("Muse Dash Modding Community")]
13+
[assembly: AssemblyProduct("FadeIn")]
14+
[assembly: AssemblyCopyright("Copyright © 2024")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
18+
[assembly: AssemblyVersion("1.0.0.0")]
19+
[assembly: AssemblyFileVersion("1.0.0.0")]

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Fade In
2+
POC difficulty increase mod for md.
3+
WIP.
4+
5+
### Features
6+
* Fade in incoming notes.
7+
* Toggle on music view menu to enable/disable the mod.
8+
9+
### Limitations
10+
* Fade only depending on the time the note is visible. (E.g. Boss attacks appear later in the screen so they do not manage to fade completely ).
11+
* Holds not working. ( Really hard lol ) ( Help ).
12+
* Music notes particles are still visible.
13+
* Hearts bonded with notes are visible.

0 commit comments

Comments
 (0)