示例#1
0
    IEnumerator NewGame()
    {
        SpriteRenderer blank = GameObject.Find("Blank").GetComponent <SpriteRenderer>();

        while (blank.color.a <= 1)
        {
            if (tmName.transform.localScale.x < 3)
            {
                tmName.transform.localScale    = new Vector3(tmName.transform.localScale.x + 0.01f, tmName.transform.localScale.y + 0.01f, 1);
                tmName.transform.localPosition = new Vector3(actualX - (((tmName.transform.localScale.x - 1) * diff) / 2),
                                                             actualY - (((tmName.transform.localScale.x - 1) * diff) / 6), tmName.transform.localPosition.z);
            }
            blank.color = new Color(blank.color.r, blank.color.g, blank.color.b, blank.color.a + 0.003f);
            yield return(0);
        }
        while (Camera.main.GetComponent <AudioSource>().isPlaying)
        {
            yield return(0);
        }
        PlayerCharacter.instance.Reset(false);
        LuaScriptBinder.ClearVariables();
        GlobalControls.GameMapData.Clear();
        Inventory.inventory.Clear();
        GameObject.DontDestroyOnLoad(gameObject);
        UnitaleUtil.ResetOW();
        SceneManager.LoadScene("TransitionOverworld");
        yield return(0);

        //yield return Application.isLoadingLevel;
        if (GameObject.Find("Main Camera"))
        {
            GameObject.Destroy(GameObject.Find("Main Camera"));
        }
        GameObject.Destroy(gameObject);
    }
