Exemplo n.º 1
0
        private static uGUI_TextFade AddTextToLoadingScreen(string name, string text)
        {
            GameObject gameObject = Object.Instantiate(loadingTextGameObject, loadingTextGameObject.transform.parent);

            gameObject.name = name;

            uGUI_TextFade textFade = gameObject.GetComponent <uGUI_TextFade>();

            textFade.SetText(text);
            textFade.SetAlignment(TextAnchor.UpperRight);
            textFade.FadeIn(1f, null);

            return(textFade);
        }
        public CustomText(string text, float duration, int yOffset = 0, bool showProgress = false, bool useGlobalTextWidth = true)
        {
            this.duration           = duration;
            this.yOffset            = yOffset;
            startTime               = Time.time;
            isFadingOut             = false;
            this.useGlobalTextWidth = useGlobalTextWidth;

            textObject = new GameObject("TwitchInteractionTimerCooldown");
            textText   = textObject.AddComponent <Text>();
            textFade   = textObject.AddComponent <uGUI_TextFade>();
            textFitter = textObject.AddComponent <ContentSizeFitter>();

            textFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
            textFitter.verticalFit   = ContentSizeFitter.FitMode.PreferredSize;

            textText.font      = uGUI.main.intro.mainText.text.font;
            textText.fontSize  = 16;
            textText.fontStyle = uGUI.main.intro.mainText.text.fontStyle;
            textText.alignment = TextAnchor.MiddleLeft;
            textText.color     = uGUI.main.intro.mainText.text.color;
            textText.material  = uGUI.main.intro.mainText.text.material;

            if (showProgress)
            {
                progressObject = new GameObject("TwitchInteractionTimerCooldownIcon");
                progressIcon   = progressObject.AddComponent <uGUI_ItemIcon>();

                progressTexture = new Texture2D(TimerCooldown.ActualTimerTextHeight(), TimerCooldown.ActualTimerTextHeight());

                for (int x = 0; x < progressTexture.width; x++)
                {
                    for (int y = 0; y < progressTexture.height; y++)
                    {
                        float distanceFromCenter = (float)Math.Sqrt((x - progressTexture.width / 2) * (x - progressTexture.width / 2) + (y - progressTexture.height / 2) * (y - progressTexture.height / 2));

                        Color c = new Color(0, 0, 0, 0);

                        if (distanceFromCenter <= progressTexture.height)
                        {
                            c = Color.white;
                        }

                        progressTexture.SetPixel(x, y, c);
                    }
                }

                /*Atlas.Sprite progressSprite = new Atlas.Sprite(progressTexture);
                 * progressIcon.SetForegroundSprite(progressSprite);
                 * progressIcon.SetForegroundAlpha(1);
                 * progressIcon.SetForegroundColors(Color.white, Color.white, Color.white);
                 * progressIcon.SetForegroundAlpha(1, 1, 1);
                 * progressIcon.SetForegroundChroma(1f);
                 * progressIcon.SetBackgroundAlpha(0);
                 * progressIcon.SetBackgroundColors(new Color(0, 0, 0, 0), new Color(0, 0, 0, 0), new Color(0, 0, 0, 0));
                 * progressIcon.SetForegroundAlpha(0);
                 * progressIcon.SetForegroundColors(new Color(0, 0, 0, 0), new Color(0, 0, 0, 0), new Color(0, 0, 0, 0));
                 * progressIcon.SetAlpha(0, 0, 0);
                 * progressIcon.foreground.canvasRenderer.SetColor(Color.white);
                 * progressIcon.foreground.color = Color.white;*/
            }

            // Do this so it also shows over black screens
            Graphic g = uGUI.main.overlays.overlays[0].graphic;

            textObject.transform.SetParent(g.transform, false);
            textText.canvas.overrideSorting = true;
            textObject.layer = 1;

            if (showProgress)
            {
                progressObject.transform.SetParent(g.transform, false);
                progressIcon.canvas.overrideSorting = true;
                progressObject.layer = 1;
                progressIcon.SetActive(true);
            }


            SetText(text);

            Update();
        }
Exemplo n.º 3
0
 public static void Initialize()
 {
     versionText          = AddTextToLoadingScreen("LoadingScreenVersionText", $"\nNitrox {NitroxEnvironment.ReleasePhase} V{NitroxEnvironment.Version}");
     loadingScreenWarning = AddTextToLoadingScreen("LoadingScreenWarnText", $"\n\n{Language.main.Get("Nitrox_LoadingScreenWarn")}");
 }
Exemplo n.º 4
0
 public static void Initialize()
 {
     AddTextToLoadingScreen("\nNitrox Alpha V" + assemblyVersion);
     loadingScreenWarning = AddTextToLoadingScreen("\n\n" + Language.main.Get("Nitrox_LoadingScreenWarn"));
 }
 public static void Initialize()
 {
     AddTextToLoadingScreen($"\nNitrox Alpha V{assemblyVersion}");
     loadingScreenWarning = AddTextToLoadingScreen($"\n\n{Language.main.Get("Nitrox_LoadingScreenWarn")}");
 }
Exemplo n.º 6
0
 public static void Initialize()
 {
     AddTextToLoadingScreen("\nNitrox Alpha V" + assemblyVersion);
     loadingScreenWarning = AddTextToLoadingScreen("\n\nExpect game breaking bugs");
 }