private static void SetMenuPlayersPlaceColors(ColorScheme cs)
        {
            try
            {
                var menuPlayersPlace = FindUnityObjectsHelper.GetAllGameObjectsInLoadedScenes().Find(x => x.name == "MenuPlayersPlace");

                foreach (Transform child in menuPlayersPlace.transform)
                {
                    if (child.name == "Feet")
                    {
                        var sprite = child.GetComponent <SpriteRenderer>();
                        sprite.color = cs.environmentColor1;
                    }
                    if (child.name == "RectangleFakeGlow")
                    {
                        var fakeglow = child.GetComponent <RectangleFakeGlow>();
                        fakeglow.color = cs.environmentColor1.ColorWithAlpha(0.5f);
                    }
                }

                Plugin.Logger.Info("applied PlayerPlace colors");
            }
            catch (Exception e)
            {
                Plugin.Logger.Error(e);
            }
        }
        private static void SetLogoColors(ColorScheme cs)
        {
            try
            {
                var logo = FindUnityObjectsHelper.GetAllGameObjectsInLoadedScenes().Find(x => x.name == "Logo");

                foreach (Transform t in logo.transform)
                {
                    //Plugin.Logger.Debug(t.name);
                    //Plugin.Logger.Debug(t.GetType().ToString());

                    if (t.name == "BATNeon" || t.name == "SaberNeon")
                    {
                        var prePassLight = t.GetComponent <TubeBloomPrePassLight>();

                        var lightType = prePassLight.GetBasePrivateField <BloomPrePassLightTypeSO>("_lightType");
                        prePassLight.SetBasePrivateField("_registeredWithLightType", lightType);

                        if (t.name == "BATNeon")
                        {
                            prePassLight.color = cs.environmentColor0.ColorWithAlpha(prePassLight.color.a);
                        }
                        if (t.name == "SaberNeon")
                        {
                            prePassLight.color = cs.environmentColor1.ColorWithAlpha(prePassLight.color.a);
                        }
                    }

                    if (t.name == "BatLogo" || t.name == "SaberLogo")
                    {
                        var sprite = t.GetComponent <SpriteRenderer>();

                        if (t.name == "BatLogo")
                        {
                            sprite.color = cs.environmentColor0.ColorWithAlpha(sprite.color.a);
                        }

                        if (t.name == "SaberLogo")
                        {
                            sprite.color = cs.environmentColor1.ColorWithAlpha(sprite.color.a);
                        }
                    }

                    if (t.name == "EFlickering")
                    {
                        var flicker = t.GetComponent <FlickeringNeonSign>();

                        SetFlickeringNeonColor(flicker, cs.environmentColor0);
                    }
                }

                Plugin.Logger.Info("applied Logo colors");
            }
            catch (Exception e)
            {
                Plugin.Logger.Error(e);
            }
        }
Example #3
0
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
        {
            if (Configuration.PluginConfig.Instance.OnlyInMainMenu)
            {
                GameObject.Find("CustomMenuText")?.transform.SetParent(defaultLogo.transform.parent.transform, true);
            }
            if (Configuration.PluginConfig.Instance.OnlyInMainMenu)
            {
                GameObject.Find("CustomMenuText-Bot")?.transform.SetParent(defaultLogo.transform.parent.transform, true);
            }
            if (!Configuration.PluginConfig.Instance.OnlyInMainMenu)
            {
                GameObject.Find("CustomMenuText")?.transform.SetParent(null, true);
            }
            if (!Configuration.PluginConfig.Instance.OnlyInMainMenu)
            {
                GameObject.Find("CustomMenuText-Bot")?.transform.SetParent(null, true);
            }
            //refreshDi();
            if (mainText != null)
            {
                mainText.color = MainColor;
            }
            if (bottomText != null)
            {
                bottomText.color = BottomColor;
            }
            defaultLogo = FindUnityObjectsHelper.GetAllGameObjectsInLoadedScenes().Where(go => go.name == "Logo").FirstOrDefault();



            //Log.Notice("Changed to scene " + arg1.name);
            if (arg1.name.Contains("Menu")) // Only run in menu scene
            {
                if (allEntries == null)
                {
                    reloadFile();
                }
                if (allEntries.Count == 0)
                {
                    Console.WriteLine("[CustomMenuText] File found, but it contained no entries! Leaving original logo intact.");
                }
                else
                {
                    YeetUpTheText();
                }
            }
        }