示例#2
0
    /// <summary>
    /// Makes the buttons for the mod selection screen.
    /// </summary>
    private void modFolderSelection()
    {
        if (GlobalControls.crate)
        {
            GameObject.Find("Text").GetComponent <Text>().text = "MDO SELECTRO (CILCK + DARG TO SEE OTRHE MODS)";
        }
        DirectoryInfo di = new DirectoryInfo(System.IO.Path.Combine(FileLoader.DataRoot, "Mods"));

        DirectoryInfo[] modDirs   = di.GetDirectories();
        int             numButton = 0;

        foreach (DirectoryInfo modDir in modDirs)
        {
            if (modDir.Name == "0.5.0_SEE_CRATE")
            {
                continue;
            }
            Button c = Instantiate(b);
            c.transform.SetParent(GameObject.Find("Content").transform);
            RectTransform crt = c.GetComponent <RectTransform>();
            crt.anchoredPosition = new Vector2(5, 0 - 40 * numButton);
            c.GetComponentInChildren <Text>().text = modDir.Name;
            string mdn = modDir.Name; // create a new object in memory because the reference to moddir in the anonymous function gets f****d
            c.onClick.AddListener(() => { StaticInits.MODFOLDER = mdn; Debug.Log("Selecting directory " + mdn); SceneManager.LoadScene("EncounterSelect"); });
            numButton++;
        }

        if (GlobalControls.modDev)
        {
            Transform[] tfs = UnitaleUtil.GetFirstChildren(GameObject.Find("Canvas").transform, true);
            foreach (Transform tf in tfs)
            {
                if (tf.gameObject.name == "devMod")
                {
                    tf.gameObject.SetActive(true);
                    if (GlobalControls.crate)
                    {
                        GameObject.Find("Text2").GetComponent <Text>().text = "MODEDV MODE HREE!!!\nIZI MDO TSETING!!!\nGAD LUKC!!!!!1!!";
                    }

                    Button but = Instantiate(bs), but2 = Instantiate(bs), but3 = Instantiate(bs), but4 = Instantiate(bs);

                    but.gameObject.name = "ResetRG";
                    but.transform.SetParent(GameObject.Find("Canvas").transform);
                    but.GetComponent <RectTransform>().sizeDelta = new Vector2(150, but.GetComponent <RectTransform>().sizeDelta.y);
                    but.GetComponent <RectTransform>().position  = new Vector2(325, 200);
                    but.GetComponentInChildren <Text>().text     = "Reset RealGlobals";
                    but.onClick.AddListener(() => {
                        LuaScriptBinder.ClearVariables();
                        if (GlobalControls.crate)
                        {
                            GameObject.Find("Text3").GetComponent <Text>().text = "REELGOLBELZ\nDELEET!!!!!";
                        }
                        else
                        {
                            GameObject.Find("Text3").GetComponent <Text>().text = "RealGlobals\nerased!";
                        }
                    });

                    but2.gameObject.name = "ResetAM";
                    but2.transform.SetParent(GameObject.Find("Canvas").transform);
                    but2.GetComponent <RectTransform>().sizeDelta = new Vector2(150, but2.GetComponent <RectTransform>().sizeDelta.y);
                    but2.GetComponent <RectTransform>().position  = new Vector2(475, 200);
                    but2.GetComponentInChildren <Text>().text     = "Reset AlMighty";
                    but2.onClick.AddListener(() => {
                        LuaScriptBinder.ClearAlMighty();
                        if (GlobalControls.crate)
                        {
                            GameObject.Find("Text4").GetComponent <Text>().text = "ALMEIGHTIZ\nDELEET!!!!!";
                        }
                        else
                        {
                            GameObject.Find("Text4").GetComponent <Text>().text = "AlMighty\nerased!";
                        }
                    });

                    but3.gameObject.name = "Retromode";
                    but3.transform.SetParent(GameObject.Find("Canvas").transform);
                    but3.GetComponent <RectTransform>().sizeDelta = new Vector2(300, but3.GetComponent <RectTransform>().sizeDelta.y);
                    but3.GetComponent <RectTransform>().position  = new Vector2(325, 440);
                    if (GlobalControls.retroMode)
                    {
                        but3.GetComponentInChildren <Text>().text = "0.2.1a retrocompatibility: On";
                    }
                    else
                    {
                        but3.GetComponentInChildren <Text>().text = "0.2.1a retrocompatibility: Off";
                    }
                    but3.onClick.AddListener(() => {
                        GlobalControls.retroMode = !GlobalControls.retroMode;
                        if (GlobalControls.retroMode)
                        {
                            but3.GetComponentInChildren <Text>().text = "0.2.1a retrocompatibility: On";
                        }
                        else
                        {
                            but3.GetComponentInChildren <Text>().text = "0.2.1a retrocompatibility: Off";
                        }
                    });

                    but4.gameObject.name = "Safemode";
                    but4.transform.SetParent(GameObject.Find("Canvas").transform);
                    but4.GetComponent <RectTransform>().sizeDelta = new Vector2(300, but3.GetComponent <RectTransform>().sizeDelta.y);
                    but4.GetComponent <RectTransform>().position  = new Vector2(325, 400);
                    if (ControlPanel.instance.Safe)
                    {
                        but4.GetComponentInChildren <Text>().text = "Safe mode: On";
                    }
                    else
                    {
                        but4.GetComponentInChildren <Text>().text = "Safe mode: Off";
                    }
                    but4.onClick.AddListener(() => {
                        ControlPanel.instance.Safe = !ControlPanel.instance.Safe;
                        if (ControlPanel.instance.Safe)
                        {
                            but4.GetComponentInChildren <Text>().text = "Safe mode: On";
                        }
                        else
                        {
                            but4.GetComponentInChildren <Text>().text = "Safe mode: Off";
                        }
                    });
                    break;
                }
            }
        }
    }
