-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Plugin.cs
50 lines (45 loc) · 1.72 KB
/
Plugin.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
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using IPA;
using System.Collections;
using BeatSaberMarkupLanguage.Settings;
using BeatSaberMarkupLanguage;
using System.Reflection;
using BS_Utils.Utilities;
using System;
namespace PerfectionDisplay
{
[Plugin(RuntimeOptions.SingleStartInit)]
public class Plugin
{
public static string lastText = "";
public static string lastPercent = "";
public static string lastCount = "";
public static TMP_FontAsset mainFont;
[OnStart]
public void OnApplicationStart()
{
BSMLSettings.instance.AddSettingsMenu("Perfection Display", "PerfectionDisplay.settings.bsml", Settings.instance);
BSEvents.gameSceneActive += GameSceneActive;
BSEvents.menuSceneActive += MenuSceneActive;
BSEvents.menuSceneLoadedFresh += MenuSceneFresh;
}
private void MenuSceneFresh()
{
BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "PerfectionDisplay.results.bsml"), Resources.FindObjectsOfTypeAll<ResultsViewController>().FirstOrDefault().gameObject, ResultsScreenText.instance);
mainFont = Resources.FindObjectsOfTypeAll<TextMeshProUGUI>().First(t => t.font?.name == "Teko-Medium SDF No Glow")?.font;
}
public void GameSceneActive()
{
new GameObject("PerfectDisplay").AddComponent<PerfectDisplay>();
}
public void MenuSceneActive()
{
ResultsScreenText.instance.Names = lastText;
ResultsScreenText.instance.Counts = lastCount;
ResultsScreenText.instance.Percents = lastPercent;
}
}
}