Rizu/Rizu.MonoMod/patch_GameScoreList.cs

42 lines
1.2 KiB
C#

// ReSharper disable CheckNamespace
// ReSharper disable InconsistentNaming
using System.Reflection;
using Game;
using MAI2.Util;
using Rizu.Core;
using Rizu.MonoMod;
namespace Manager;
public class patch_GameScoreList(int index) : GameScoreList(index)
{
// New field introduced in SDEZ 1.40 (maimai DX BUDDiES)
private static readonly FieldInfo utageKanjiTextField = typeof(SessionInfo)
.GetField("utageKanjiText", BindingFlags.Instance | BindingFlags.Public);
private extern void orig_SetPlayAfterRate(int musicRate, int danRate, UdemaeID dan, int classValue);
public new void SetPlayAfterRate(int musicRate, int danRate, UdemaeID dan, int classValue)
{
orig_SetPlayAfterRate(musicRate, danRate, dan, classValue);
if (!IsEnable)
{
return;
}
if (SessionInfo.isAdvDemo || SessionInfo.isTutorial)
{
return;
}
if (utageKanjiTextField != null && !string.IsNullOrEmpty((string)utageKanjiTextField.GetValue(SessionInfo)))
{
return;
}
SingletonMonoBehaviour<RizuMonoBehaviour>.instance.StartCoroutine(Exporter.Instance.ExportScore(this));
}
}