コード例 #1
0
ファイル: BossRush.cs プロジェクト: iamwyza/hk-bossrush
        public void resetData()
        {
            UnityEngine.Random.seed = System.DateTime.Now.Millisecond;
            GameObject.Destroy(shinySlot1);
            GameObject.Destroy(shinySlot2);
            GameObject.Destroy(shinySlot3);
            currentTime   = 0;
            shiny         = null;
            flawless      = true;
            shinySlot1    = null;
            shinySlot2    = null;
            shinySlot3    = null;
            currentBoss   = 4;
            grimmLevel    = 0;
            oldGrimmLevel = 0;
            quakeLevel    = 0;

            for (int i = 0; i < bossFaces.Length; i++)
            {
                bossFaces[i].sprite = bossFace1[i];
            }

            BossInfo.killedHK    = false;
            BossInfo.currentBoss = 4;
            BossInfo.createBossInfo();
            ItemInfo.createItemInfo();
            BossInfo.assignItems();
        }
コード例 #2
0
ファイル: BossRush.cs プロジェクト: iamwyza/hk-bossrush
 public string PromptOverride(string key, string sheet)
 {
     if (key == "KDT_SUPER")
     {
         return("Thanks");
     }
     if (key == "KDT_MAIN")
     {
         return("for");
     }
     if (key == "KDT_SUB")
     {
         return("Playing!");
     }
     if (key == "INSPECT")
     {
         return("");
     }
     if (key == "item0")
     {
         return(BossInfo.itemName(0));
     }
     if (key == "item1")
     {
         return(BossInfo.itemName(1));
     }
     if (key == "item2")
     {
         return(BossInfo.itemName(2));
     }
     return(Language.Language.GetInternal(key, sheet));
 }
コード例 #3
0
ファイル: ItemHandler.cs プロジェクト: iamwyza/hk-bossrush
        public ItemHandler(string bossName)
        {
            itemData = new ItemData[3];
            BossInfo bossInfo = BossInfo.bossInfo[bossName];

            for (int i = 0; i < 3; i++)
            {
                ItemInfo item = ItemInfo.getRandomItem();
                itemData[i] = new ItemData(item.internalName, item.sheetName, item.varName, item.stepAmount, bossInfo.getItem(i), i, item.keyNames);
            }
        }
コード例 #4
0
        public void Update()
        {
            if (fsm.ActiveStateName == "In Range" || fsm.ActiveStateName == "Can Inspect?" || fsm.ActiveStateName == "Cancel Frame")
            {
                opacity += Time.deltaTime * 5;
            }
            else
            {
                opacity -= Time.deltaTime * 5;
            }
            opacity = Mathf.Clamp01(opacity);
            byte   trans    = ((byte)(opacity * 255));
            string hexAlpha = BitConverter.ToString(new byte[] { trans });

            tmp.text      = String.Format("<alpha=#{0}>{1}", hexAlpha, BossInfo.itemName(id));
            tmp.faceColor = new Color32(255, 255, 255, 255);
        }
コード例 #5
0
 public static bool isBossDead()
 {
     if (BossInfo.bossInfo[bossOrder[currentBoss]].VarName == "Battle Scene")
     {
         if (battleScene == null)
         {
             battleScene  = GameObject.Find("Battle Scene");
             bsComponents = battleScene.GetComponents <PlayMakerFSM>();
         }
         if (bsComponents != null)
         {
             foreach (PlayMakerFSM fsm in bsComponents)
             {
                 if (fsm.FsmVariables.GetFsmBool("Activated") != null)
                 {
                     return(fsm.FsmVariables.GetFsmBool("Activated").Value);
                 }
             }
         }
     }
     if (BossInfo.bossInfo[bossOrder[currentBoss]].VarName == "killedHollowKnight")
     {
         if (BossRush.gm.hero_ctrl.spellControl.FsmVariables.GetFsmBool("Dream Focus").Value == true)
         {
             killedHK = true;
             BossRush.gm.hero_ctrl.spellControl.FsmVariables.GetFsmBool("Dream Focus").Value = false;
             if (!BossRushUpdate.spawnedItems)
             {
                 if (BossInfo.SpawnAll())
                 {
                     BossRushUpdate.spawnedItems = true;
                 }
                 else
                 {
                     Modding.ModHooks.ModLog("Couldn't spawn HK items");
                 }
             }
         }
         return(killedHK);
     }
     return(PlayerData.instance.GetBoolInternal(BossInfo.bossInfo[bossOrder[currentBoss]].VarName));
 }
