This repository has been archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Indicator.cs
92 lines (75 loc) · 2.54 KB
/
Indicator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using UnityEngine;
using UnityEngine.UI;
using static MuseDashMirror.BattleComponent;
using static MuseDashMirror.UICreate.CanvasCreate;
using static MuseDashMirror.UICreate.Colors;
using static MuseDashMirror.UICreate.Fonts;
using static MuseDashMirror.UICreate.TextGameObjectCreate;
namespace FC_AP;
internal class Indicator : MonoBehaviour
{
public Indicator(IntPtr intPtr) : base(intPtr)
{
}
private static GameObject _Indicator { get; set; }
private static Text _Text { get; set; }
private static int _CurrentMiss { get; set; }
// if collectable note not count as miss
private static bool NoCollectableNoteMiss => !Save.Settings.CollectableMissEnabled && CollectableNoteMissNum > 0;
// if collectable note not count as miss
private static bool NoGhostMiss => !Save.Settings.GhostMissEnabled && GhostMissNum > 0;
private void OnDestroy()
{
_Indicator = default;
_CurrentMiss = default;
}
internal static void DestroyGameObject() => Destroy(_Indicator);
internal static void SetAP()
{
CreateCanvas("Indicator Canvas", "Camera_2D");
_Indicator = CreateTextGameObject("Indicator Canvas", "Indicator", "AP",
TextAnchor.UpperLeft, true, new Vector3(-102.398f, 367.2864f, 0f),
new Vector2(960, 216), 100, SnapsTasteFont, Color.yellow);
_Text = _Indicator.GetComponent<Text>();
}
internal static void UpdateIndicator()
{
// if no great and miss, return
if (GreatNum == 0 && TotalMissNum == 0) return;
if (TotalMissNum > 0) UpdateMissNum();
if (GreatNum > 0)
{
if (_CurrentMiss == 0)
{
_Text.text = "FC " + GreatNum + "G";
_Text.color = Blue;
return;
}
_Text.text = _CurrentMiss + "M " + GreatNum + "G";
_Text.color = Silver;
return;
}
if (_CurrentMiss == 0)
{
_Text.text = "FC";
_Text.color = Blue;
}
else
{
_Text.text = _CurrentMiss + "M";
_Text.color = Silver;
}
}
private static void UpdateMissNum()
{
if (NoCollectableNoteMiss)
_CurrentMiss = NormalMissNum + GhostMissNum;
else if (NoGhostMiss)
_CurrentMiss = NormalMissNum + CollectableNoteMissNum;
else if (NoCollectableNoteMiss && NoGhostMiss)
_CurrentMiss = NormalMissNum;
else
_CurrentMiss = TotalMissNum;
}
}