Skip to content

Commit 67a8ad0

Browse files
[O] 优化CustomIntroCinematic:当玩家有成绩时不触发开场视频 (#92)
* [F]优化CustomIntroCinematic:当玩家有成绩时不触发开场视频 * Update AquaMai.Mods.csproj * Update AquaMai.Mods.csproj * Update AquaMai.Mods.csproj * 增加选项 * 还原 using --------- Co-authored-by: Clansty <i@gao4.pw>
1 parent 6c5a13c commit 67a8ad0

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

AquaMai.Mods/Fancy/CustomIntroCinematic.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using Process;
1515
using UnityEngine;
1616
using UnityEngine.Video;
17-
using Monitor;
1817

1918
namespace AquaMai.Mods.Fancy;
2019

@@ -41,6 +40,12 @@ public class CustomIntroCinematic
4140
"效果演示: https://www.bilibili.com/video/BV1jTxVzjETG")]
4241
private static readonly string IntroMovieDir = "LocalAssets/IntroMovies";
4342

43+
[ConfigEntry(name: "仅在未玩过乐曲时播放",
44+
zh: "开启后,仅当 1P 2P 双方均没有玩过这首乐曲时播放开场视频",
45+
en: "Only play the intro cinematic when both players have not played the song")]
46+
private static readonly bool onlyPlayWhenNotPlayed = false;
47+
48+
4449
private static bool _isInitialized = false;
4550

4651
private static Dictionary<int, (string leftPath, string rightPath, string acbPath, string awbPath)> _targetIDMovieDict = new Dictionary<int, (string leftPath, string rightPath, string acbPath, string awbPath)>();
@@ -924,9 +929,29 @@ public static bool GameStartPrefix(MusicSelectProcess __instance)
924929
Manager.Party.Party.IManager PartyManager = Manager.Party.Party.Party.Get();
925930
if (SingletonStateMachine<AmManager, AmManager.EState>.Instance.Backup.gameSetting.MachineGroupID != DB.MachineGroupID.OFF && PartyManager != null && PartyManager.IsJoinAndActive())
926931
return true;
932+
933+
//获取曲目ID
934+
var musicId = GameManager.SelectMusicID[0];
935+
936+
if (onlyPlayWhenNotPlayed)
937+
{
938+
//任一玩家拥有曲目成绩时不生效
939+
for (int i = 0; i < 4; ++i)
940+
{
941+
var playerData = Singleton<UserDataManager>.Instance.GetUserData(i);
942+
if (playerData != null)
943+
{
944+
for (int j = 0; j < 6; ++j)
945+
{
946+
playerData.ScoreDic[j].TryGetValue(musicId, out UserScore musicScore);
947+
if (musicScore != null)
948+
return true;
949+
}
950+
}
951+
}
952+
}
927953

928954
// 检查当前选择的歌曲是否为目标歌曲
929-
var musicId = GameManager.SelectMusicID[0];
930955
if (_targetIDMovieDict.TryGetValue(musicId, out var videoPath))
931956
{
932957
MelonLogger.Msg($"[CustomIntroCinematic] Play intro cinematic for music {musicId}");

0 commit comments

Comments
 (0)