示例#3
0
    // Use this for initialization
    private void Start()
    {
        // add button functions

        // reset RealGlobals
        ResetRG.GetComponent <Button>().onClick.AddListener(() => {
            if (RealGlobalCooldown > 0)
            {
                LuaScriptBinder.ClearVariables();
                RealGlobalCooldown = 60 * 2;
                ResetRG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Real Globals Erased!" : "REEL GOLBELZ DELEET!!!!!";
            }
            else
            {
                RealGlobalCooldown = 60 * 2;
                ResetRG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???";
            }
        });

        // reset AlMightyGlobals
        ResetAG.GetComponent <Button>().onClick.AddListener(() => {
            if (AlMightyGlobalCooldown > 0)
            {
                LuaScriptBinder.ClearAlMighty();
                AlMightyGlobalCooldown = 60 * 2;
                ResetAG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "AlMighty Globals Erased!" : "ALMEIGHTIZ DELEET!!!!!";
            }
            else
            {
                AlMightyGlobalCooldown = 60 * 2;
                ResetAG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???";
            }
        });

        // clear Save
        ClearSave.GetComponent <Button>().onClick.AddListener(() => {
            if (SaveCooldown > 0)
            {
                File.Delete(Application.persistentDataPath + "/save.gd");
                SaveCooldown = 60 * 2;
                ClearSave.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Save wiped!" : "RIP";
            }
            else
            {
                SaveCooldown = 60 * 2;
                ClearSave.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???";
            }
        });

        // toggle safe mode
        Safe.GetComponent <Button>().onClick.AddListener(() => {
            ControlPanel.instance.Safe = !ControlPanel.instance.Safe;

            // save Safe Mode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFSafeMode", DynValue.NewBoolean(ControlPanel.instance.Safe), true);

            Safe.GetComponentInChildren <Text>().text = !GlobalControls.crate
                ? ("Safe mode: " + (ControlPanel.instance.Safe ? "On" : "Off"))
                : ("SFAE MDOE: " + (ControlPanel.instance.Safe ? "ON" : "OFF"));
        });
        Safe.GetComponentInChildren <Text>().text = !GlobalControls.crate
            ? ("Safe mode: " + (ControlPanel.instance.Safe ? "On" : "Off"))
            : ("SFAE MDOE: " + (ControlPanel.instance.Safe ? "ON" : "OFF"));

        // toggle retrocompatibility mode
        Retro.GetComponent <Button>().onClick.AddListener(() => {
            GlobalControls.retroMode = !GlobalControls.retroMode;

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFRetroMode", DynValue.NewBoolean(GlobalControls.retroMode), true);

            Retro.GetComponentInChildren <Text>().text = !GlobalControls.crate
                ? ("Retrocompatibility Mode: " + (GlobalControls.retroMode ? "On" : "Off"))
                : ("RETORCMOAPTIILBIYT MOD: " + (GlobalControls.retroMode ? "ON" : "OFF"));
        });
        Retro.GetComponentInChildren <Text>().text = !GlobalControls.crate
            ? ("Retrocompatibility Mode: " + (GlobalControls.retroMode ? "On" : "Off"))
            : ("RETORCMOAPTIILBIYT MOD: " + (GlobalControls.retroMode ? "ON" : "OFF"));

        // toggle pixel-perfect fullscreen
        Fullscreen.GetComponent <Button>().onClick.AddListener(() => {
            ScreenResolution.perfectFullscreen = !ScreenResolution.perfectFullscreen;

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFPerfectFullscreen", DynValue.NewBoolean(ScreenResolution.perfectFullscreen), true);

            Fullscreen.GetComponentInChildren <Text>().text = !GlobalControls.crate
                ? ("Blurless Fullscreen: " + (ScreenResolution.perfectFullscreen ? "On" : "Off"))
                : ("NOT UGLEE FULLSCREEN: " + (ScreenResolution.perfectFullscreen ? "ON" : "OFF"));
        });
        Fullscreen.GetComponentInChildren <Text>().text = !GlobalControls.crate
            ? ("Blurless Fullscreen: " + (ScreenResolution.perfectFullscreen ? "On" : "Off"))
            : ("NOT UGLEE FULLSCREEN: " + (ScreenResolution.perfectFullscreen ? "ON" : "OFF"));

        // change window scale
        Scale.GetComponent <Button>().onClick.AddListener(() => {
            double maxScale = System.Math.Floor(Screen.currentResolution.height / 480.0);
            if (ScreenResolution.windowScale < maxScale)
            {
                ScreenResolution.windowScale += 1;
            }
            else
            {
                ScreenResolution.windowScale = 1;
            }

            if (Screen.height != ScreenResolution.windowScale * 480 && !Screen.fullScreen)
            {
                ScreenResolution.SetFullScreen(false);
            }

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFWindowScale", DynValue.NewNumber(ScreenResolution.windowScale), true);

            Scale.GetComponentInChildren <Text>().text = !GlobalControls.crate
                ? ("Window Scale: " + ScreenResolution.windowScale.ToString() + "x")
                : ("WEENDO STRECH: " + ScreenResolution.windowScale.ToString() + "X");
        });
        ScreenResolution.windowScale--;
        Scale.GetComponent <Button>().onClick.Invoke();

        // Discord Rich Presence
        // Change Discord Status Visibility
        Discord.GetComponent <Button>().onClick.AddListener(() => {
            Discord.GetComponentInChildren <Text>().text = (!GlobalControls.crate ? "Discord Display: " : "DEESCORD DESPLAY: ") + DiscordControls.ChangeVisibilitySetting(1);
        });
        Discord.GetComponentInChildren <Text>().text = (!GlobalControls.crate ? "Discord Display: " : "DEESCORD DESPLAY: ") + DiscordControls.ChangeVisibilitySetting(0);

        // exit
        Exit.GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("ModSelect"); });

        // Crate Your Frisk
        if (!GlobalControls.crate)
        {
            return;
        }
        // labels
        GameObject.Find("OptionsLabel").GetComponent <Text>().text     = "OPSHUNS";
        GameObject.Find("DescriptionLabel").GetComponent <Text>().text = "MORE TXET";

        // buttons
        ResetRG.GetComponentInChildren <Text>().text   = "RESTE RELA GOLBALZ";
        ResetAG.GetComponentInChildren <Text>().text   = "RESTE ALMIGTY GOLBALZ";
        ClearSave.GetComponentInChildren <Text>().text = "WYPE SAV";
        Exit.GetComponentInChildren <Text>().text      = "EXIT TOO MAD SELCT";
    }
