public void ShowAlert(string text)
        {
            if (this.displayedAlert != null)
            {
                this.displayedAlert.SetActive(false);
            }
            var canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, 100);
            var tp     = CanvasUtil.CreateTextPanel(
                canvas,
                text,
                20,
                TextAnchor.LowerRight,
                new CanvasUtil.RectData(
                    new Vector2(1920, 80),
                    new Vector2(-40, 40),
                    new Vector2(1, 0),
                    new Vector2(1, 0),
                    new Vector2(1, 0)
                    )
                );

            GameObject.DontDestroyOnLoad(canvas);
            var cg = tp.AddComponent <CanvasGroup>();

            this.displayedAlert = tp;
            this.StartCoroutine(this.AnimateAlert(cg, canvas));
        }
        public void CreateCanvas()
        {
            if (_canvas != null)
            {
                return;
            }

            CanvasUtil.CreateFonts();
            _canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            UnityEngine.Object.DontDestroyOnLoad(_canvas);

            GameObject canvas = CanvasUtil.CreateTextPanel
                                (
                _canvas,
                "",
                24,
                TextAnchor.LowerRight,
                new CanvasUtil.RectData
                (
                    new Vector2(0, 50),
                    new Vector2(0, 45),
                    new Vector2(0, 0),
                    new Vector2(1, 0),
                    new Vector2(0.5f, 0.5f)
                )
                                );

            _textObj          = canvas.GetComponent <Text>();
            _textObj.font     = CanvasUtil.TrajanBold;
            _textObj.text     = "";
            _textObj.fontSize = 24;
        }
Exemple #3
0
        private void Start()
        {
            if (canvas != null)
            {
                return;
            }

            canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            GameObject go =
                CanvasUtil.CreateTextPanel(canvas, "", 70, TextAnchor.UpperRight,
                                           new CanvasUtil.RectData(
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(0.95f, 0.95f),
                                               new Vector2(0.5f, 0.5f)));


            textObj          = go.GetComponent <Text>();
            textObj.color    = Color.black;
            textObj.font     = CanvasUtil.TrajanBold;
            textObj.text     = "Lightbringer\nT-" + getTimeInCleanFormat(timeRemaining);
            textObj.fontSize = 90;
            textObj.CrossFadeAlpha(1f, 0f, false);
        }
Exemple #4
0
        private IEnumerator displayEnemyLevel(int level, Color c)
        {
            yield return(new WaitForSeconds(2f));

            CanvasUtil.CreateFonts();
            GameObject canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            GameObject go     =
                CanvasUtil.CreateTextPanel(canvas, "", 130, TextAnchor.UpperCenter,
                                           new CanvasUtil.RectData(
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(1.0f, 0.7f),
                                               new Vector2(0.5f, 0.5f)));


            Text textObj = go.GetComponent <Text>();

            textObj.color    = c;
            textObj.font     = CanvasUtil.TrajanBold;
            textObj.text     = "";
            textObj.fontSize = 170;
            textObj.text     = "Level " + level;
            textObj.CrossFadeAlpha(1f, 1f, false);

            yield return(new WaitForSeconds(3f));

            textObj.CrossFadeAlpha(0f, 3f, false);

            yield return(new WaitForSeconds(3.5f));

            Destroy(go);
            Destroy(canvas);
        }
Exemple #5
0
        private void Start()
        {
            timeRemaining = (float)infinite_globals.secondsToRun;

            if (canvas != null)
            {
                return;
            }

            CanvasUtil.CreateFonts();
            canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            GameObject go =
                CanvasUtil.CreateTextPanel(canvas, "", 27, TextAnchor.MiddleCenter,
                                           new CanvasUtil.RectData(
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(1.9f, 1.9f),
                                               new Vector2(0.5f, 0.5f)));


            textObj          = go.GetComponent <Text>();
            textObj.color    = Color.white;
            textObj.font     = CanvasUtil.TrajanBold;
            textObj.text     = getTimeInCleanFormat((float)infinite_globals.secondsToRun);
            textObj.fontSize = 50;
            textObj.CrossFadeAlpha(1f, 0f, false);
        }
        private void MakeCanvas()
        {
            if (CanvasObject == null)
            {
                CanvasObject = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));
            }

            if (TextCanvas == null)
            {
                CanvasUtil.CreateFonts();
                TextCanvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));
                GameObject TextPanel = CanvasUtil.CreateTextPanel(TextCanvas, "", 35, TextAnchor.MiddleCenter,
                                                                  new CanvasUtil.RectData(
                                                                      new Vector2(0, 50),
                                                                      new Vector2(0, 45),
                                                                      new Vector2(0, 0),
                                                                      new Vector2(1, 0),
                                                                      new Vector2(0.5f, 0.5f)));
                TextObject          = TextPanel.GetComponent <Text>();
                TextObject.font     = CanvasUtil.TrajanBold;
                TextObject.text     = "";
                TextObject.fontSize = 50;
                TextObject.color    = Color.red;
            }
        }
Exemple #7
0
        public void Awake()
        {
            gameEnd     = false;
            stopped     = true;
            textToggle  = true;
            _remastered = DebugManager.remastered;
            lastCostume = null;

            var ar = AspectRatio.GetAspectRatio(Screen.width, Screen.height);

            if (ar.x == 16f && ar.y == 9f)
            {
                wideAspect = true;
            }
            Logger.LogDebug($"Wide Aspect: {wideAspect}");

            DontDestroyOnLoad(gameObject);
            if (OverlayCanvas == null)
            {
                CanvasUtil.CreateFonts();
                OverlayCanvas      = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
                OverlayCanvas.name = "IGTDisplay";
                DontDestroyOnLoad(OverlayCanvas);

                _background = CanvasUtil.CreateImagePanel(OverlayCanvas, new Color32(0x28, 0x28, 0x28, 0x00),
                                                          wideAspect ? topRightLegacy : topRightHD);
                _textPanel = CanvasUtil.CreateTMProPanel(_background, string.Empty, 24,
                                                         TextAnchor.UpperLeft,
                                                         new CanvasUtil.RectData(new Vector2(-5, -5), new Vector2(0, 0), new Vector2(0, 0), new Vector2(1, 1)));

                tmProObjRef           = _textPanel.GetComponent <TextMeshProUGUI>();
                tmProObjRef.alignment = TextAlignmentOptions.TopRight;
            }
        }
