Skip to content

Commit 4d33891

Browse files
authored
Add files via upload
1 parent fe49b4a commit 4d33891

File tree

3 files changed

+1305
-0
lines changed

3 files changed

+1305
-0
lines changed

ErrorMeter.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Reflection;
7+
using HarmonyLib;
8+
using DG.Tweening;
9+
using UnityEngine;
10+
using UnityEngine.UI;
11+
12+
namespace JudgePracticeMod
13+
{
14+
public static class ErrorMeter
15+
{
16+
public static readonly Vector2 Perfect = new Vector2(0.5f, 0.119f);
17+
public static readonly Vector2 EarlyPerfect = new Vector2(0.45f, 0.095f);
18+
public static readonly Vector2 LatePerfect = new Vector2(0.55f, 0.095f);
19+
public static readonly Vector2 VeryEarly = new Vector2(0.435f, 0.075f);
20+
public static readonly Vector2 VeryLate = new Vector2(0.565f, 0.095f);
21+
public static readonly Vector2 TooEarly = new Vector2(0.427f, 0.035f);
22+
public static readonly Vector2 TooLate = new Vector2(0.573f, 0.035f);
23+
public static TEXT txt;
24+
public static void Do()
25+
{
26+
txt = new TEXT();
27+
Main.texts.Add(txt);
28+
txt.Init(true);
29+
Main.Set.Error = true;
30+
}
31+
[HarmonyPatch(typeof(scrHitErrorMeter), "DrawCurvedTick")]
32+
public static class Follow
33+
{
34+
public static bool Prefix(scrHitErrorMeter __instance, float angle, ref string[] ___cachedTweenIds, ref Image[] ___cachedTickImages, ref int ___tickIndex)
35+
{
36+
if (!Main.Set.Error) return true;
37+
Color color = (Color)typeof(scrHitErrorMeter).GetMethod("CalculateTickColor", AccessTools.all).Invoke(__instance, new object[] { angle });
38+
Image tickImage = ___cachedTickImages[___tickIndex];
39+
string text = ___cachedTweenIds[___tickIndex];
40+
tickImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, angle);
41+
DOTween.Kill(text, false);
42+
43+
tickImage.color = color;
44+
tickImage.DOColor(color.WithAlpha(0f), __instance.tickLife).SetEase(Ease.InQuad).SetId(text).OnKill(delegate
45+
{
46+
tickImage.color = Color.clear;
47+
});
48+
49+
txt.g.mainText.color = color;
50+
txt.g.mainText.rectTransform.rotation = Quaternion.Euler(0f, 0f, angle);
51+
txt.g.shadowText.rectTransform.rotation = Quaternion.Euler(0f, 0f, angle);
52+
___tickIndex = (___tickIndex + 1) % __instance.tickCacheSize;
53+
return false;
54+
}
55+
}
56+
57+
}
58+
}

0 commit comments

Comments
 (0)