コード例 #6
0
ファイル: BossRushUpdate.cs プロジェクト: iamwyza/hk-bossrush
        public void Update()
        {
            if (!BossRush.selectingStage && spawnedItems)
            {
                BossRush.textSkip.text      = "Press to skip without picking up items";
                BossRush.rectSkip.sizeDelta = (BossRush.uib.GetButtonSkinFor(BossRush.ih.inputActions.quickMap).skinType == ButtonSkinType.SQUARE) ? new Vector2(58, 58) : new Vector2(98, 61);
                BossRush.imageSkip.sprite   = BossRush.uib.GetButtonSkinFor(BossRush.ih.inputActions.quickMap).sprite;
                BossRush.imageText.text     = BossRush.uib.GetButtonSkinFor(BossRush.ih.inputActions.quickMap).symbol;

                if (BossRush.ih.inputActions.quickMap.WasPressed)
                {
                    BossRush.pickups = 3;
                }

                BossRush.FadeInSkip(0.25f);
            }
            else
            {
                BossRush.FadeOutSkip(0.25f);
            }

            if (BossRush.selectingStage)
            {
                HeroController.instance.RelinquishControl();
                HeroController.instance.StopAnimationControl();
                HeroController.instance.cState.invulnerable = true;
                if (BossRush.gm.inputHandler.inputActions.up.WasPressed)
                {
                    BossRush.selectY -= 1;
                    BossRush.selectY  = BossRush.selectY < 0 ? 2 : BossRush.selectY;
                }
                if (BossRush.gm.inputHandler.inputActions.down.WasPressed)
                {
                    BossRush.selectY += 1;
                    BossRush.selectY  = BossRush.selectY > 2 ? 0 : BossRush.selectY;
                }
                if (BossRush.gm.inputHandler.inputActions.left.WasPressed)
                {
                    BossRush.selectX -= 1;
                    BossRush.selectX  = BossRush.selectX < 0 ? 2 : BossRush.selectX;
                }
                if (BossRush.gm.inputHandler.inputActions.right.WasPressed)
                {
                    BossRush.selectX += 1;
                    BossRush.selectX  = BossRush.selectX > 2 ? 0 : BossRush.selectX;
                }
                if (BossRush.gm.inputHandler.inputActions.menuSubmit.WasPressed)
                {
                    int  bossId = BossRush.selectX + (BossRush.selectY * 3);
                    int  j      = bossId + ((int)Mathf.Floor(BossInfo.defeatedBosses / 9) * 9);
                    bool skip   = false;
                    if (BossInfo.defeatedBosses >= 18 && BossInfo.defeatedBosses < 25 && (BossRush.selectX == 2 && BossRush.selectY == 2))
                    {
                        skip = true;
                    }
                    if (BossInfo.defeatedBosses >= 18 && (BossRush.selectX == 1 && BossRush.selectY == 1))
                    {
                        skip = true;
                    }
                    if (!skip && !BossInfo.bossState[j])
                    {
                        spawnedItems      = false;
                        BossRush.pickups  = 0;
                        BossRush.flawless = true;
                        BossInfo.toNextBoss(true, j);
                    }
                }
                int x = BossRush.selectX + (BossRush.selectY * 3);
                int y = x + ((int)Mathf.Floor(BossInfo.defeatedBosses / 9) * 9);
                if (BossRush.selectingStage)
                {
                    BossRush.timeText.text = String.Format("{0}", y.ToString());
                }

                BossRush.selectPos.anchoredPosition = new Vector2(960 + ((BossRush.selectX - 1) * 233), 558 - ((BossRush.selectY - 1) * 232));
            }


            if (BossRush.gm.gameState == GameState.PLAYING)
            {
                if (!BossInfo.isBossDead() && BossRush.gm.sceneName == BossInfo.getBossScene())
                {
                    BossRush.currentTime += Time.deltaTime;
                }

                int h = (int)BossRush.currentTime / 3600;
                int m = ((int)BossRush.currentTime % 3600) / 60;
                int s = ((int)BossRush.currentTime % 3600) % 60;

                if (!BossRush.selectingStage)
                {
                    BossRush.timeText.text = String.Format("{0}:{1}:{2}", h.ToString("00"), m.ToString("00"), s.ToString("00"));
                }


                if (!BossInfo.isBossDead() && BossRush.gm.sceneName != BossInfo.getBossScene())
                {
                    BossInfo.toNextBoss(false);
                }
                if (BossInfo.isBossDead() && PlayerData.instance.health > 0 && BossRush.gm.sceneName != "Tutorial_01" && BossRush.gm.sceneName != "Dream_04_White_Defender" && BossRush.gm.sceneName != "Dream_Mighty_Zote" && BossRush.gm.sceneName != "Dream_01_False_Knight" && BossRush.gm.sceneName != "Dream_02_Mage_Lord" && BossRush.gm.sceneName != "Dream_03_Infected_Knight" && BossRush.gm.sceneName != "Grimm_Nightmare")
                {
                    if (!spawnedItems)
                    {
                        if (BossInfo.SpawnAll())
                        {
                            spawnedItems = true;
                        }
                    }
                    else
                    {
                        if (PlayerData.instance.trinket1 > 0)
                        {
                            BossInfo.pickupItem(0);
                        }
                        if (PlayerData.instance.trinket2 > 0)
                        {
                            BossInfo.pickupItem(1);
                        }
                        if (PlayerData.instance.trinket3 > 0)
                        {
                            BossInfo.pickupItem(2);
                        }

                        if (BossRush.pickups > (BossRush.flawless ? 1 : 0))
                        {
                            if (!BossRush.selectingStage)
                            {
                                BossInfo.bossState[BossInfo.currentBoss] = true;
                                BossInfo.defeatedBosses++;
                                //spawnedItems = false;
                                HeroController.instance.RelinquishControl();
                                HeroController.instance.StopAnimationControl();
                                HeroController.instance.cState.invulnerable = true;
                                BossRush.selectY = 1;
                                BossRush.selectX = 1;

                                BossRush.bossSelectImg.enabled = true;
                                BossRush.selectPos.GetComponent <UnityEngine.UI.Image>().enabled = true;
                                for (int i = 0; i < BossRush.bossFaces.Length; i++)
                                {
                                    int j = i + ((int)Mathf.Floor(BossInfo.defeatedBosses / 9) * 9);
                                    int k = j;
                                    if (i < 3)
                                    {
                                        k = j + 6;
                                    }
                                    if (i > 5)
                                    {
                                        k = j - 6;
                                    }
                                    if (BossInfo.bossState[k])
                                    {
                                        BossRush.bossText[i].text = "RIP";
                                    }
                                    else
                                    {
                                        BossRush.bossText[i].text = Language.Language.Get(BossInfo.bossName[j] + "_SUPER", "Titles") + " " + Language.Language.Get(BossInfo.bossName[j] + "_MAIN", "Titles") + " " + Language.Language.Get(BossInfo.bossName[j] + "_SUB", "Titles");
                                    }
                                }
                                for (int i = 0; i < BossRush.bossFaces.Length; i++)
                                {
                                    BossRush.bossFaces[i].enabled = true;
                                    BossRush.bossText[i].enabled  = true;
                                }
                                BossRush.selectingStage          = true;
                                PlayerData.instance.disablePause = true;
                            }
                            //BossInfo.toNextBoss(true);
                        }
                    }
                }
            }
        }
