[+] Port SelectionDetail

This commit is contained in:
Clansty 2024-09-06 16:41:29 +08:00
parent e8307cdcd9
commit 8fa356242e
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
7 changed files with 94 additions and 2 deletions

View File

@ -279,6 +279,9 @@
<Reference Include="UnityEngine.XRModule"> <Reference Include="UnityEngine.XRModule">
<HintPath>Libs\UnityEngine.XRModule.dll</HintPath> <HintPath>Libs\UnityEngine.XRModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UrGUI">
<HintPath>Libs\UrGUI.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Cheat\DebugFeature.cs" /> <Compile Include="Cheat\DebugFeature.cs" />
@ -311,6 +314,7 @@
<Compile Include="UX\QuickSkip.cs" /> <Compile Include="UX\QuickSkip.cs" />
<Compile Include="UX\RandomBgm.cs" /> <Compile Include="UX\RandomBgm.cs" />
<Compile Include="UX\RunCommandOnEvents.cs" /> <Compile Include="UX\RunCommandOnEvents.cs" />
<Compile Include="UX\SelectionDetail.cs" />
<Compile Include="UX\SinglePlayer.cs" /> <Compile Include="UX\SinglePlayer.cs" />
<Compile Include="UX\SkipEventInfo.cs" /> <Compile Include="UX\SkipEventInfo.cs" />
<Compile Include="UX\SkipWarningScreen.cs" /> <Compile Include="UX\SkipWarningScreen.cs" />

View File

@ -54,6 +54,8 @@ CustomPlaceName=""
# In the song selection screen, press the Service button or the "7" key (the round button in the middle of the arrow keys in the default ADX firmware) to toggle the display of self-made charts. # In the song selection screen, press the Service button or the "7" key (the round button in the middle of the arrow keys in the default ADX firmware) to toggle the display of self-made charts.
# A directory is considered to contain self-made charts if it does not have DataConfig.xml or OfficialChartsMark.txt in the Axxx directory. # A directory is considered to contain self-made charts if it does not have DataConfig.xml or OfficialChartsMark.txt in the Axxx directory.
HideSelfMadeCharts=true HideSelfMadeCharts=true
# Show detail of selected song in music selection screen
SelectionDetail=true
[Performance] [Performance]
# Disable some useless delays to speed up the game boot process # Disable some useless delays to speed up the game boot process

View File

@ -60,6 +60,8 @@ CustomPlaceName=""
# 选歌界面按下 Service 键或者键盘上的 “7” 键ADX 默认固件下箭头键中间的圆形按键)切换自制谱的显示和隐藏 # 选歌界面按下 Service 键或者键盘上的 “7” 键ADX 默认固件下箭头键中间的圆形按键)切换自制谱的显示和隐藏
# 是否是自制谱的判断方式是 Axxx 目录里没有 DataConfig.xml 或 OfficialChartsMark.txt 就认为这个目录里是自制谱 # 是否是自制谱的判断方式是 Axxx 目录里没有 DataConfig.xml 或 OfficialChartsMark.txt 就认为这个目录里是自制谱
HideSelfMadeCharts=true HideSelfMadeCharts=true
# 选歌界面显示选择的歌曲的详情
SelectionDetail=true
# =================================== # ===================================
# 一些性能优化 # 一些性能优化

View File

@ -34,6 +34,7 @@ namespace AquaMai
public bool LoadLocalBga { get; set; } public bool LoadLocalBga { get; set; }
public bool TestProof { get; set; } public bool TestProof { get; set; }
public bool HideSelfMadeCharts { get; set; } public bool HideSelfMadeCharts { get; set; }
public bool SelectionDetail { get; set; }
public string CustomVersionString { get; set; } public string CustomVersionString { get; set; }
public string CustomPlaceName { get; set; } public string CustomPlaceName { get; set; }
public string ExecOnIdle { get; set; } public string ExecOnIdle { get; set; }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ILMerge> <ILMerge>
<IncludeAssemblies>tomlet</IncludeAssemblies> <IncludeAssemblies>tomlet|urgui</IncludeAssemblies>
<NamespacePrefix>$AquaMai$_</NamespacePrefix> <NamespacePrefix>$AquaMai$_</NamespacePrefix>
</ILMerge> </ILMerge>
</Weavers> </Weavers>

BIN
AquaMai/Libs/UrGUI.dll Normal file

Binary file not shown.

View File

@ -0,0 +1,83 @@
using System.Linq;
using AquaMai.Helpers;
using HarmonyLib;
using MAI2.Util;
using Manager;
using Manager.MaiStudio;
using Manager.UserDatas;
using Monitor;
using Process;
using UnityEngine;
using UrGUI.GUIWindow;
namespace AquaMai.UX;
public class SelectionDetail
{
private static Window window;
public static MusicSelectProcess.MusicSelectData SelectData { get; private set; }
public static int Difficulty { get; private set; }
[HarmonyPostfix]
[HarmonyPatch(typeof(MusicSelectMonitor), "UpdateRivalScore")]
public static void ScrollUpdate(MusicSelectProcess ____musicSelect, MusicSelectMonitor __instance)
{
if (__instance != ____musicSelect.MonitorArray[0]) return;
if (window != null)
{
window.Close();
}
if (____musicSelect.IsRandomIndex()) return;
SelectData = ____musicSelect.GetMusic(0);
if (SelectData == null) return;
Difficulty = ____musicSelect.GetDifficulty(0);
window = __instance.gameObject.AddComponent<Window>();
}
public class Window : MonoBehaviour
{
private GUIWindow window;
private void Start()
{
window = GUIWindow.Begin($"ID: {SelectData.MusicData.name.id}", Screen.width / 2f - 100, Screen.height * 0.87f, 200, 50, 10, 22, 5, true, true, true);
window.Label(MusicDirHelper.LookupPath(SelectData.MusicData.name.id).Split('/').Reverse().ToArray()[3]);
window.Label(SelectData.MusicData.genreName?.str);
window.Label(SelectData.MusicData.AddVersion?.str);
window.Label($"{SelectData.MusicData.notesData[Difficulty]?.level}.{SelectData.MusicData.notesData[Difficulty]?.levelDecimal}");
var rate = CalcB50(SelectData.MusicData);
if (rate > 0)
{
window.Label($"SSS+ => DXRating += {rate}");
}
}
private uint CalcB50(MusicData musicData)
{
var newRate = new UserRate(musicData.name.id, Difficulty, 1010000, (uint)musicData.version);
var user = Singleton<UserDataManager>.Instance.GetUserData(0);
var userLowRate = (newRate.OldFlag ? user.RatingList.RatingList : user.RatingList.NewRatingList).Last();
if (newRate.SingleRate > userLowRate.SingleRate)
{
return newRate.SingleRate - userLowRate.SingleRate;
}
return 0;
}
private void OnGUI()
{
window.Draw();
}
public void Close()
{
Destroy(this);
}
}
}