示例#4
0
    // Use this for initialization
    private void Start()
    {
        // add button functions

        // reset RealGlobals
        GameObject.Find("ResetRG").GetComponent <Button>().onClick.AddListener(() => {
            if (RealGlobalCooldown > 0)
            {
                LuaScriptBinder.ClearVariables();
                RealGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "Real Globals Erased!";
                }
                else
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "REEL GOLBELZ DELEET!!!!!";
                }
            }
            else
            {
                RealGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "Are you sure?";
                }
                else
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "R U SUR???";
                }
            }
        });

        // reset AlMightyGlobals
        GameObject.Find("ResetAG").GetComponent <Button>().onClick.AddListener(() => {
            if (AlMightyGlobalCooldown > 0)
            {
                LuaScriptBinder.ClearAlMighty();
                AlMightyGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "AlMighty Globals Erased!";
                }
                else
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "ALMEIGHTIZ DELEET!!!!!";
                }
            }
            else
            {
                AlMightyGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "Are you sure?";
                }
                else
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "R U SUR???";
                }
            }
        });

        // clear Save
        GameObject.Find("ClearSave").GetComponent <Button>().onClick.AddListener(() => {
            if (SaveCooldown > 0)
            {
                File.Delete(Application.persistentDataPath + "/save.gd");
                SaveCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "Save wiped!";
                }
                else
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "RIP";
                }
            }
            else
            {
                SaveCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "Are you sure?";
                }
                else
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "R U SUR???";
                }
            }
        });

        // toggle safe mode
        GameObject.Find("Safe").GetComponent <Button>().onClick.AddListener(() => {
            ControlPanel.instance.Safe = !ControlPanel.instance.Safe;

            // save Safe Mode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFSafeMode", DynValue.NewBoolean(ControlPanel.instance.Safe), true);

            if (!GlobalControls.crate)
            {
                if (ControlPanel.instance.Safe)
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "Safe mode: On";
                }
                else
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "Safe mode: Off";
                }
            }
            else
            {
                if (ControlPanel.instance.Safe)
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "SFAE MDOE: ON";
                }
                else
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "SFAE MDOE: OFF";
                }
            }
        });
        ControlPanel.instance.Safe = !ControlPanel.instance.Safe;
        GameObject.Find("Safe").GetComponent <Button>().onClick.Invoke();

        // toggle retrocompatibility mode
        GameObject.Find("Retro").GetComponent <Button>().onClick.AddListener(() => {
            GlobalControls.retroMode = !GlobalControls.retroMode;

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFRetroMode", DynValue.NewBoolean(GlobalControls.retroMode), true);

            if (!GlobalControls.crate)
            {
                if (GlobalControls.retroMode)
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "Retrocompatibility Mode: On";
                }
                else
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "Retrocompatibility Mode: Off";
                }
            }
            else
            {
                if (GlobalControls.retroMode)
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "RETORCMOAPTIILBIYT MOD: ON";
                }
                else
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "RETORCMOAPTIILBIYT MOD: OFF";
                }
            }
        });
        GlobalControls.retroMode = !GlobalControls.retroMode;
        GameObject.Find("Retro").GetComponent <Button>().onClick.Invoke();

        // toggle pixel-perfect fullscreen
        GameObject.Find("Fullscreen").GetComponent <Button>().onClick.AddListener(() => {
            GlobalControls.perfectFullscreen = !GlobalControls.perfectFullscreen;

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFPerfectFullscreen", DynValue.NewBoolean(GlobalControls.perfectFullscreen), true);

            if (!GlobalControls.crate)
            {
                if (GlobalControls.perfectFullscreen)
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "Blurless Fullscreen: On";
                }
                else
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "Blurless Fullscreen: Off";
                }
            }
            else
            {
                if (GlobalControls.retroMode)
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "NOT UGLEE FULLSRCEEN: ON";
                }
                else
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "NOT UGLEE FULLSRCEEN: OFF";
                }
            }
        });
        GlobalControls.perfectFullscreen = !GlobalControls.perfectFullscreen;
        GameObject.Find("Fullscreen").GetComponent <Button>().onClick.Invoke();

        // change window scale
        GameObject.Find("Scale").GetComponent <Button>().onClick.AddListener(() => {
            double maxScale = System.Math.Floor(Screen.currentResolution.height / 480.0);
            if (GlobalControls.windowScale < maxScale)
            {
                GlobalControls.windowScale += 1;
            }
            else
            {
                GlobalControls.windowScale = 1;
            }

            if (Screen.height != GlobalControls.windowScale * 480 && !Screen.fullScreen)
            {
                GlobalControls.SetFullScreen(false);
            }

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFWindowScale", DynValue.NewNumber(GlobalControls.windowScale), true);

            if (!GlobalControls.crate)
            {
                GameObject.Find("Scale").GetComponentInChildren <Text>().text = "Window Scale: " + GlobalControls.windowScale.ToString() + "x";
            }
            else
            {
                GameObject.Find("Scale").GetComponentInChildren <Text>().text = "WEENDO STRECH: " + GlobalControls.windowScale.ToString() + "X";
            }
        });
        GlobalControls.windowScale--;
        GameObject.Find("Scale").GetComponent <Button>().onClick.Invoke();

        // exit
        GameObject.Find("Exit").GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("ModSelect"); });

        // Crate Your Frisk
        if (GlobalControls.crate)
        {
            // labels
            GameObject.Find("OptionsLabel").GetComponent <Text>().text     = "OPSHUNS";
            GameObject.Find("DescriptionLabel").GetComponent <Text>().text = "MORE TXET";

            // buttons
            GameObject.Find("ResetRG").GetComponentInChildren <Text>().text    = "RESTE RELA GOLBALZ";
            GameObject.Find("ResetAG").GetComponentInChildren <Text>().text    = "RESTE ALMIGTY GOLBALZ";
            GameObject.Find("ClearSave").GetComponentInChildren <Text>().text  = "WYPE SAV";
            GameObject.Find("Safe").GetComponentInChildren <Text>().text       = "SFAE MODE: " + (ControlPanel.instance.Safe ? "ON" : "OFF");
            GameObject.Find("Retro").GetComponentInChildren <Text>().text      = "RETORCMOAPTIILBIYT MOD: " + (ControlPanel.instance.Safe ? "ON" : "OFF");
            GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "NOT UGLEE FULLSRCEEN: " + (GlobalControls.perfectFullscreen ? "ON" : "OFF");
            GameObject.Find("Scale").GetComponentInChildren <Text>().text      = "WEENDO STRECH: " + GlobalControls.windowScale.ToString() + "X";
            GameObject.Find("Exit").GetComponentInChildren <Text>().text       = "EXIT TOO MAD SELCT";
        }
    }