@@ -13,15 +13,18 @@ namespace PerfectionDisplay
1313 public class Plugin : IPlugin
1414 {
1515 public string Name => "Perfection Display" ;
16- public string Version => "1.3.1 " ;
16+ public string Version => "1.4.0 " ;
1717
1818 public static string lastText = "" ;
1919 public static string lastPercent = "" ;
2020 public static string lastCount = "" ;
2121
22- private readonly string [ ] env = { "DefaultEnvironment" , "BigMirrorEnvironment" , "TriangleEnvironment" , "NiceEnvironment" } ;
22+ TextMeshProUGUI text ;
23+ TextMeshProUGUI percent ;
24+ TextMeshProUGUI count ;
2325
2426 bool init = true ;
27+ GameScenesManager gameScenesManager = null ;
2528
2629 public void OnApplicationStart ( )
2730 {
@@ -91,10 +94,18 @@ private void LoadHitScore()
9194 PerfectDisplay . hitScoreNames [ i ] = judgments [ i ] . text . Replace ( "%n" , "" ) . Replace ( "%s" , "" ) . Replace ( "%B" , "" ) . Replace ( "%C" , "" ) . Replace ( "%A" , "" ) . Trim ( ) ;
9295 PerfectDisplay . colors [ i ] = "#" + ( ( int ) ( judgments [ i ] . color [ 0 ] * 255 ) ) . ToString ( "X2" ) + ( ( int ) ( judgments [ i ] . color [ 1 ] * 255 ) ) . ToString ( "X2" ) + ( ( int ) ( judgments [ i ] . color [ 2 ] * 255 ) ) . ToString ( "X2" ) + ( ( int ) ( judgments [ i ] . color [ 3 ] * 255 ) ) . ToString ( "X2" ) ;
9396 }
94- PerfectDisplay . colors [ PerfectDisplay . colors . Length - 1 ] = "#FF0000 " ;
97+ PerfectDisplay . colors [ PerfectDisplay . colors . Length - 1 ] = "#afa5a3 " ;
9598 }
9699 private void OnSceneChanged ( Scene _ , Scene scene )
97100 {
101+ if ( gameScenesManager == null )
102+ {
103+ gameScenesManager = Resources . FindObjectsOfTypeAll < GameScenesManager > ( ) . FirstOrDefault ( ) ;
104+ if ( gameScenesManager != null )
105+ {
106+ gameScenesManager . transitionDidFinishEvent += OnTransition ;
107+ }
108+ }
98109 if ( init )
99110 {
100111 init = false ;
@@ -107,34 +118,44 @@ private void OnSceneChanged(Scene _, Scene scene)
107118 {
108119 if ( rootGameObject . name . Equals ( "ViewControllers" ) )
109120 {
110- TextMeshProUGUI text = MonoBehaviour . Instantiate ( Resources . FindObjectsOfTypeAll < TextMeshProUGUI > ( ) . Last ( x => ( x . name == "Title" ) ) , rootGameObject . transform . Find ( "Results" ) . Find ( "Cleared" ) , false ) ;
111- text . fontSize = 4 ;
121+ int extraOffset = 25 ;
122+ Console . WriteLine ( rootGameObject . transform . childCount ) ;
123+ text = MonoBehaviour . Instantiate ( Resources . FindObjectsOfTypeAll < TextMeshProUGUI > ( ) . Last ( x => ( x . name == "Title" ) ) , rootGameObject . transform . Find ( "LevelSelection" ) . Find ( "StandardLevelResultsViewController" ) , false ) ;
124+ text . fontSize = 5 ;
112125 text . color = Color . white ;
113126 text . paragraphSpacing = - 15f ;
114127 text . text = lastText ;
115128 text . alignment = TextAlignmentOptions . TopLeft ;
116- text . rectTransform . localPosition = new Vector3 ( - 25 , 40 , 0 ) ;
117- text = MonoBehaviour . Instantiate ( Resources . FindObjectsOfTypeAll < TextMeshProUGUI > ( ) . Last ( x => ( x . name == "Title" ) ) , rootGameObject . transform . Find ( "Results " ) . Find ( "Cleared " ) , false ) ;
118- text . fontSize = 4 ;
119- text . color = Color . white ;
120- text . paragraphSpacing = - 15f ;
121- text . text = lastCount ;
122- text . alignment = TextAlignmentOptions . TopLeft ;
123- text . rectTransform . localPosition = new Vector3 ( 0 - 5 , 40 , 0 ) ;
124- text = MonoBehaviour . Instantiate ( Resources . FindObjectsOfTypeAll < TextMeshProUGUI > ( ) . Last ( x => ( x . name == "Title" ) ) , rootGameObject . transform . Find ( "Results " ) . Find ( "Cleared " ) , false ) ;
125- text . fontSize = 4 ;
126- text . color = Color . white ;
127- text . paragraphSpacing = - 15f ;
128- text . text = lastPercent ;
129- text . alignment = TextAlignmentOptions . TopLeft ;
130- text . rectTransform . localPosition = new Vector3 ( 10 - 5 , 40 , 0 ) ;
129+ text . rectTransform . localPosition = new Vector3 ( - 20 + extraOffset , 40 , 0 ) ;
130+ percent = MonoBehaviour . Instantiate ( Resources . FindObjectsOfTypeAll < TextMeshProUGUI > ( ) . Last ( x => ( x . name == "Title" ) ) , rootGameObject . transform . Find ( "LevelSelection " ) . Find ( "StandardLevelResultsViewController " ) , false ) ;
131+ percent . fontSize = 5 ;
132+ percent . color = Color . white ;
133+ percent . paragraphSpacing = - 15f ;
134+ percent . text = lastCount ;
135+ percent . alignment = TextAlignmentOptions . TopLeft ;
136+ percent . rectTransform . localPosition = new Vector3 ( 0 + extraOffset , 40 , 0 ) ;
137+ count = MonoBehaviour . Instantiate ( Resources . FindObjectsOfTypeAll < TextMeshProUGUI > ( ) . Last ( x => ( x . name == "Title" ) ) , rootGameObject . transform . Find ( "LevelSelection " ) . Find ( "StandardLevelResultsViewController " ) , false ) ;
138+ count . fontSize = 5 ;
139+ count . color = Color . white ;
140+ count . paragraphSpacing = - 15f ;
141+ count . text = lastPercent ;
142+ count . alignment = TextAlignmentOptions . TopLeft ;
143+ count . rectTransform . localPosition = new Vector3 ( 15 + extraOffset , 40 , 0 ) ;
131144 return ;
132145 }
133146 }
134147 }
135- if ( ! env . Contains ( scene . name ) ) return ;
136-
137- new GameObject ( "PerfectDisplay" ) . AddComponent < PerfectDisplay > ( ) ;
148+ if ( scene . name . Equals ( "GameCore" ) ) new GameObject ( "PerfectDisplay" ) . AddComponent < PerfectDisplay > ( ) ;
149+ }
150+ private void OnSceneLoad ( Scene _ , LoadSceneMode mode )
151+ {
152+ Console . WriteLine ( _ . name ) ;
153+ }
154+ public void OnTransition ( )
155+ {
156+ if ( text != null ) text . text = lastText ;
157+ if ( percent != null ) percent . text = lastPercent ;
158+ if ( count != null ) count . text = lastCount ;
138159 }
139160
140161 private bool HasType ( string typeName )
@@ -153,10 +174,12 @@ private bool HasType(string typeName)
153174
154175 public void OnLevelWasLoaded ( int level )
155176 {
177+
156178 }
157179
158180 public void OnLevelWasInitialized ( int level )
159181 {
182+
160183 }
161184
162185 public void OnUpdate ( )
0 commit comments