コード例 #7
0
ファイル: BossRush.cs プロジェクト: iamwyza/hk-bossrush
        public void createLabel(GameObject go, int i)
        {
            if (go?.transform == null)
            {
                return;
            }

            GameObject label = new GameObject("Label");

            Transform child = go.transform.FindChild("Arrow Prompt(Clone)/Labels/Inspect");

            if (child?.gameObject == null)
            {
                return;
            }

            GameObject oldLabel = child.gameObject;

            if (oldLabel?.transform?.parent?.parent?.parent == null)
            {
                return;
            }


            //RectTransform
            RectTransform rectTransform = oldLabel.GetComponent <RectTransform>();

            if (rectTransform == null)
            {
                return;
            }

            label.AddComponent(rectTransform);

            //MeshRenderer
            MeshRenderer meshRenderer = oldLabel.GetComponent <MeshRenderer>();

            if (meshRenderer == null)
            {
                return;
            }

            label.AddComponent(meshRenderer);

            //MeshFilter
            MeshFilter meshFilter = oldLabel.GetComponent <MeshFilter>();

            if (meshFilter == null)
            {
                return;
            }

            label.AddComponent(meshFilter);

            //TextContainer
            TextContainer textContainer = oldLabel.GetComponent <TextContainer>();

            if (textContainer == null)
            {
                return;
            }

            label.AddComponent(textContainer);

            //TextMeshPro
            TextMeshPro textMeshPro = oldLabel.GetComponent <TextMeshPro>();

            if (textMeshPro == null)
            {
                return;
            }

            label.AddComponent(textMeshPro);

            //ChangeFontByLanguage
            ChangeFontByLanguage changeFontByLanguage = oldLabel.GetComponent <ChangeFontByLanguage>();

            if (changeFontByLanguage == null)
            {
                return;
            }

            label.AddComponent(changeFontByLanguage);


            if (label.transform?.localPosition == null)
            {
                return;
            }

            label.transform.parent        = oldLabel.transform.parent.parent.parent;
            label.transform.localPosition = label.transform.localPosition + (Vector3.up * 2.4f);
            label.transform.localPosition = label.transform.localPosition + (Vector3.right * 0.14f);
            label.SetActive(true);

            TextMeshPro tmp = label.GetComponent <TextMeshPro>();

            if (tmp == null)
            {
                return;
            }

            ChangeFontByLanguage fonts = label.GetComponent <ChangeFontByLanguage>();

            if (fonts == null)
            {
                return;
            }

            tmp.font = fonts.defaultFont;
            string a = Language.Language.CurrentLanguage().ToString();

            switch (a)
            {
            case "JA":
                tmp.font = fonts.fontJA;
                break;

            case "RU":
                tmp.font = fonts.fontRU;
                break;
            }
            tmp.fontSize  = 7;
            tmp.alignment = TextAlignmentOptions.Center;
            tmp.text      = BossInfo.itemName(i);

            TextMeshPro textMeshPro2 = label.GetComponent <TextMeshPro>();

            if (textMeshPro2 != null)
            {
                tmp.faceColor = new Color32(textMeshPro2.faceColor.r, textMeshPro2.faceColor.g, textMeshPro2.faceColor.b, 0);
            }

            ItemTextFader itf = go.AddComponent <ItemTextFader>();

            if (itf != null)
            {
                itf.tmp = tmp;
                itf.id  = i;
            }
        }