Exemple #8
0
        public IEnumerator ShowAlert(string text)
        {
            var canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, 100);
            var tp     = CanvasUtil.CreateTextPanel(
                canvas,
                text,
                20,
                TextAnchor.LowerRight,
                new CanvasUtil.RectData(
                    new Vector2(1920, 80),
                    new Vector2(-40, 40),
                    new Vector2(1, 0),
                    new Vector2(1, 0),
                    new Vector2(1, 0)
                    )
                );

            GameObject.DontDestroyOnLoad(canvas);
            var cg = tp.AddComponent <CanvasGroup>();

            yield return(CanvasUtil.FadeInCanvasGroup(cg));

            yield return(new WaitForSeconds(3f));

            yield return(CanvasUtil.FadeOutCanvasGroup(cg));

            GameObject.DestroyImmediate(canvas);
        }
        private void makeModCanvas(int ad)
        {
            if (canvas != null)
            {
                return;
            }

            CanvasUtil.CreateFonts();
            canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            GameObject go =
                CanvasUtil.CreateTextPanel(canvas, "", 27, TextAnchor.UpperCenter,
                                           new CanvasUtil.RectData(
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               new Vector2(0, 0),
                                               generateNonAnnoyingLocation(),
                                               new Vector2(0.5f, 0.5f)));


            textObj          = go.GetComponent <Text>();
            textObj.color    = ads[ad].textColor;
            textObj.font     = CanvasUtil.TrajanBold;
            textObj.text     = "";
            textObj.fontSize = 50;
            textObj.text     = ads[ad].textDescription;
            textObj.CrossFadeAlpha(1f, 0f, false);
        }
Exemple #10
0
        public void EnableRedwing()
        {
            _isEnabled = true;
            textures.loadAllTextures();
            ModHooks.Instance.FocusCostHook       += InstanceOnFocusCostHook;
            ModHooks.Instance.BeforeAddHealthHook += InstanceOnBeforeAddHealthHook;
            ModHooks.Instance.AttackHook          += InstanceOnAttackHook;
            ModHooks.Instance.CharmUpdateHook     += RedwingLance;
            ModHooks.Instance.DashPressedHook     += NoDashWhileHoldingUp;
            On.HeroController.JumpReleased        += NoVelocityResetOnReleaseWithJetpack;
            On.NailSlash.StartSlash             += NailSlashOnStartSlash;
            ModCommon.ModCommon.OnSpellHook     += OverwriteSpells;
            On.HeroController.CancelHeroJump    += DontCancelWithJetpack;
            On.HeroController.AffectedByGravity += AffectedByGravityIsShit;
            On.HeroController.Jump += RocketJumpIfRocketJumping;

            canvasObj = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));
            FireBar   = CanvasUtil.CreateImagePanel(canvasObj,
                                                    Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 1, 1), new Vector2(0.5f, 0.5f)),
                                                    new CanvasUtil.RectData(new Vector2(300f, 100f), new Vector2(0.9f, 0.9f),
                                                                            new Vector2(0.910f, 0.89f), new Vector2(0.910f, 0.89f)));
            DontDestroyOnLoad(canvasObj);
            DontDestroyOnLoad(FireBar);

            FireBarImage = FireBar.GetComponent <Image>();

            FireBarImage.preserveAspect = false;
            FireBarImage.type           = Image.Type.Filled;
            FireBarImage.fillMethod     = Image.FillMethod.Horizontal;
            FireBarImage.fillAmount     = (float)firePower;
            StartCoroutine(AddHeroHooks());
        }
Exemple #11
0
 private void setupScoreCanvas()
 {
     menuCanvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));
     CanvasUtil.CreateTextPanel(menuCanvas,
                                parseScoreResults(), 12,
                                TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(400f, 150f),
                                                                               new Vector2(0.5f, 0.5f), new Vector2(0.98f, 0.05f), new Vector2(0.98f, 0.05f)));
 }
Exemple #12
0
 public override void Initialize()
 {
     instance  = this;
     bossCount = 0;
     ModHooks.Instance.SetPlayerBoolHook += CountBosses;
     canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
     GameObject.DontDestroyOnLoad(canvas);
     UpdateUI();
 }
        public static void SetupCanvas()
        {
            _canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceCamera, new Vector2(1920, 1080));
            UnityEngine.Object.DontDestroyOnLoad(_canvas);

            GameObject go = new GameObject();

            _coroutineStarter = go.AddComponent <NonBouncer>();
            UnityEngine.Object.DontDestroyOnLoad(go);
        }
Exemple #14
0
        private void setupFlameGauge()
        {
            GameObject flameGaugeDisplay = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            GameObject flameGauge        = CanvasUtil.CreateImagePanel(flameGaugeDisplay,
                                                                       Sprite.Create(load_textures.SOUL_HOLDER[0],
                                                                                     new Rect(0, 0, load_textures.SOUL_HOLDER[0].width, load_textures.SOUL_HOLDER[0].height),
                                                                                     new Vector2(0.5f, 0.5f)), new CanvasUtil.RectData(
                                                                           new Vector2(0, 0),
                                                                           new Vector2(0, 0),
                                                                           new Vector2(0, 0),
                                                                           new Vector2(0.05f, 0.05f)));

            flameGaugeControl = flameGauge.AddComponent <flame_gauge>();
            GameCameras.instance.hudCanvas.PrintSceneHierarchyTree("hud.txt");
        }
        public static GameObject Show(Sprite bigSprite, string takeKey, string nameKey, string buttonKey, string descOneKey, string descTwoKey, Action callback)
        {
            // Create base canvas
            GameObject canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));

            // Add popup component, set values
            BigItemPopup popup = canvas.AddComponent <BigItemPopup>();

            popup._imagePrompt = bigSprite;
            popup._takeText    = Language.Language.Get(takeKey, "Prompts").Replace("<br>", " ");
            popup._nameText    = Language.Language.Get(nameKey, "UI").Replace("<br>", " ");
            popup._buttonText  = Language.Language.Get(buttonKey, "Prompts").Replace("<br>", " ");
            popup._descOneText = Language.Language.Get(descOneKey, "Prompts").Replace("<br>", " ");
            popup._descTwoText = Language.Language.Get(descTwoKey, "Prompts").Replace("<br>", " ");
            popup._callback    = callback;

            return(canvas);
        }
