Exemplo n.º 1
0
        internal static void InjectMainMenu()
        {
            GadgetCore.Log("Injecting Mod Menu into Main Menu");

            GameObject mainMenu = InstanceTracker.Menuu.menuMain;

            Array.ForEach(mainMenu.GetComponentsInChildren <Animation>(), x => x.enabled = true);
            ModMenuBeam      = UnityEngine.Object.Instantiate(mainMenu.transform.Find("beamm").gameObject, mainMenu.transform);
            ModMenuBeam.name = "beamm";
            ModMenuBeam.transform.localScale = new Vector3(30, 0, 1);
            ModMenuBeam.transform.position   = new Vector3(0, -13.5f, 1);
            ModMenuButtonHolder      = UnityEngine.Object.Instantiate(mainMenu.transform.Find("BUTTONHOLDER").gameObject, mainMenu.transform);
            ModMenuButtonHolder.name = "BUTTONHOLDER";
            ModMenuButtonHolder.transform.position = new Vector3(0, -13.5f, 0);
            ModMenuButtonHolder.GetComponent <Animation>().RemoveClip("enterr1");
            ModMenuButtonHolder.GetComponent <Animation>().AddClip(BuildModMenuButtonAnimClip(false), "enterr1");
            ModMenuButtonHolder.GetComponent <Animation>().clip = ModMenuButtonHolder.GetComponent <Animation>().GetClip("enterr1");
            GameObject bModMenu = ModMenuButtonHolder.transform.GetChild(0).gameObject;

            bModMenu.name = "bModMenu";
            Array.ForEach(bModMenu.GetComponentsInChildren <TextMesh>(), x => x.text = GadgetCore.IsUnpacked ? "MOD MENU" : File.Exists(Path.Combine(UMFData.ModsPath, "GadgetCore.dll")) ? "UPDATE GADGET CORE" : "UNPACK GADGET CORE");
            ModMenuBeam.GetComponent <Animation>().Play();
            ModMenuButtonHolder.GetComponent <Animation>().Play();
            if (GadgetCore.IsUnpacked)
            {
                BuildModMenu();
            }
        }
Exemplo n.º 2
0
        private static IEnumerator AnimateModMenuButton(Menuu instance)
        {
            ModMenuBeam.GetComponent <Animation>().Play();
            yield return(new WaitForSeconds(0.3f));

            ModMenuButtonHolder.GetComponent <Animation>().Play();
            yield break;
        }
Exemplo n.º 3
0
        internal static void InjectMainMenu()
        {
            GadgetCore.CoreLogger.Log("Injecting objects into Main Menu");

            Texture2D boxTex = GadgetCoreAPI.LoadTexture2D("boxsprite.png");

            boxTex.filterMode = FilterMode.Point;
            Texture2D boxMaskTex = GadgetCoreAPI.LoadTexture2D("boxmask.png");

            boxMaskTex.filterMode = FilterMode.Point;
            Texture2D barTex = GadgetCoreAPI.LoadTexture2D("barsprite.png");

            barTex.filterMode = FilterMode.Point;
            BoxSprite         = Sprite.Create(boxTex, new Rect(0, 0, boxTex.width, boxTex.height), new Vector2(0.5f, 0.5f), 100, 1, SpriteMeshType.Tight, new Vector4(15, 15, 15, 15));
            BoxMask           = Sprite.Create(boxMaskTex, new Rect(0, 0, boxMaskTex.width, boxMaskTex.height), new Vector2(0.5f, 0.5f), 100, 1, SpriteMeshType.Tight, new Vector4(15, 15, 15, 15));
            BarSprite         = Sprite.Create(barTex, new Rect(0, 0, barTex.width, barTex.height), new Vector2(0.5f, 0.5f), 100, 1, SpriteMeshType.Tight, new Vector4(1, 1, 1, 1));

            GameObject mainMenu = InstanceTracker.Menuu.menuMain;

            Array.ForEach(mainMenu.GetComponentsInChildren <Animation>(), x => x.enabled = true);
            ModMenuBeam      = UnityEngine.Object.Instantiate(mainMenu.transform.Find("beamm").gameObject, mainMenu.transform);
            ModMenuBeam.name = "beamm";
            ModMenuBeam.transform.localScale = new Vector3(30, 0, 1);
            ModMenuBeam.transform.position   = new Vector3(0, -13.5f, 1);
            ModMenuButtonHolder      = UnityEngine.Object.Instantiate(mainMenu.transform.Find("BUTTONHOLDER").gameObject, mainMenu.transform);
            ModMenuButtonHolder.name = "BUTTONHOLDER";
            ModMenuButtonHolder.transform.position = new Vector3(-40f, -13.5f, 0);
            ModMenuButtonHolder.GetComponent <Animation>().RemoveClip("enterr1");
            ModMenuButtonHolder.GetComponent <Animation>().AddClip(BuildModMenuButtonAnimClip(false), "enterr1");
            ModMenuButtonHolder.GetComponent <Animation>().clip = ModMenuButtonHolder.GetComponent <Animation>().GetClip("enterr1");
            GameObject bModMenu = ModMenuButtonHolder.transform.GetChild(0).gameObject;

            bModMenu.name = "bModMenu";
            Array.ForEach(bModMenu.GetComponentsInChildren <TextMesh>(), x => x.text = "MOD MENU");
            InstanceTracker.Menuu.StartCoroutine(AnimateModMenuButton(InstanceTracker.Menuu));
            BuildModMenu();
            if (PersistantCanvas == null)
            {
                BuildPersistantCanvas();
            }
        }