mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-13 04:17:27 +08:00
[RF] Move some patches to visual
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -55,28 +55,6 @@ public class Config
|
||||
""")]
|
||||
public bool FontFix { get; set; }
|
||||
|
||||
[ConfigComment(
|
||||
en: """
|
||||
Make the judgment display of Wifi Slide different in up and down (originally all Wifi judgment displays are towards the center), just like in majdata
|
||||
The reason for this bug is that SEGA forgot to assign EndButtonId to Wifi
|
||||
""",
|
||||
zh: """
|
||||
这个 Patch 让 Wifi Slide 的判定显示有上下的区别 (原本所有 Wifi 的判定显示都是朝向圆心的), 就像 majdata 里那样
|
||||
这个 bug 产生的原因是 SBGA 忘记给 Wifi 的 EndButtonId 赋值了
|
||||
""")]
|
||||
public bool FanJudgeFlip { get; set; }
|
||||
|
||||
[ConfigComment(
|
||||
en: """
|
||||
This Patch makes the Critical judgment of BreakSlide also flicker like BreakTap
|
||||
Recommended to use with custom skins (otherwise the visual effect may not be good)
|
||||
""",
|
||||
zh: """
|
||||
这个 Patch 让 BreakSlide 的 Critical 判定也可以像 BreakTap 一样闪烁
|
||||
推荐与自定义皮肤一起使用 (否则视觉效果可能并不好)
|
||||
""")]
|
||||
public bool BreakSlideJudgeBlink { get; set; }
|
||||
|
||||
[ConfigComment(
|
||||
en: """
|
||||
Make the AutoPlay random judgment mode really randomize all judgments (down to sub-judgments)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using AquaMai.Attributes;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Manager;
|
||||
using Monitor;
|
||||
using Monitor.MusicSelect.ChainList;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AquaMai.Fix;
|
||||
|
||||
[GameVersion(24000)]
|
||||
public class FixLevelDisplay
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(MusicChainCardObejct), "SetLevel")]
|
||||
private static void FixLevelShiftMusicChainCardObejct(MusicLevelID levelID, SpriteCounter ____digitLevel, SpriteCounter ____doubleDigitLevel, bool utage, GameObject ____difficultyUtageQuesionMarkSingleDigit, GameObject ____difficultyUtageQuesionMarkDoubleDigit)
|
||||
{
|
||||
switch (levelID)
|
||||
{
|
||||
case > MusicLevelID.Level9P:
|
||||
____digitLevel.gameObject.SetActive(value: false);
|
||||
____doubleDigitLevel.gameObject.SetActive(value: true);
|
||||
____doubleDigitLevel.ChangeText(levelID.GetLevelNum().PadRight(3));
|
||||
break;
|
||||
case >= MusicLevelID.None:
|
||||
____digitLevel.gameObject.SetActive(value: true);
|
||||
____doubleDigitLevel.gameObject.SetActive(value: false);
|
||||
____digitLevel.ChangeText(levelID.GetLevelNum().PadRight(2));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!utage) return;
|
||||
switch (levelID)
|
||||
{
|
||||
case > MusicLevelID.Level9P:
|
||||
____difficultyUtageQuesionMarkSingleDigit.SetActive(value: false);
|
||||
____difficultyUtageQuesionMarkDoubleDigit.SetActive(value: true);
|
||||
break;
|
||||
case >= MusicLevelID.None:
|
||||
____difficultyUtageQuesionMarkSingleDigit.SetActive(value: true);
|
||||
____difficultyUtageQuesionMarkDoubleDigit.SetActive(value: false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(SingleResultCardController), "SetLevel")]
|
||||
private static void FixLevelShiftSingleResultCardController(MusicLevelID levelID, bool isUtage, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble, GameObject ____utageQuestionMarkSingleDigit, GameObject ____utageQuestionMarkDoubleDigit)
|
||||
{
|
||||
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, isUtage, ____utageQuestionMarkSingleDigit, ____utageQuestionMarkDoubleDigit);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TotalResultPlayer), "SetLevel")]
|
||||
private static void FixLevelShiftTotalResultPlayer(MusicLevelID levelID, bool isUtage, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble, GameObject ____utageQuestionMarkSingleDigit, GameObject ____utageQuestionMarkDoubleDigit)
|
||||
{
|
||||
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, isUtage, ____utageQuestionMarkSingleDigit, ____utageQuestionMarkDoubleDigit);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ResultMonitor), "SetLevel")]
|
||||
private static void FixLevelShiftTotalResultPlayer(MusicLevelID levelID, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble)
|
||||
{
|
||||
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, false, null, null);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TrackStartMonitor), "SetTrackStart")]
|
||||
private static void FixLevelShiftTrackStartMonitor(int ___monitorIndex, ref SpriteCounter ____difficultySingle, ref SpriteCounter ____difficultyDouble, GameObject ____utageQuestionSingleDigit, GameObject ____utageQuestionDoubleDigit)
|
||||
{
|
||||
var music = Singleton<DataManager>.Instance.GetMusic(GameManager.SelectMusicID[___monitorIndex]);
|
||||
var levelID = (MusicLevelID)music.notesData[GameManager.SelectDifficultyID[___monitorIndex]].musicLevelID;
|
||||
FixLevelShiftMusicChainCardObejct(levelID, ____difficultySingle, ____difficultyDouble, music.name.id >= 100000, ____utageQuestionSingleDigit, ____utageQuestionDoubleDigit);
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using Manager;
|
||||
using Monitor;
|
||||
|
||||
namespace AquaMai.Fix;
|
||||
|
||||
public class FixSlideAutoPlay
|
||||
{
|
||||
/* 这个 Patch 用于修复以下 bug:
|
||||
* SlideFan 在 AutoPlay 时, 只有第一个箭头会消失
|
||||
* 原 method 逻辑如下:
|
||||
*
|
||||
* if (this.IsNoteCheckTimeStartIgnoreJudgeWait())
|
||||
* {
|
||||
* // do something ...
|
||||
* if (!GameManager.IsAutoPlay())
|
||||
* {
|
||||
* // do something ...
|
||||
* for (int index = 0; index < this._arrowPrefubs.Length && (double) index < (double) num2 * 11.0; ++index)
|
||||
* {
|
||||
* // do something about displaying arrows ...
|
||||
* }
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* float num4 = (currentMsec - this.StarLaunchMsec) / (this.StarArriveMsec - this.StarLaunchMsec - this.lastWaitTime);
|
||||
* for (int index = 0; index < this._arrowPrefubs.Length && (double) index < (double) num4 * 1.0; ++index)
|
||||
* {
|
||||
* // do something about displaying arrows ...
|
||||
* }
|
||||
* if ((double) num4 > 1.0)
|
||||
* num1 = 3;
|
||||
* }
|
||||
* // do something ...
|
||||
* }
|
||||
*
|
||||
* 导致这个 bug 的原因是 else 分支的 for 循环终止条件写错了, 应该是 11.0 (因为有 11 个箭头), SBGA 写成了 1.0
|
||||
* 这个 method 中一共只有 5 处 ldc.r4 的 IL Code, 依次为 10.0, 11.0, 1.0, 1.0, 0.0
|
||||
* 修复 bug 需要把第三处的 1.0 更改为 11.0, 这里使用 Transpiler 解决
|
||||
*/
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(SlideFan), "NoteCheck")]
|
||||
private static IEnumerable<CodeInstruction> FixFanAutoPlayArrow(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
List<CodeInstruction> instList = new List<CodeInstruction>(instructions);
|
||||
bool found = false;
|
||||
for (int i = 0; i < instList.Count; i++)
|
||||
{
|
||||
CodeInstruction inst = instList[i];
|
||||
if (inst.LoadsConstant(11.0))
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (found && inst.LoadsConstant(1.0))
|
||||
{
|
||||
inst.operand = 11.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return instList;
|
||||
}
|
||||
|
||||
/* 这个 Patch 让 Slide 在 AutoPlay 的时候, 每个区仍然会分按下和松开两段进行推进 (加上 this._hitIn 的变化)
|
||||
* 原 method 逻辑如下:
|
||||
*
|
||||
* if (!GameManager.IsAutoPlay())
|
||||
* {
|
||||
* // do somethings ...
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* float num1 = (currentMsec - this.StarLaunchMsec) / (this.StarArriveMsec - this.StarLaunchMsec - this.lastWaitTime);
|
||||
* this._hitIndex = (int) ((double) this._hitAreaList.Count * (double) num1);
|
||||
* if (this._hitIndex >= this._hitAreaList.Count)
|
||||
* this._hitIndex = this._hitAreaList.Count - 1;
|
||||
* if (this._hitIndex < 0)
|
||||
* this._hitIndex = 0;
|
||||
* int num2 = (int) ((double) this._dispLaneNum * this.GetDeleteArrowDistance());
|
||||
* // do somethings ...
|
||||
* }
|
||||
*
|
||||
* 现在要在 this.GetDeleteArrowDistance() 之前插入
|
||||
* this._hitIn = ((float)this._hitAreaList.Count * num1 > (float)this._hitIndex + 0.5f);
|
||||
* 这段代码, 可以采用 Prefix, GetDeleteArrowDistance() 只在两个地方调用过, 另一处就在上面的 if 分支中 (即非 AutoPlay 情况)
|
||||
*/
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SlideRoot), "GetDeleteArrowDistance")]
|
||||
private static void FixSlideAutoPlayArrow(
|
||||
SlideRoot __instance, ref bool ____hitIn, int ____hitIndex, List<SlideManager.HitArea> ____hitAreaList,
|
||||
float ___StarLaunchMsec, float ___StarArriveMsec, float ___lastWaitTime
|
||||
)
|
||||
{
|
||||
if (GameManager.IsAutoPlay())
|
||||
{
|
||||
float prop = (NotesManager.GetCurrentMsec() - ___StarLaunchMsec) / (___StarArriveMsec - ___StarLaunchMsec - ___lastWaitTime);
|
||||
____hitIn = ____hitAreaList.Count * prop > ____hitIndex + 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user