Exemple #16
0
        public void Start()
        {
            CanvasUtil.CreateFonts();
            canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            UnityEngine.Object.DontDestroyOnLoad(canvas);
            caliber       = CanvasUtil.CreateTextPanel(canvas, "", 25, TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(600, 50), new Vector2(-560, 805), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), true).GetComponent <Text>();
            caliber.color = new Color(0.420f, 0.420f, 0.420f, 1f);
            caliber.text  = "";

            ammo       = CanvasUtil.CreateTextPanel(canvas, "", 25, TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(600, 50), new Vector2(-560, 775), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), true).GetComponent <Text>();
            ammo.color = new Color(0.420f, 0.420f, 0.420f, 1f);
            ammo.text  = "";

            magazine       = CanvasUtil.CreateTextPanel(canvas, "", 25, TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(600, 50), new Vector2(-560, 745), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), true).GetComponent <Text>();
            magazine.color = new Color(0.420f, 0.420f, 0.420f, 1f);
            magazine.text  = "";
            Modding.Logger.Log("[HOLLOW POINT] HPUI.cs sucessfully initialized!");
        }
Exemple #17
0
        private IEnumerator showFailureScreen()
        {
            yield return(new WaitForFinishedEnteringScene());

            yield return(new WaitForSeconds(0.4f));

            winLossCanvas  = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));
            winLossBlanker = CanvasUtil.CreateImagePanel(winLossCanvas,
                                                         Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 1, 1), new Vector2(0.5f, 0.5f)),
                                                         new CanvasUtil.RectData(new Vector2(4000f, 2000f), new Vector2(0.5f, 0.5f),
                                                                                 new Vector2(0f, 0f), new Vector2(1f, 1)));

            Image img = winLossBlanker.GetComponent <Image>();

            winLossText = CanvasUtil.CreateTextPanel(winLossCanvas, "", 42,
                                                     TextAnchor.MiddleCenter, new CanvasUtil.RectData(new Vector2(400f, 150f),
                                                                                                      new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.2f), new Vector2(0.5f, 0.2f)));
            Text t = winLossText.GetComponent <Text>();

            t.text = "Failed!\nBest combo: " + godmasterBestCombo + "\nTotal hits: " + godmasterTotalHits;
            Color c = img.color;

            c.g       = 0f;
            c.b       = 0f;
            c.r       = 0f;
            c.a       = 1f;
            img.color = c;
            yield return(new WaitForSeconds(3.5f));

            const float fadeTime = 4f;



            for (float time = 0f; time < fadeTime; time += Time.deltaTime)
            {
                c.a       = ((fadeTime - time) / fadeTime);
                img.color = c;
                yield return(null);
            }

            Destroy(winLossBlanker);
            Destroy(winLossText);
            Destroy(winLossCanvas);
        }
Exemple #18
0
        private IEnumerator showWinScreen()
        {
            yield return(new WaitForFinishedEnteringScene());

            yield return(new WaitForSeconds(0.4f));

            winLossCanvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));

            winLossText = CanvasUtil.CreateTextPanel(winLossCanvas, "", 42,
                                                     TextAnchor.MiddleCenter, new CanvasUtil.RectData(new Vector2(400f, 150f),
                                                                                                      new Vector2(0.5f, 0.5f), new Vector2(0.7f, 0.2f), new Vector2(0.7f, 0.2f)));
            Text t = winLossText.GetComponent <Text>();

            t.text = "";
            switch (globals.ALL_RESULTS[godmasterLevel].bestClear)
            {
            case globals.bestclear.FiveStar:
                t.text += "Outstanding!\n★★★★★";
                break;

            case globals.bestclear.None:
                t.text += "invalid";
                break;

            case globals.bestclear.ThreeStar:
                t.text += "Great!\n★★★";
                break;

            case globals.bestclear.FourStar:
                t.text += "Awesome!\n★★★★";
                break;

            case globals.bestclear.FullCombo:
                t.text += "Perfect!\n★★★★★ FC";
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            t.text += "\nBindings: " + globals.ALL_RESULTS[godmasterLevel].numBind +
                      "\nCombo: " + godmasterBestCombo + "\nTotal hits: " + godmasterTotalHits;
        }
        public static void Create()
        {
            if (canvas != null)
            {
                return;
            }
            // Create base canvas
            canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
            Object.DontDestroyOnLoad(canvas);

            CanvasUtil.CreateTextPanel(canvas, "Recent Items", 24, TextAnchor.MiddleCenter,
                                       new CanvasUtil.RectData(new Vector2(200, 100), Vector2.zero,
                                                               new Vector2(0.87f, 0.95f), new Vector2(0.87f, 0.95f)));

            if (invPanels <= 0)
            {
                Show();
            }
        }
        public static GameObject Show(_Item item, GameObject fsmObj = null, string eventName = null)
        {
            // Create base canvas
            GameObject canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));

            // Add popup component, set values
            BigItemPopup popup = canvas.AddComponent <BigItemPopup>();

            popup._imagePrompt = item.bigSprite;
            popup._takeText    = Language.Language.Get(item.takeKey, "Prompts").Replace("<br>", " ");
            popup._nameText    = Language.Language.Get(item.nameKey, "UI").Replace("<br>", " ");
            popup._buttonText  = Language.Language.Get(item.buttonKey, "Prompts").Replace("<br>", " ");
            popup._descOneText = Language.Language.Get(item.descOneKey, "Prompts").Replace("<br>", " ");
            popup._descTwoText = Language.Language.Get(item.descTwoKey, "Prompts").Replace("<br>", " ");
            popup._fsmObj      = fsmObj;
            popup._fsmEvent    = eventName;

            return(canvas);
        }
