Skip to content

Commit

Permalink
[+] Slide code support & split multiple patches (#77)
Browse files Browse the repository at this point in the history
* 功能拆分

将不同的功能分拆到不同文件

* Slide code notation support

This is part of Maimai DX 2077 patch set.
New MA2 commands: NMSSS, BRSSS, EXSSS, BXSSS, CNSSS
  • Loading branch information
Minepig authored Oct 25, 2024
1 parent 98213cf commit d0bb3cc
Show file tree
Hide file tree
Showing 21 changed files with 2,078 additions and 111 deletions.
7 changes: 5 additions & 2 deletions AquaMai/AquaMai.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
Expand Down Expand Up @@ -71,6 +71,9 @@
<Reference Include="System.Configuration">
<HintPath>Libs\System.Configuration.dll</HintPath>
</Reference>
<Reference Include="System.Numerics">
<HintPath>Libs\System.Numerics.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>Libs\System.Core.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -282,7 +285,7 @@
<HintPath>Libs\UnityEngine.XRModule.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="AquaMai.zh.toml" WithCulture="false" />
<EmbeddedResource Include="AquaMai.toml" />
Expand Down
24 changes: 24 additions & 0 deletions AquaMai/Fix/BreakSlideJudgeBlink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using HarmonyLib;
using Monitor;
using UnityEngine;

namespace AquaMai.Fix;

public class BreakSlideJudgeBlink
{
/*
* 这个 Patch 让 BreakSlide 的 Critical 判定也可以像 BreakTap 一样闪烁
* 推荐与自定义皮肤一起使用 (否则视觉效果可能并不好)
*/
[HarmonyPostfix]
[HarmonyPatch(typeof(SlideJudge), "UpdateBreakEffectAdd")]
private static void FixBreakSlideJudgeBlink(
SpriteRenderer ___SpriteRenderAdd, SpriteRenderer ___SpriteRender,
SlideJudge.SlideJudgeType ____judgeType, SlideJudge.SlideAngle ____angle
)
{
if (!___SpriteRenderAdd.gameObject.activeSelf) return;
float num = ___SpriteRenderAdd.color.r;
___SpriteRenderAdd.color = new Color(num, num, num, 1f);
}
}
32 changes: 32 additions & 0 deletions AquaMai/Fix/FanJudgeFlip.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using HarmonyLib;
using Monitor;

namespace AquaMai.Fix;

public class FanJudgeFlip
{
/*
* 这个 Patch 让 Wifi Slide 的判定显示有上下的区别 (原本所有 Wifi 的判定显示都是朝向圆心的), 就像 majdata 里那样
* 这个 bug 产生的原因是 SBGA 忘记给 Wifi 的 EndButtonId 赋值了
* 不过需要注意的是, 考虑到圆弧形 Slide 的判定显示就是永远朝向圆心的, 我个人会觉得这个 Patch 关掉更好看一点
*/
[HarmonyPostfix]
[HarmonyPatch(typeof(SlideFan), "Initialize")]
private static void FixFanJudgeFilp(
int[] ___GoalButtonId, SlideJudge ___JudgeObj
)
{
if (null != ___JudgeObj)
{
if (2 <= ___GoalButtonId[1] && ___GoalButtonId[1] <= 5)
{
___JudgeObj.Flip(false);
___JudgeObj.transform.Rotate(0.0f, 0.0f, 180f);
}
else
{
___JudgeObj.Flip(true);
}
}
}
}
43 changes: 43 additions & 0 deletions AquaMai/Fix/FixCircleSlideJudge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using HarmonyLib;
using Manager;
using Monitor;
using Process;
using UnityEngine;

namespace AquaMai.Fix;

public class FixCircleSlideJudge
{
/*
* 这个 Patch 让圆弧形的 Slide 的判定显示与判定线精确对齐 (原本会有一点歪), 就像 majdata 里那样
* 我觉得这个 Patch 算是无副作用的, 可以默认开启
*/
[HarmonyPostfix]
[HarmonyPatch(typeof(SlideRoot), "Initialize")]
private static void FixJudgePosition(
SlideRoot __instance, SlideType ___EndSlideType, SlideJudge ___JudgeObj
)
{
if (null != ___JudgeObj)
{
float z = ___JudgeObj.transform.localPosition.z;
if (___EndSlideType == SlideType.Slide_Circle_L)
{
float angle = -45.0f - 45.0f * __instance.EndButtonId;
double angleRad = Math.PI / 180.0 * (angle + 90 + 22.5 + 2.6415);
___JudgeObj.transform.localPosition = new Vector3(480f * (float)Math.Cos(angleRad), 480f * (float)Math.Sin(angleRad), z);
___JudgeObj.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, angle);
}
else if (___EndSlideType == SlideType.Slide_Circle_R)
{
float angle = -45.0f * __instance.EndButtonId;
double angleRad = Math.PI / 180.0 * (angle + 90 - 22.5 - 2.6415);
___JudgeObj.transform.localPosition = new Vector3(480f * (float)Math.Cos(angleRad), 480f * (float)Math.Sin(angleRad), z);
___JudgeObj.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, angle);
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AquaMai.Fix;

public class SlideAutoPlayTweak
public class FixSlideAutoPlay
{
/* 这个 Patch 用于修复以下 bug:
* SlideFan 在 AutoPlay 时, 只有第一个箭头会消失
Expand Down
89 changes: 0 additions & 89 deletions AquaMai/Fix/SlideJudgeTweak.cs

This file was deleted.

Binary file added AquaMai/Libs/System.Numerics.dll
Binary file not shown.
Loading

0 comments on commit d0bb3cc

Please sign in to comment.