Example #4
0
        /// <summary>
        /// Replaces the logo in the main menu (which is an image and not text
        /// as of game version 0.12.0) with an editable TextMeshPro-based
        /// version. Performs only the necessary steps (if the logo has already
        /// been replaced, restores the text's position and color to default
        /// instead).
        /// Warning: Only call this function from the main menu scene!
        ///
        /// Code generously donated by Kyle1413; edited some by Arti
        /// </summary>
        ///
        public static void replaceLogo()
        {
            // 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.
            if (textPrefab == null)
            {
                textPrefab = FontManager.FontList[Configuration.PluginConfig.Instance.Font].prefab;
            }

            defaultLogo = FindUnityObjectsHelper.GetAllGameObjectsInLoadedScenes().Where(go => go.name == "Logo").FirstOrDefault();

            // Logo Top Pos : 0.63, 18.61, 26.1
            // Logo Bottom Pos : 0, 14, 26.1

            /*if (mainText != null)
             * {
             *  GameObject.Destroy(GameObject.Find("CustomMenuText"));
             *  GameObject.Destroy(mainText);
             *  mainText = null;
             * }
             * if (bottomText != null)
             * {
             *  GameObject.Destroy(GameObject.Find("CustomMenuText-Bot"));
             *  GameObject.Destroy(bottomText);
             *  bottomText = null;
             * }
             */
            //if (mainText == null) mainText = GameObject.Find("CustomMenuText")?.GetComponent<TextMeshPro>();
            //if (mainText == null)
            {
                GameObject textObj = GameObject.Instantiate(textPrefab);
                textObj.name = "CustomMenuText";
                textObj.SetActive(false);
                mainText           = textObj.GetComponent <TextMeshPro>();
                mainText.alignment = TextAlignmentOptions.Center;
                mainText.fontSize  = 12;
                mainText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 2f);
                mainText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 2f);
                mainText.richText             = true;
                textObj.transform.localScale *= 3.7f;
                mainText.overflowMode         = TextOverflowModes.Overflow;
                mainText.enableWordWrapping   = false;
                textObj.SetActive(true);
                if (Configuration.PluginConfig.Instance.OnlyInMainMenu)
                {
                    textObj.transform.SetParent(defaultLogo.transform.parent.transform, true);
                }
            }
            mainText.rectTransform.position = new Vector3(0f, 18.61f, 26.1f);

            mainText.color = MainColor;

            mainText.text = "BEAT";

            //if (bottomText == null) bottomText = GameObject.Find("CustomMenuText-Bot")?.GetComponent<TextMeshPro>();
            //if (bottomText == null)
            {
                GameObject textObj2 = GameObject.Instantiate(textPrefab);
                textObj2.name = "CustomMenuText-Bot";
                textObj2.SetActive(false);
                bottomText           = textObj2.GetComponent <TextMeshPro>();
                bottomText.alignment = TextAlignmentOptions.Center;
                bottomText.fontSize  = 12;
                bottomText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 2f);
                bottomText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 2f);
                bottomText.richText            = true;
                textObj2.transform.localScale *= 3.7f;
                bottomText.overflowMode        = TextOverflowModes.Overflow;
                bottomText.enableWordWrapping  = false;
                textObj2.SetActive(true);
                if (Configuration.PluginConfig.Instance.OnlyInMainMenu)
                {
                    textObj2.transform.SetParent(defaultLogo.transform.parent.transform, true);
                }
            }
            bottomText.rectTransform.position = new Vector3(0f, 14f, 26.1f);
            bottomText.color = BottomColor;
            bottomText.text  = "SABER";



            // Destroy Default Logo

            //if (defaultLogo != null) defaultLogo.SetActive(false);
        }
Example #5
0
        /// <summary>
        /// Replaces the logo in the main menu (which is an image and not text
        /// as of game version 0.12.0) with an editable TextMeshPro-based
        /// version. Performs only the necessary steps (if the logo has already
        /// been replaced, restores the text's position and color to default
        /// instead).
        /// Warning: Only call this function from the main menu scene!
        ///
        /// Code generously donated by Kyle1413; edited some by Arti
        /// </summary>
        public static void replaceLogo()
        {
            // 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.
            if (textPrefab == null)
            {
                textPrefab = loadTextPrefab(FONT_PATH);
            }

            // Logo Top Pos : 0.63, 21.61, 24.82
            // Logo Bottom Pos : 0, 17.38, 24.82
            if (mainText == null)
            {
                mainText = GameObject.Find("CustomMenuText")?.GetComponent <TextMeshPro>();
            }
            if (mainText == null)
            {
                GameObject textObj = GameObject.Instantiate(textPrefab);
                textObj.name = "CustomMenuText";
                textObj.SetActive(false);
                mainText           = textObj.GetComponent <TextMeshPro>();
                mainText.alignment = TextAlignmentOptions.Center;
                mainText.fontSize  = 12;
                mainText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 2f);
                mainText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 2f);
                mainText.richText             = true;
                textObj.transform.localScale *= 3.7f;
                mainText.overflowMode         = TextOverflowModes.Overflow;
                mainText.enableWordWrapping   = false;
                textObj.SetActive(true);
            }
            mainText.rectTransform.position = new Vector3(0f, 21.61f, 24.82f);
            mainText.color = defaultMainColor;
            mainText.text  = "BEAT";

            if (bottomText == null)
            {
                bottomText = GameObject.Find("CustomMenuText-Bot")?.GetComponent <TextMeshPro>();
            }
            if (bottomText == null)
            {
                GameObject textObj2 = GameObject.Instantiate(textPrefab);
                textObj2.name = "CustomMenuText-Bot";
                textObj2.SetActive(false);
                bottomText           = textObj2.GetComponent <TextMeshPro>();
                bottomText.alignment = TextAlignmentOptions.Center;
                bottomText.fontSize  = 12;
                bottomText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 2f);
                bottomText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 2f);
                bottomText.richText            = true;
                textObj2.transform.localScale *= 3.7f;
                bottomText.overflowMode        = TextOverflowModes.Overflow;
                bottomText.enableWordWrapping  = false;
                textObj2.SetActive(true);
            }
            bottomText.rectTransform.position = new Vector3(0f, 17f, 24.82f);
            bottomText.color = defaultBottomColor;
            mainText.text    = "SABER";

            // Destroy Default Logo
            GameObject defaultLogo = FindUnityObjectsHelper.GetAllGameObjectsInLoadedScenes().Where(go => go.name == "Logo").FirstOrDefault();

            if (defaultLogo != null)
            {
                GameObject.Destroy(defaultLogo);
            }
        }