Exemple #21
0
        IEnumerator EndingTextFade()
        {
            canvas      = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));//1536f, 864f));
            title       = CanvasUtil.CreateTextPanel(canvas, "Pardoner Fennel by Bombservice", 40, TextAnchor.MiddleCenter, new CanvasUtil.RectData(new Vector2(1000, 1500), new Vector2(0f, 65f), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), false).GetComponent <Text>();
            title.color = new Color(1f, 1f, 1f, 0f);
            title.font  = CanvasUtil.TrajanBold;//CanvasUtil.GetFont("Perpetua");
            for (float i = 0f; i <= 1f; i += 0.05f)
            {
                title.color = new Color(1f, 1f, 1f, i);
                yield return(new WaitForSeconds(0.01f));
            }
            yield return(new WaitForSeconds(1.7f));

            for (float i = 1; i >= 0f; i -= 0.05f)
            {
                title.color = new Color(1f, 1f, 1f, i);
                yield return(new WaitForSeconds(0.01f));
            }
            title.text = "";
        }
        public void Awake()
        {
            DontDestroyOnLoad(gameObject);
            if (OverlayCanvas == null)
            {
                CanvasUtil.CreateFonts();
                OverlayCanvas      = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
                OverlayCanvas.name = "DebugMenu";
                DontDestroyOnLoad(OverlayCanvas);

                GameObject _background = CanvasUtil.CreateImagePanel(OverlayCanvas, new Color32(0x28, 0x28, 0x28, 0x00), topRight);
                _textPanel = CanvasUtil.CreateTMProPanel(_background, string.Empty, 20,
                                                         TextAnchor.UpperLeft,
                                                         new CanvasUtil.RectData(new Vector2(-5, -5), new Vector2(0, 0), new Vector2(0, 0), new Vector2(1, 1)));
                textComp = _textPanel.GetComponent <TextMeshProUGUI>();
            }

            foreach (string fn in Assembly.GetExecutingAssembly().GetManifestResourceNames())
            {
                if (fn.Contains("glass") || fn.Contains("talkVol"))
                {
                    using (Stream imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(fn))
                    {
                        byte[] imageBuffer = new byte[imageStream.Length];
                        imageStream.Read(imageBuffer, 0, imageBuffer.Length);
                        imageStream.Flush();
                        var assetName = fn.Contains("glass") ? "glass" : "talkVol";
                        modTextures[assetName] = new Texture2D(1, 1);
                        modTextures[assetName].LoadImage(imageBuffer);
                        Logger.Log($"Loaded Texture: {assetName}");
                    }
                }
            }
            warpCam      = gameObject.AddComponent <Camera>();
            warpCam.rect = new Rect(0.75f, 0f, .25f, .25f);
            warpCam.transform.position = Vector3.zero;
            warpCam.enabled            = false;
        }
Exemple #23
0
        private static IEnumerator DrawCenterLines()
        {
            ScreenshotMachine.Log("Drawing middle intersection lines...");

            GameObject lineCanvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceCamera, new Vector2(1920, 1080));


            GameObject lines = CanvasUtil.CreateImagePanel(lineCanvas, LineSprite,
                                                           new CanvasUtil.RectData(Vector2.zero, Vector2.zero, Vector2.zero, Vector2.one));

            lines.gameObject.AddComponent <CanvasGroup>();
            CanvasGroup group = lines.gameObject.GetComponent <CanvasGroup>();

            group.interactable   = false;
            group.blocksRaycasts = false;



            yield return(new WaitUntil(() => !_lineDrawn));

            ScreenshotMachine.Log("Destroying middle intersection lines...");
            Object.Destroy(lines);
        }
Exemple #24
0
        private void InitializeUI()
        {
            if (_trainingCanvas?.gameObject == null)
            {
                _trainingCanvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, 1);
                //hold it under our wings to survive scene loads
                _trainingCanvas.transform.SetParent(gameObject.transform);
                _trainingCanvas.name = "TrainingCanvas";
            }

            Modding.Logger.Log(string.Format("Canvas active: {0}", _trainingCanvas.gameObject.activeInHierarchy));

            _trainingCanvas.SetActive(true);
            Destroy(_trainingCanvas.GetComponent <GraphicRaycaster>());

            if (_titleLabel?.gameObject == null)
            {
                _titleLabel = CanvasUtil.CreateTextPanel(_trainingCanvas.gameObject, "TrainingMode - Runtime", 12, TextAnchor.UpperRight,
                                                         new CanvasUtil.RectData(new Vector2(200, 100), new Vector2(100, 100)))
                              .GetComponentInChildren <Text>();
            }

            _titleLabel.gameObject.SetActive(true);
        }
        public static void Show()
        {
            // Create base canvas
            GameObject canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));

            // Add shop component, set values
            Shop shop = canvas.AddComponent <Shop>();

            shop.items = new[]
            {
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_1",
                    NameConvo              = "CHARM_NAME_1",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_1",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_1",
                    Cost       = 420,
                    SpriteName = "Charms.1.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_2",
                    NameConvo              = "CHARM_NAME_2",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_2",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_2",
                    Cost       = 420,
                    SpriteName = "Charms.2.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_3",
                    NameConvo              = "CHARM_NAME_3",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_3",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_3",
                    Cost       = 420,
                    SpriteName = "Charms.3.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_4",
                    NameConvo              = "CHARM_NAME_4",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_4",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_4",
                    Cost       = 420,
                    SpriteName = "Charms.4.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_5",
                    NameConvo              = "CHARM_NAME_5",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_5",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_5",
                    Cost       = 420,
                    SpriteName = "Charms.5.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_6",
                    NameConvo              = "CHARM_NAME_6",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_6",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_6",
                    Cost       = 420,
                    SpriteName = "Charms.6.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_7",
                    NameConvo              = "CHARM_NAME_7",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_7",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_7",
                    Cost       = 420,
                    SpriteName = "Charms.7.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_8",
                    NameConvo              = "CHARM_NAME_8",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_8",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_8",
                    Cost       = 420,
                    SpriteName = "Charms.8.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_9",
                    NameConvo              = "CHARM_NAME_9",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_9",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_9",
                    Cost       = 420,
                    SpriteName = "Charms.9.png"
                },
                new ShopItemDef
                {
                    PlayerDataBoolName     = "gotCharm_10",
                    NameConvo              = "CHARM_NAME_10",
                    DescConvo              = "RANDOMIZER_CHARM_DESC_10",
                    RequiredPlayerDataBool = string.Empty,
                    RemovalPlayerDataBool  = string.Empty,
                    DungDiscount           = false,
                    NotchCostBool          = "charmCost_10",
                    Cost       = 420,
                    SpriteName = "Charms.10.png"
                }
            };
            shop.type = ShopType.Geo;
        }
