Esempio n. 1
0
        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");
        }