1212using System . IO ;
1313using System . Text ;
1414using System . Reflection ;
15+ using System . Threading . Tasks ;
1516
1617namespace CustomMenuText
1718{
@@ -20,6 +21,9 @@ public class Plugin
2021 {
2122 public static int selection_type = 0 ;
2223 public static int choice = 0 ;
24+ internal static bool DiColorFound = false ;
25+
26+ public static GameObject defaultLogo = new GameObject ( ) ;
2327
2428 internal static Plugin Instance { get ; private set ; }
2529 internal static IPALogger Log { get ; private set ; }
@@ -65,7 +69,10 @@ public void InitWithConfig(Config conf)
6569 // used if we can't load any custom entries
6670 public static readonly string [ ] DEFAULT_TEXT = { "BEAT" , "SABER" } ;
6771 public static readonly Color defaultMainColor = Color . red ;
68- public static readonly Color defaultBottomColor = new Color ( 0 , 0.5019608f , 1 ) ;
72+ public static readonly Color defaultBottomColor = new Color ( 0 , 0.659f , 1 ) ;
73+
74+ public static Color DiTopColor = Color . red ;
75+ public static Color DiBottomColor = new Color ( 0 , 0.5019608f , 1 ) ;
6976
7077 public const string DEFAULT_CONFIG =
7178@"# Custom Menu Text v3.1.3
@@ -233,11 +240,34 @@ public void OnApplicationStart()
233240 SceneManager . sceneLoaded += SceneManager_sceneLoaded ;
234241 Views . UICreator . CreateMenu ( ) ;
235242 }
243+ public void YeetUpTheText ( )
244+ {
245+ switch ( Configuration . PluginConfig . Instance . SelectionType )
246+ {
247+ case 0 :
248+ //default
249+ setText ( DEFAULT_TEXT ) ;
250+ break ;
251+ case 1 :
252+ //random
253+ pickRandomEntry ( ) ;
254+ break ;
255+ case 2 :
256+ //pre-chosen
257+ setText ( allEntries [ choice ] ) ;
258+ break ;
259+ }
260+ }
236261
237262 private void SceneManagerOnActiveSceneChanged ( Scene arg0 , Scene arg1 )
238263 {
264+
265+
266+
267+ Log . Notice ( "Changed to scene " + arg1 . name ) ;
239268 if ( arg1 . name . Contains ( "Menu" ) ) // Only run in menu scene
240269 {
270+ _ = FindDiColors ( ) ;
241271 if ( allEntries == null )
242272 {
243273 reloadFile ( ) ;
@@ -248,23 +278,7 @@ private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
248278 }
249279 else
250280 {
251- switch ( Configuration . PluginConfig . Instance . SelectionType )
252- {
253- case 0 :
254- //default
255- setText ( DEFAULT_TEXT ) ;
256- break ;
257- case 1 :
258- //random
259- pickRandomEntry ( ) ;
260- break ;
261- case 2 :
262- //pre-chosen
263- setText ( allEntries [ choice ] ) ;
264- break ;
265- }
266-
267-
281+ YeetUpTheText ( ) ;
268282 }
269283 }
270284 }
@@ -289,7 +303,10 @@ public void pickRandomEntry()
289303
290304 private void SceneManager_sceneLoaded ( Scene arg0 , LoadSceneMode arg1 )
291305 {
292-
306+ if ( arg0 . name . Equals ( "MenuCore" ) )
307+ {
308+ _ = FindDiColors ( ) ;
309+ }
293310 }
294311
295312 public static GameObject loadTextPrefab ( string path )
@@ -396,6 +413,10 @@ public static List<string[]> readFromFile(string relPath)
396413 ///
397414 /// Code generously donated by Kyle1413; edited some by Arti
398415 /// </summary>
416+ ///
417+
418+
419+
399420 public static void replaceLogo ( )
400421 {
401422 // Since 0.13.0, we have to create our TextMeshPros differently! You can't change the font at runtime, so we load a prefab with the right font from an AssetBundle. This has the side effect of allowing for custom fonts, an oft-requested feature.
@@ -404,6 +425,8 @@ public static void replaceLogo()
404425
405426 // Logo Top Pos : 0.63, 21.61, 24.82
406427 // Logo Bottom Pos : 0, 17.38, 24.82
428+
429+
407430 if ( mainText == null ) mainText = GameObject . Find ( "CustomMenuText" ) ? . GetComponent < TextMeshPro > ( ) ;
408431 if ( mainText == null )
409432 {
@@ -421,8 +444,19 @@ public static void replaceLogo()
421444 mainText . enableWordWrapping = false ;
422445 textObj . SetActive ( true ) ;
423446 }
424- mainText . rectTransform . position = new Vector3 ( 0f , 21.61f , 24.82f ) ;
425- mainText . color = defaultMainColor ;
447+ mainText . rectTransform . position = new Vector3 ( 0f , 18.61f , 26.1f ) ;
448+
449+ switch ( Configuration . PluginConfig . Instance . UsingDiColors )
450+ {
451+ case true :
452+ mainText . color = DiTopColor ;
453+ break ;
454+ case false :
455+ mainText . color = defaultMainColor ;
456+ break ;
457+ }
458+
459+ mainText . name = "CustomBeatText" ;
426460 mainText . text = "BEAT" ;
427461
428462 if ( bottomText == null ) bottomText = GameObject . Find ( "CustomMenuText-Bot" ) ? . GetComponent < TextMeshPro > ( ) ;
@@ -442,15 +476,51 @@ public static void replaceLogo()
442476 bottomText . enableWordWrapping = false ;
443477 textObj2 . SetActive ( true ) ;
444478 }
445- bottomText . rectTransform . position = new Vector3 ( 0f , 17f , 24.82f ) ;
446- bottomText . color = defaultBottomColor ;
447- mainText . text = "SABER" ;
479+ bottomText . rectTransform . position = new Vector3 ( 0f , 14f , 26.1f ) ;
480+ switch ( Configuration . PluginConfig . Instance . UsingDiColors )
481+ {
482+ case true :
483+ bottomText . color = DiBottomColor ;
484+ break ;
485+ case false :
486+ bottomText . color = defaultBottomColor ;
487+ break ;
488+ }
489+ bottomText . name = "CustomSaberText" ;
490+ bottomText . text = "SABER" ;
491+
492+
448493
449494 // Destroy Default Logo
450- GameObject defaultLogo = FindUnityObjectsHelper . GetAllGameObjectsInLoadedScenes ( ) . Where ( go => go . name == "Logo" ) . FirstOrDefault ( ) ;
451- if ( defaultLogo != null ) GameObject . Destroy ( defaultLogo ) ;
495+ defaultLogo = FindUnityObjectsHelper . GetAllGameObjectsInLoadedScenes ( ) . Where ( go => go . name == "Logo" ) . FirstOrDefault ( ) ;
496+ if ( defaultLogo != null ) defaultLogo . SetActive ( false ) ;
497+ }
498+
499+ public async Task FindDiColors ( )
500+ {
501+ //find default logo, for DiColors
502+ await Task . Delay ( 2500 ) ;
503+ GameObject topLogo = FindUnityObjectsHelper . GetAllGameObjectsInLoadedScenes ( ) . Where ( go => go . name == "BatLogo" ) . FirstOrDefault ( ) ;
504+ GameObject bottomLogo = FindUnityObjectsHelper . GetAllGameObjectsInLoadedScenes ( ) . Where ( go => go . name == "SaberLogo" ) . FirstOrDefault ( ) ;
505+
506+ SpriteRenderer topSprite = ( SpriteRenderer ) topLogo . GetComponent ( typeof ( SpriteRenderer ) ) ;
507+ SpriteRenderer bottomSprite = ( SpriteRenderer ) bottomLogo . GetComponent ( typeof ( SpriteRenderer ) ) ;
508+ Plugin . Log . Notice ( "color yeet " + topSprite . color . ToString ( ) ) ;
509+ Plugin . Log . Notice ( "color yeet 2 " + bottomSprite . color . ToString ( ) ) ;
510+ DiTopColor = topSprite . color ;
511+ DiBottomColor = bottomSprite . color ;
512+ Plugin . Log . Notice ( "found DiColors" ) ;
513+ Plugin . Log . Notice ( "color " + DiTopColor ) ;
514+ Plugin . Log . Notice ( "color " + DiBottomColor ) ;
515+ DiColorFound = true ;
516+ replaceLogo ( ) ;
517+ YeetUpTheText ( ) ;
452518 }
453519
520+
521+
522+
523+
454524 /// <summary>
455525 /// Sets the text in the main menu (which normally reads BEAT SABER) to
456526 /// the text of your choice. TextMeshPro formatting can be used here.
0 commit comments