Exemple #26
0
        private IEnumerator loadComboBars()
        {
            yield return(new WaitForFinishedEnteringScene());

            if (comboBar != null)
            {
                yield break;
            }

            canvasObj = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920f, 1080f));
            comboBar  = CanvasUtil.CreateImagePanel(canvasObj,
                                                    Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 1, 1), new Vector2(0.5f, 0.5f)),
                                                    new CanvasUtil.RectData(new Vector2(300f, 100f), new Vector2(0.9f, 0.9f),
                                                                            new Vector2(0.917f, 0.89f), new Vector2(0.917f, 0.89f)));

            blueComboBar = CanvasUtil.CreateImagePanel(canvasObj,
                                                       Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 1, 1), new Vector2(0.5f, 0.5f)),
                                                       new CanvasUtil.RectData(new Vector2(301f, 20f), new Vector2(0.5f, 0.5f),
                                                                               new Vector2(0.917f, 0.85f), new Vector2(0.917f, 0.85f)));

            comboBarPicture = comboBar.GetComponent <Image>();

            comboBarPicture.preserveAspect = false;
            comboBarPicture.type           = Image.Type.Filled;
            comboBarPicture.fillMethod     = Image.FillMethod.Horizontal;
            comboBarPicture.fillAmount     = (float)comboMeter;

            blueComboPicture = blueComboBar.GetComponent <Image>();

            blueComboPicture.preserveAspect = false;
            blueComboPicture.type           = Image.Type.Filled;
            blueComboPicture.fillMethod     = Image.FillMethod.Horizontal;
            blueComboPicture.color          = Color.blue;


            radiantText = CanvasUtil.CreateTextPanel(canvasObj, "", 42,
                                                     TextAnchor.UpperRight, new CanvasUtil.RectData(new Vector2(400f, 150f),
                                                                                                    new Vector2(0.5f, 0.5f), new Vector2(0.89f, 0.92f), new Vector2(0.89f, 0.92f)));
            radiantTextBox = radiantText.GetComponent <Text>();

            hitText = CanvasUtil.CreateTextPanel(canvasObj, "", 42,
                                                 TextAnchor.LowerRight, new CanvasUtil.RectData(new Vector2(400f, 150f),
                                                                                                new Vector2(0.5f, 0.5f), new Vector2(0.89f, 0.854f), new Vector2(0.89f, 0.854f)));
            totalHitNumber = hitText.GetComponent <Text>();

            if (knightRadiantEffect == null)
            {
                knightRadiantEffect = new GameObject("knightRadiantParticles",
                                                     typeof(ParticleSystem));
                radKnightSystem   = knightRadiantEffect.GetComponent <ParticleSystem>();
                radKnightRenderer = knightRadiantEffect.GetComponent <ParticleSystemRenderer>();

                ParticleSystem.MainModule partMain = radKnightSystem.main;
                partMain.loop = true;
                radKnightSystem.useAutoRandomSeed = true;
                partMain.gravityModifier          = 0f;
                //partMain.startColor = new
                //    ParticleSystem.MinMaxGradient(new Color(1f, 0f, 0f), new Color(1f, 1f, 0.3f));
                //partMain.startColor = new
                //    ParticleSystem.MinMaxGradient(new Color(1f, 1f, 0.3f));
                partMain.startSize     = new ParticleSystem.MinMaxCurve(0.25f);
                partMain.startLifetime = new ParticleSystem.MinMaxCurve(0.3f);
                partMain.maxParticles  = 300;
                partMain.startSpeed    = new ParticleSystem.MinMaxCurve(3f, 15f);


                ParticleSystem.EmissionModule partEmission = radKnightSystem.emission;
                partEmission.enabled      = true;
                partEmission.rateOverTime = new ParticleSystem.MinMaxCurve(50f);

                ParticleSystem.SizeOverLifetimeModule soe = radKnightSystem.sizeOverLifetime;
                AnimationCurve curve = new AnimationCurve();
                curve.AddKey(0.0f, 1f);
                curve.AddKey(1f, 0f);
                soe.size = new ParticleSystem.MinMaxCurve(1f, curve);

                soe.enabled = true;

                radKnightRenderer.material.shader      = Shader.Find("Particles/Additive");
                radKnightRenderer.material.mainTexture = perfectWhiteCircle;
                radKnightRenderer.renderMode           = ParticleSystemRenderMode.Billboard;


                if (voidKnight != null)
                {
                    knightRadiantEffect.transform.parent        = voidKnight.transform;
                    knightRadiantEffect.transform.localPosition = Vector3.zero;
                }
            }
            //canvasObj.SetActive(true);
            //comboBar.SetActive(true);
            //blueComboBar.SetActive(true);

            updateComboBars();
        }