コード例 #8
0
ファイル: BossRush.cs プロジェクト: iamwyza/hk-bossrush
        public override void Initialize()
        {
            ModHooks.Logger.Log("Initializing BossRush");

            BossInfo.createBossInfo();
            ItemInfo.createItemInfo();
            BossInfo.assignItems();

            CanvasUtil.createFonts();

            shiny = null;

            uib = UIManager.instance.uiButtonSkins;
            ih  = GameManager.instance.inputHandler;

            canvas = CanvasUtil.createCanvas(1920, 1080);

            textSkip  = CanvasUtil.createTextPanel(canvas, "Press to skip without picking up items", 960, 30, 1920, 50, 24).GetComponent <Text>();
            imageSkip = CanvasUtil.createImagePanel(canvas, 960, 90, 58, 58).GetComponent <Image>();
            imageText = CanvasUtil.createTextPanel(canvas, "", 960, 90, 58, 58, 24).GetComponent <Text>();
            rectSkip  = imageSkip.gameObject.GetComponent <RectTransform>();

            FadeOutSkip(0);

            byte[] bossFaces1 = ResourceLoader.loadBossFaces1();
            bossFaces = new UnityEngine.UI.Image[9];
            bossFace1 = new Sprite[9];
            bossFace2 = new Sprite[9];
            bossFace3 = new Sprite[9];
            bossText  = new UnityEngine.UI.Text[9];

            bgImg         = CanvasUtil.createImagePanel(canvas, ResourceLoader.loadBackground(), 960, 540, 1920, 1080, 0, 0, 1280, 720).GetComponent <Image>();
            bossSelectImg = CanvasUtil.createImagePanel(canvas, ResourceLoader.loadBossSelect(), 960, 540, 1920, 1080, 0, 0, 1920, 1080).GetComponent <Image>();
            selectPos     = CanvasUtil.createImagePanel(canvas, ResourceLoader.loadSelect(), 960, 540, 229, 193, 0, 0, 228, 193).GetComponent <RectTransform>();

            for (int i = 0; i < bossFaces.Length; i++)
            {
                int x = (i % 3);
                int y = i / 3;
                bossFaces[i] = CanvasUtil.createImagePanel(canvas, ResourceLoader.loadBossFaces1(), (233 * x) + 727, (232 * y) + 325, 211, 176, (x * 211) + 1, (y * 177) + 1, 207, 174).GetComponent <UnityEngine.UI.Image>();
                bossText[i]  = CanvasUtil.createTextPanel(canvas, (233 * x) + 727, (232 * y) + 217, 211, 30).GetComponent <UnityEngine.UI.Text>();
            }
            for (int i = 0; i < bossFaces.Length; i++)
            {
                int x = (i % 3);
                int y = i / 3;
                bossFace1[i] = CanvasUtil.createSprite(ResourceLoader.loadBossFaces1(), (x * 211) + 1, (y * 177) + 1, 207, 174);
                bossFace2[i] = CanvasUtil.createSprite(ResourceLoader.loadBossFaces2(), (x * 211) + 1, (y * 177) + 1, 207, 174);
                bossFace3[i] = CanvasUtil.createSprite(ResourceLoader.loadBossFaces3(), (x * 211) + 1, (y * 177) + 1, 207, 174);
            }

            selectPos.SetAsLastSibling();

            GameObject.DontDestroyOnLoad(canvas);

            bgImg.enabled         = false;
            bossSelectImg.enabled = false;
            selectPos.GetComponent <UnityEngine.UI.Image>().enabled = false;
            for (int i = 0; i < bossFaces.Length; i++)
            {
                bossFaces[i].enabled = false;
                bossText[i].enabled  = false;
            }

            UnityEngine.SceneManagement.SceneManager.sceneLoaded += onSceneLoad;

            ModHooks.Instance.TakeHealthHook     += tookDamage;
            ModHooks.Instance.ColliderCreateHook += onCollider;
            ModHooks.Instance.NewGameHook        += resetData;
            //ModHooks.Instance.TakeDamageHook += tookDamage;

            ModHooks.Instance.LanguageGetHook += PromptOverride;

            ModHooks.Logger.Log("Initialized BossRush");
        }