feat: implement PlatinumTiming

* Also fix icons in InfiniteGP.
This commit is contained in:
あかニャン 2024-07-21 02:24:09 +09:00
parent b2ecf368fb
commit 946402fa82
7 changed files with 124 additions and 7 deletions

View File

@ -13,6 +13,7 @@ class patch_UICredit: UICredit {
private MU3UICounter gpPlus_;
private MU3UICounter gpMinus_;
private MU3UIImageChanger netIcon_;
private MU3UIImageChanger groupIcon_;
private void onUpdateGP(int value) { /* nop */ }
public extern void orig_initialize();
@ -30,13 +31,10 @@ class patch_UICredit: UICredit {
gpPlus_.transform.localScale = new Vector3(0, 0, 0);
gpMinus_.transform.localScale = new Vector3(0, 0, 0);
var tf = (RectTransform)netIcon_.transform;
tf.localPosition = new Vector3(35, netIcon_.transform.localPosition.y, netIcon_.transform.localPosition.z);
for(int i = 0; i < 3; ++i) {
tf.anchorMin = new Vector2(0f, 0.5f);
tf.anchorMax = new Vector2(1f, 0.5f);
tf = (RectTransform)tf.parent;
}
netIcon_.transform.localPosition = new Vector3(-514, netIcon_.transform.localPosition.y, netIcon_.transform.localPosition.z);
netIcon_.image.rectTransform.pivot = new Vector2(0f, 0.5f);
groupIcon_.transform.localPosition = new Vector3(-476, groupIcon_.transform.localPosition.y, groupIcon_.transform.localPosition.z);
groupIcon_.image.rectTransform.pivot = new Vector2(0f, 0.5f);
}
}

View File

@ -37,6 +37,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnlockGameEvents", "UnlockG
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnlockMemoryChapters", "UnlockMemoryChapters\UnlockMemoryChapters.csproj", "{3A217A12-6082-491B-89F6-C1D13AD69A19}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatinumTiming", "PlatinumTiming\PlatinumTiming.csproj", "{099AD6AF-181A-4745-88C4-1D0466BECCB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -111,6 +113,10 @@ Global
{3A217A12-6082-491B-89F6-C1D13AD69A19}.Debug|x64.Build.0 = Debug|x64
{3A217A12-6082-491B-89F6-C1D13AD69A19}.Release|x64.ActiveCfg = Release|x64
{3A217A12-6082-491B-89F6-C1D13AD69A19}.Release|x64.Build.0 = Release|x64
{099AD6AF-181A-4745-88C4-1D0466BECCB1}.Debug|x64.ActiveCfg = Debug|x64
{099AD6AF-181A-4745-88C4-1D0466BECCB1}.Debug|x64.Build.0 = Debug|x64
{099AD6AF-181A-4745-88C4-1D0466BECCB1}.Release|x64.ActiveCfg = Release|x64
{099AD6AF-181A-4745-88C4-1D0466BECCB1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,19 @@
using MU3.Notes;
namespace MU3.Battle;
class patch_Counters: Counters {
public int PlatinumFastCount { get; private set; }
public int PlatinumLateCount { get; private set; }
public extern void orig_addPlatinumScore(Judge judge, Timing timing);
public new void addPlatinumScore(Judge judge, Timing timing) {
orig_addPlatinumScore(judge, timing);
if(judge == Judge.Perfect) {
if(timing == Timing.Fast) {
PlatinumFastCount += 1;
} else if(timing == Timing.Late) {
PlatinumLateCount += 1;
}
}
}
}

View File

@ -0,0 +1,13 @@
using MU3.Game;
namespace MU3.Battle;
class patch_GameEngine: GameEngine {
private patch_Counters _counters;
public extern void orig_calcCurrentBattleResult(SessionResult sessionResult);
public void calcCurrentBattleResult(patch_SessionResult sessionResult) {
orig_calcCurrentBattleResult(sessionResult);
sessionResult.PlatinumFastCount = _counters.PlatinumFastCount;
sessionResult.PlatinumLateCount = _counters.PlatinumLateCount;
}
}

View File

@ -0,0 +1,5 @@
namespace MU3.Game;
class patch_SessionResult: SessionResult {
public int PlatinumFastCount { get; set; }
public int PlatinumLateCount { get; set; }
}

View File

@ -0,0 +1,63 @@
using MU3.CustomUI;
using MU3.Game;
using MU3.Sequence;
using MU3.Util;
using System.Collections;
using UnityEngine;
namespace MU3;
class patch_UIResultTechScore: UIResultTechScore {
private MU3UICounter counterFast_;
private MU3UICounter counterLate_;
private Animator animator_;
private static readonly int State_TechnicalScore_Loop;
private void cloneCounter(MU3UICounter counter, Color color, int value) {
var otherValue = counter.CounterAsInt;
var offset = 12;
while(otherValue > 9) {
otherValue /= 10;
offset += 8;
}
var cpy = Instantiate(counter);
cpy.color = color;
cpy.gameObject.transform.SetParent(counter.transform.parent, false);
var pos = counter.gameObject.transform.localPosition;
cpy.gameObject.transform.localPosition = new Vector3(pos.x - offset, pos.y, pos.z);
cpy.gameObject.SetActive(true);
cpy.CounterAsInt = value;
}
private void drawCounters() {
float posXf = counterFast_.gameObject.transform.localPosition.x + 5.0f;
float posXl = counterLate_.gameObject.transform.localPosition.x + 5.0f;
float posY = counterLate_.gameObject.transform.localPosition.y;
counterFast_.gameObject.transform.localPosition = new Vector3(posXf, posY, 0.0f);
counterLate_.gameObject.transform.localPosition = new Vector3(posXl, posY, 0.0f);
var sessionResult = (patch_SessionResult)Singleton<PlayInfo>.instance.sessionResult;
cloneCounter(
counterFast_,
new Color(0.630f, 0.766f, 0.829f, 1.000f),
sessionResult.PlatinumFastCount
);
cloneCounter(
counterLate_,
new Color(0.809f, 0.396f, 0.365f, 1.000f),
sessionResult.PlatinumLateCount
);
}
private extern IEnumerator orig_showPlatinumScore(PlayInfo playInfo);
private IEnumerator showPlatinumScore(PlayInfo playInfo) {
StartCoroutine(orig_showPlatinumScore(playInfo));
while(!AnimatorState.stateEquals(animator_, State_TechnicalScore_Loop)) {
yield return null;
}
drawCounters();
}
}

View File

@ -0,0 +1,13 @@
<Project>
<PropertyGroup>
<AssemblyName>Assembly-CSharp.PlatinumTiming.mm</AssemblyName>
<Description>Platinum early/late</Description>
</PropertyGroup>
<Import Project="..\Mu3Mods.csproj" />
<ItemGroup>
<None Remove="MU3\patch_UIResultTechScore.experiment" />
</ItemGroup>
<ItemGroup>
<Compile Include="MU3\patch_UIResultTechScore.experiment" />
</ItemGroup>
</Project>