Exemple #27
0
        public IEnumerator UI_Initializer()
        {
            while (HeroController.instance == null || PlayerData.instance == null)
            {
                yield return(null);
            }


            try
            {
                CanvasUtil.CreateFonts();

                canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));

                canvasGroup = canvas.GetComponent <CanvasGroup>();
                canvas.GetComponent <Canvas>().sortingOrder = 1;

                grenadeAmountText       = CanvasUtil.CreateTextPanel(canvas, "", 21, TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(600, 50), new Vector2(-200, 898), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), true).GetComponent <Text>();
                grenadeAmountText.color = new Color(1f, 1f, 1f, 0f);
                grenadeAmountText.text  = "";

                firesupportAmountText       = CanvasUtil.CreateTextPanel(canvas, "", 21, TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(600, 50), new Vector2(-200, 877), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), true).GetComponent <Text>();
                firesupportAmountText.color = new Color(1f, 1f, 1f, 0f);
                firesupportAmountText.text  = "";

                /*
                 * LoadAssets.spriteDictionary.TryGetValue("heatbarsprite.png", out Texture2D bar);
                 *
                 * Sprite spriteMain = Sprite.Create(bar, new Rect(0, 0, bar.width, bar.height),
                 * new Vector2(0.5f, 0.5f), 25);
                 *
                 * LoadAssets.spriteDictionary.TryGetValue("heatbarspriteestimate.png", out Texture2D barEstimate);
                 *
                 * Sprite spriteEstimate = Sprite.Create(barEstimate, new Rect(0, 0, bar.width, bar.height),
                 * new Vector2(0.5f, 0.5f), 25);
                 *
                 * LoadAssets.spriteDictionary.TryGetValue("heatbarborder.png", out Texture2D barBorder);
                 *
                 * Sprite spriteBorder = Sprite.Create(barBorder, new Rect(0, 0, barBorder.width, barBorder.height),
                 * new Vector2(0.5f, 0.5f), 25);
                 */
                //HEAT BAR

                /*
                 * CanvasUtil.RectData rectDataBorder = new CanvasUtil.RectData(new Vector2(275, 30), new Vector2(0, 0), new Vector2(0.12f, 0.70f), new Vector2(0.12f, 0.70f), new Vector2(0.50f, 0.50f));
                 * heatbar_go_border = CanvasUtil.CreateImagePanel(canvas, spriteBorder, rectDataBorder);
                 *
                 * CanvasUtil.RectData rectData = new CanvasUtil.RectData(new Vector2(175, 25), new Vector2(0, 0), new Vector2(0.12f, 0.70f), new Vector2(0.12f, 0.70f), new Vector2(0.50f, 0.50f));
                 *
                 * heatbar_go = CanvasUtil.CreateImagePanel(canvas, spriteMain, rectData);
                 * heatbar_go.transform.position = new Vector3(heatbar_go.transform.position.x, heatbar_go.transform.position.y, 0);
                 * heatbar_go_estimate = CanvasUtil.CreateImagePanel(canvas, spriteEstimate, rectData);
                 * heatbar_go_estimate.transform.position = new Vector3(heatbar_go.transform.position.x, heatbar_go.transform.position.y, 1);
                 *
                 * heatbarImage = heatbar_go.GetComponent<Image>();
                 * heatbarImage.type = Image.Type.Filled;
                 * heatbarImage.fillMethod = Image.FillMethod.Horizontal;
                 * heatbarImage.preserveAspect = false;
                 *
                 * heatbarImageEstimate = heatbar_go_estimate.GetComponent<Image>();
                 * heatbarImageEstimate.type = Image.Type.Filled;
                 * heatbarImageEstimate.fillMethod = Image.FillMethod.Horizontal;
                 * heatbarImageEstimate.preserveAspect = false;
                 */


                //ENERGY BAR

                /*
                 * LoadAssets.spriteDictionary.TryGetValue("heatbarsprite.png", out Texture2D energybar);
                 *
                 * spriteMain = Sprite.Create(energybar, new Rect(0, 0, bar.width, bar.height),
                 * new Vector2(0.5f, 0.5f), 25);
                 *
                 * rectDataBorder = new CanvasUtil.RectData(new Vector2(275, 30), new Vector2(0, 0), new Vector2(0.12f, 0.67f), new Vector2(0.12f, 0.67f), new Vector2(0.50f, 0.50f));
                 * energybar_go_border = CanvasUtil.CreateImagePanel(canvas, spriteBorder, rectDataBorder);
                 *
                 * rectData = new CanvasUtil.RectData(new Vector2(175, 25), new Vector2(0, 0), new Vector2(0.12f, 0.67f), new Vector2(0.12f, 0.67f), new Vector2(0.50f, 0.50f));
                 *
                 * energybar_go = CanvasUtil.CreateImagePanel(canvas, spriteMain, rectData);
                 * energybar_go.transform.position = new Vector3(energybar_go.transform.position.x, energybar_go.transform.position.y, 0);
                 *
                 * energybarImage = energybar_go.GetComponent<Image>();
                 * energybarImage.type = Image.Type.Filled;
                 * energybarImage.fillMethod = Image.FillMethod.Horizontal;
                 * energybarImage.preserveAspect = false;
                 */

                //HP_DamageNumber.damageNumberGO = new GameObject("damageNumberClone", typeof(HP_DamageNumber), typeof(TextMesh), typeof(MeshRenderer));
                DontDestroyOnLoad(canvas);
                DontDestroyOnLoad(canvasGroup);
            }
            catch (Exception e)
            {
                Modding.Logger.Log(e.StackTrace);
            }
        }
