forked from akanyan/mu3-mods
feat: implement PlatinumTiming
* Also fix icons in InfiniteGP.
This commit is contained in:
19
PlatinumTiming/MU3.Battle/patch_Counters.cs
Normal file
19
PlatinumTiming/MU3.Battle/patch_Counters.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
PlatinumTiming/MU3.Battle/patch_GameEngine.cs
Normal file
13
PlatinumTiming/MU3.Battle/patch_GameEngine.cs
Normal 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;
|
||||
}
|
||||
}
|
5
PlatinumTiming/MU3.Game/patch_SessionResult.cs
Normal file
5
PlatinumTiming/MU3.Game/patch_SessionResult.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace MU3.Game;
|
||||
class patch_SessionResult: SessionResult {
|
||||
public int PlatinumFastCount { get; set; }
|
||||
public int PlatinumLateCount { get; set; }
|
||||
}
|
63
PlatinumTiming/MU3/patch_UIResultTechScore.cs
Normal file
63
PlatinumTiming/MU3/patch_UIResultTechScore.cs
Normal 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();
|
||||
}
|
||||
}
|
13
PlatinumTiming/PlatinumTiming.csproj
Normal file
13
PlatinumTiming/PlatinumTiming.csproj
Normal 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>
|
Reference in New Issue
Block a user