Exemple #28
0
        private void Start()
        {
            if (!DoH.Instance.IsInHall)
            {
                return;
            }
            CanvasUtil.CreateFonts();
            canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1536f, 864f));
            UnityEngine.Object.DontDestroyOnLoad(canvas);
            textExample       = CanvasUtil.CreateTextPanel(canvas, "", 35, TextAnchor.MiddleCenter, new CanvasUtil.RectData(new Vector2(700, 100), new Vector2(-0, 50), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0.5f)), true).GetComponent <Text>();
            textExample.color = new Color(1f, 1f, 1f, 1f);
            textExample.font  = CanvasUtil.GetFont("Perpetua");
            timeLeft          = 2f;

            // No stunning
            Destroy(_stunControl);

            // 1500hp
            _hm.hp = 1800;

            // Disable Knockback
            _recoil.enabled = false;

            // Speed up some attacks.
            try
            {
                foreach (KeyValuePair <string, float> i in _fpsDict)
                {
                    _anim.GetClipByName(i.Key).fps = i.Value;
                }

                Log("attempt at music was made");
                //_sceneFSM.ChangeTransition("Statue Level", "1", "Boss Statue Alt");
                Log("attempt at music was made2");
                //_sceneFSM.RemoveAction("Boss Statue Alt", 0);
            }
            catch (System.Exception e)
            {
                Log(e);
            }

            // Stop pointless standing in place
            _control.GetAction <WaitRandom>("Idle", 9).timeMax = 0f;
            _control.GetAction <WaitRandom>("Idle", 9).timeMin = 0f;

            // Stop pointless running
            _control.GetAction <WaitRandom>("Run", 6).timeMax = 0f;
            _control.GetAction <WaitRandom>("Run", 6).timeMin = 0f;

            //Make Hornet hold her sphere for 5 seconds
            go1 = _control.GetAction <ActivateGameObject>("Sphere Recover A", 1).gameObject.GameObject.Value;
            go2 = _control.GetAction <ActivateGameObject>("Sphere Recover", 1).gameObject.GameObject.Value;
            IEnumerator ActivateSphereA()
            {
                _control.ChangeTransition("In Air", "AIRDASH", "Land");
                if (firstPhase)
                {
                    Log("Hornet: Activate Air turbo sphere mode, DIE little Ghost.");
                    go1.SetActive(true);
                    _control.ChangeTransition("Move Choice A", "AIRDASH", "GDash Antic");
                    _control.ChangeTransition("Move Choice B", "AIRDASH", "CA Antic");
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "GDash Antic");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "CA Antic");
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");
                    yield return(new WaitForSeconds(3f));

                    go1.SetActive(false);
                    _control.ChangeTransition("Move Choice A", "AIRDASH", "Set ADash");
                    _control.ChangeTransition("Move Choice B", "AIRDASH", "Set ADash");
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "Set Sphere A");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "Set Sphere A");
                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");
                }
                else if (secondPhase)
                {
                    //This might cause problems in the future
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "Set ADash");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "Set ADash");
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");
                    go1.SetActive(false);
                    yield return(new WaitForSeconds(1f));

                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "Set Sphere A");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "Set Sphere A");
                }
                else if (finalPhase)
                {
                    //This might cause problems in the future
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "Set ADash");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "Set ADash");
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");
                    _control.GetAction <WaitRandom>("Idle", 7).timeMax = 1.2f;
                    _control.GetAction <WaitRandom>("Idle", 7).timeMin = 1.2f;
                    go1.SetActive(false);
                    yield return(new WaitForSeconds(1.2f));

                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "Set Sphere A");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "Set Sphere A");
                    _control.GetAction <WaitRandom>("Idle", 7).timeMax = 0.2f;
                    _control.GetAction <WaitRandom>("Idle", 7).timeMin = 0.2f;
                }
                _control.ChangeTransition("In Air", "AIRDASH", "ADash Antic");
                yield return(new WaitForSeconds(1f));

                canSphere = false;
            }

            IEnumerator ActivateSphereG()
            {
                if (firstPhase)
                {
                    Log("Hornet: Activate Ground turbo sphere mode, DIE little Ghost.");
                    go2.SetActive(true);
                    _control.ChangeTransition("G Sphere?", "SPHERE G", "Move Choice B");
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");

                    _control.ChangeTransition("Move Choice A", "AIRDASH", "GDash Antic");
                    _control.ChangeTransition("Move Choice B", "AIRDASH", "CA Antic");
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "GDash Antic");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "CA Antic");
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");
                    yield return(new WaitForSeconds(3f));

                    go2.SetActive(false);
                    _control.ChangeTransition("G Sphere?", "SPHERE G", "Sphere Antic G");
                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");

                    _control.ChangeTransition("Move Choice A", "AIRDASH", "Set ADash");
                    _control.ChangeTransition("Move Choice B", "AIRDASH", "Set ADash");
                    _control.ChangeTransition("Move Choice A", "SPHERE A", "Set Sphere A");
                    _control.ChangeTransition("Move Choice B", "SPHERE A", "Set Sphere A");
                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");
                }
                else if (secondPhase)
                {
                    //This might cause problems in the future
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");
                    _control.ChangeTransition("G Sphere?", "SPHERE G", "Move Choice B");
                    go2.SetActive(false);
                    yield return(new WaitForSeconds(1f));

                    _control.ChangeTransition("G Sphere?", "SPHERE G", "Sphere Antic G");
                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");
                }
                else if (finalPhase)
                {
                    //This might cause problems in the future
                    _control.ChangeTransition("Move Choice A", "THROW", "GDash Antic");
                    _control.ChangeTransition("G Sphere?", "SPHERE G", "Move Choice B");
                    go2.SetActive(false);
                    _control.GetAction <WaitRandom>("Idle", 7).timeMax = 1.2f;
                    _control.GetAction <WaitRandom>("Idle", 7).timeMin = 1.2f;

                    yield return(new WaitForSeconds(1.2f));

                    _control.GetAction <WaitRandom>("Idle", 7).timeMax = 0.2f;
                    _control.GetAction <WaitRandom>("Idle", 7).timeMin = 0.2f;
                    _control.ChangeTransition("G Sphere?", "SPHERE G", "Sphere Antic G");
                    _control.ChangeTransition("Move Choice A", "THROW", "Throw Antic");
                }
            }

            _control.CopyState("Sphere Recover", "Sphere Recover Old");
            _control.CopyState("Sphere Recover A", "Sphere Recover A Old");
            _control.RemoveAction("Sphere Recover A", 1);
            _control.RemoveAction("Sphere Recover", 1);
            _control.InsertCoroutine("Sphere Recover A", 1, ActivateSphereA);
            _control.InsertCoroutine("Sphere Recover", 1, ActivateSphereG);

            //Make Hornet Dash after needle throw
            var removeNeedle = _control.GetAction <ActivateGameObject>("Throw Recover", 0);

            try
            {
                Log("is throw working?");
                _control.GetAction <SetVelocityAsAngle>("Throw", 7).speed = 30f;
            }
            catch (System.Exception e)
            {
                Log(e);
            }
            // _control.InsertAction("Throw Antic", removeNeedle, 0);
            removeNeedle.gameObject.GameObject.Value.LocateMyFSM("Control").ChangeTransition("Out", "FINISHED", "Notify");
            _control.CopyState("Jump", "Jump2");
            _control.CopyState("ADash Antic", "ADash Antic 2");
            _control.GetAction <GetAngleToTarget2D>("ADash Antic 2", 1).offsetY.Value += 3f;
            _control.ChangeTransition("Throw", "FINISHED", "Jump2");
            _control.ChangeTransition("Jump2", "FINISHED", "ADash Antic 2");

            //Make a better G Dash for attacking you while you heal
            var lookAtKnight = _control.GetAction <FaceObject>("GDash Antic", 2);

            _control.CopyState("G Dash", "G Dash 2");
            _control.InsertAction("G Dash 2", new FaceObject
            {
                objectA          = lookAtKnight.objectA,
                objectB          = lookAtKnight.objectB,
                spriteFacesRight = lookAtKnight.spriteFacesRight,
                playNewAnimation = lookAtKnight.playNewAnimation,
                newAnimationClip = lookAtKnight.newAnimationClip,
                resetFrame       = lookAtKnight.resetFrame,
                everyFrame       = lookAtKnight.everyFrame
            }, 0);
            _control.ChangeTransition("G Dash 2", "FINISHED", "CA Antic");

            Log("Remove Evade when hit because it's dumb and also makes it so when hit hornet has a higher chance of either attacking or jumping");
            _control.GetAction <SendRandomEvent>("Dmg Response", 0).weights[0] = 0f;
            _control.GetAction <SendRandomEvent>("Dmg Response", 0).weights[1] = 0f;
            _control.GetAction <SendRandomEvent>("Dmg Response", 0).weights[2] = 0.5f;
            _control.GetAction <SendRandomEvent>("Dmg Response", 0).weights[3] = 0.5f;
            _control.ChangeTransition("Dmg Response", "JUMP", "Jump Antic");
            _control.ChangeTransition("Dmg Response", "Counter", "CA Antic");
            _control.RemoveAction("Set Jump Only", 1);
            _control.RemoveAction("Set Jump Only", 0);


            Log("Skip waiting for player to hit her counter and never do the dumb evade move");
            _control.GetAction <Wait>("Counter Stance", 1).time = 0f;
            _control.ChangeTransition("Counter Stance", "FINISHED", "CA Antic");

            Log("Choose Counter over Evade");
            _control.GetAction <SendRandomEvent>("Ev Or Counter", 0).weights[0] = 0f;
            _control.GetAction <SendRandomEvent>("Ev Or Counter", 0).weights[1] = 1f;

            Log("Choose GDash over Evade");
            _control.ChangeTransition("Run", "EVADE", "GDash Antic");

            //Removing useless barbs
            _control.RemoveAction("Barb?", 0);
            _control.ChangeTransition("Barb?", "BARB", "Barb Throw");
            _control.ChangeTransition("Barb Throw", "FINISHED", "Can Throw?");
            _control.GetAction <Wait>("Barb Throw", 2).time = 0.4f;

            //Stops the dumb freeze effect when the counter occurs
            _control.RemoveAction("CA Antic", 1);

            _control.GetAction <Wait>("Sphere", 4).time   = 0.3f;
            _control.GetAction <Wait>("Sphere A", 4).time = 0.3f;

            for (int i = 0; i < needles.Length; i++)
            {
                needles[i] = Instantiate(_control.GetAction <SetPosition>("Throw", 4).gameObject.GameObject.Value);
                Destroy(needles[i].LocateMyFSM("Control"));
                needles[i].AddComponent <TinkEffect>();
                UnityEngine.Object.Destroy(needles[i].GetComponent <NonBouncer>());
                var tink = UnityEngine.Object.Instantiate(GameObject.Find("Needle Tink")).AddComponent <ModCommon.NeedleTink>();
                tink.SetParent(needles[i].transform);
                needles[i].transform.SetPosition2D(gameObject.transform.GetPositionX(), gameObject.transform.GetPositionY());
                needles[i].GetComponent <Rigidbody2D>().velocity = new Vector2(-15f, i * 5f);
                needles[i].SetActive(false);
            }

            _control.InsertCoroutine("Throw", 0, needleSpread);

            Log("fin.");
            try
            {
                var ball = _control.GetAction <ActivateGameObject>("Sphere A", 0).gameObject.GameObject.Value;
                Log("2");
                var ballfsm = ball.LocateMyFSM("Grow");
                Log("3");
                ballfsm.RemoveAction("Grow", 0);
            }
            catch (System.Exception e)
            {
                Log(e);
            }

            _control.InsertMethod("Fire", 0, AirDashCounter);
            //_control.InsertMethod("Land Y", 0, ResetADash);
            _control.InsertMethod("In Air", 0, InAirChecker); //Had to increase num by 1
            _control.ChangeTransition("Jump R", "FINISHED", "Land");
            _control.ChangeTransition("Jump L", "FINISHED", "Land");
        }
Exemple #29
0
        public void InitDisplay()
        {
            if (menu != null)
            {
                GameObject.DestroyImmediate(menu);
            }
            CanvasUtil.CreateFonts();
            menu           = CanvasUtil.CreateCanvas(UnityEngine.RenderMode.ScreenSpaceOverlay, 100);
            this.showTimer = new UIOption <ToggleOption>(
                CanvasUtil.CreateTextPanel(
                    menu, "Show Timer", 30, TextAnchor.MiddleLeft,
                    new CanvasUtil.RectData(new Vector2(300, 60), new Vector2(-150, 180), MIDDLE, MIDDLE)
                    ),
                CanvasUtil.CreateTextPanel(
                    menu, "", 30, TextAnchor.MiddleRight,
                    new CanvasUtil.RectData(new Vector2(300, 60), new Vector2(150, 180), MIDDLE, MIDDLE)
                    ),
                new Vector2(-330, 180),
                ToggleOption.values,
                (v) => this.timer.ShowDisplay(v.enabled),
                1
                );
            this.resetPb = new UIButton(
                CanvasUtil.CreateTextPanel(
                    menu, "Reset PB", 30, TextAnchor.MiddleCenter,
                    new CanvasUtil.RectData(new Vector2(360, 60), new Vector2(0, 120), MIDDLE, MIDDLE)
                    ),
                new Vector2(-210, 120),
                () => {
                if (this.tm != null)
                {
                    this.tm.ResetPB();
                    this.tm.ShowAlert("Reset PB");
                }
            }
                );

            this.triggerType = new UIOption <TriggerTypeOption>(
                CanvasUtil.CreateTextPanel(
                    menu, "Trigger Type", 30, TextAnchor.MiddleLeft,
                    new CanvasUtil.RectData(new Vector2(300, 60), new Vector2(-150, 0), MIDDLE, MIDDLE)
                    ),
                CanvasUtil.CreateTextPanel(
                    menu, "", 30, TextAnchor.MiddleRight,
                    new CanvasUtil.RectData(new Vector2(300, 60), new Vector2(150, 0), MIDDLE, MIDDLE)
                    ),
                new Vector2(-330, 0),
                TriggerTypeOption.values,
                (e) => this.tm.triggerPlaceType = e.variant
                );
            this.saveTriggers = new UIButton(
                CanvasUtil.CreateTextPanel(
                    menu, "Save Triggers", 30, TextAnchor.MiddleCenter,
                    new CanvasUtil.RectData(new Vector2(360, 60), new Vector2(0, -60), MIDDLE, MIDDLE)
                    ),
                new Vector2(-210, -60),
                () => {
                if (this.tm != null)
                {
                    this.tm.SaveTriggers();
                    this.tm.ShowAlert("Saved Triggers");
                }
            }
                );
            this.loadTriggers = new UIButton(
                CanvasUtil.CreateTextPanel(
                    menu, "Load Triggers", 30, TextAnchor.MiddleCenter,
                    new CanvasUtil.RectData(new Vector2(360, 60), new Vector2(0, -120), MIDDLE, MIDDLE)
                    ),
                new Vector2(-210, -120),
                () => {
                if (this.tm != null)
                {
                    this.tm.LoadTriggers();
                    this.tm.ShowAlert("Loaded Triggers");
                }
            }
                );

            this.reloadSettings = new UIButton(
                CanvasUtil.CreateTextPanel(
                    menu, "Reload Settings", 30, TextAnchor.MiddleCenter,
                    new CanvasUtil.RectData(new Vector2(360, 60), new Vector2(0, -240), MIDDLE, MIDDLE)
                    ),
                new Vector2(-210, -240),
                () => {
                if (this.hktimer != null)
                {
                    this.hktimer.ReloadSettings();
                    if (this.tm != null)
                    {
                        this.tm.ShowAlert("Reloaded Settings");
                    }
                }
            }
                );

            this.cursorDisplay = CanvasUtil.CreateTextPanel(
                menu, ">", 50, TextAnchor.MiddleCenter,
                new CanvasUtil.RectData(new Vector2(60, 60), new Vector2(0, 0), MIDDLE, MIDDLE)
                );

            this.elements = new UIElement[] {
                this.showTimer,
                this.resetPb,
                this.triggerType,
                this.saveTriggers,
                this.loadTriggers,
                this.reloadSettings
            };
            this.SetShown(false);
            this.uiOpen = false;
            GameObject.DontDestroyOnLoad(this.menu);
        }