コード例 #1
0
    /// <summary>
    /// Changes the Discord Rich Presence visibility setting.
    /// </summary>
    /// <param name="spd">Added so the setting can be written out at init time without changing it.</param>
    /// <returns>The name of the current setting.</returns>
    public static string ChangeVisibilitySetting(int spd)
    {
        curr_setting += spd;
        if (curr_setting >= settingNames.Length)
        {
            curr_setting = 0;
        }

        if (spd > 0)
        {
            LuaScriptBinder.SetAlMighty(null, "CYFDiscord", DynValue.NewNumber(curr_setting), true);
        }

        switch (curr_setting)
        {
        case 0:
            StartModSelect(false);
            break;

        case 1:
            activity.Details          = "";
            activity.State            = "";
            activity.Timestamps.Start = 0;
            activity.Timestamps.End   = 0;
            UpdatePresence(true);
            break;

        default:
            Clear();
            break;
        }

        return(GlobalControls.crate ? Temmify.Convert(settingNames[curr_setting]) : settingNames[curr_setting]);
    }
コード例 #2
0
    public void LoadVariables()
    {
        foreach (string key in AlMightyVariablesNum.Keys)
        {
            double a;
            AlMightyVariablesNum.TryGetValue(key, out a);
            LuaScriptBinder.SetAlMighty(null, key, DynValue.NewNumber(a), false);
        }

        foreach (string key in AlMightyVariablesStr.Keys)
        {
            string a;
            AlMightyVariablesStr.TryGetValue(key, out a);
            LuaScriptBinder.SetAlMighty(null, key, DynValue.NewString(a), false);
        }

        foreach (string key in AlMightyVariablesBool.Keys)
        {
            bool a;
            AlMightyVariablesBool.TryGetValue(key, out a);
            LuaScriptBinder.SetAlMighty(null, key, DynValue.NewBoolean(a), false);
        }
    }
コード例 #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
    private void Start()
    {
        bool isStart = false;

        // Set timestamp for Overworld to calculate total play time
        GlobalControls.overworldTimestamp = Time.time - (SaveLoad.savedGame != null ? SaveLoad.savedGame.playerTime : 0f);
        // Forcefully disable retromode if it is on
        if (GlobalControls.retroMode)
        {
            GlobalControls.retroMode = false;
            try {
                LuaScriptBinder.SetAlMighty(null, "CYFRetroMode", DynValue.NewBoolean(false), true);
            } catch {}
        }

        GameOverBehavior.gameOverContainerOw = GameObject.Find("GameOverContainer");
        GameOverBehavior.gameOverContainerOw.SetActive(false);
        if (GameObject.Find("GameOverContainer"))
        {
            GameObject.Destroy(GameOverBehavior.gameOverContainerOw);
            GameOverBehavior.gameOverContainerOw = GameObject.Find("GameOverContainer");
            GameOverBehavior.gameOverContainerOw.SetActive(false);
        }
        GameObject.DontDestroyOnLoad(GameOverBehavior.gameOverContainerOw);

        if (LuaScriptBinder.Get(null, "PlayerPosX") == null || LuaScriptBinder.Get(null, "PlayerPosY") == null || LuaScriptBinder.Get(null, "PlayerPosZ") == null)
        {
            LuaScriptBinder.Set(null, "PlayerPosX", DynValue.NewNumber(BeginningPosition.x));
            LuaScriptBinder.Set(null, "PlayerPosY", DynValue.NewNumber(BeginningPosition.y));
            LuaScriptBinder.Set(null, "PlayerPosZ", DynValue.NewNumber(0));
        }
        if (GameObject.Find("Main Camera"))
        {
            GameObject.Destroy(GameObject.Find("Main Camera"));
        }
        //Used only for the 1st scene
        if (LuaScriptBinder.Get(null, "PlayerMap") == null)
        {
            isStart = true;
            SaveLoad.Start();

            GlobalControls.lastTitle = false;
            string mapName2;
            if (UnitaleUtil.MapCorrespondanceList.ContainsKey(FirstLevelToLoad))
            {
                mapName2 = UnitaleUtil.MapCorrespondanceList[FirstLevelToLoad];
            }
            else
            {
                mapName2 = FirstLevelToLoad;
            }
            LuaScriptBinder.Set(null, "PlayerMap", DynValue.NewString(mapName2));

            StaticInits.MODFOLDER = "";

            /*StaticInits.Initialized = false;
             * GameObject.Find("Main Camera OW").GetComponent<StaticInits>().initAll();*/
            GlobalControls.realName = PlayerCharacter.instance.Name;
        }
        //Check if there is two Main Camera OW objects
        GameObject temp = GameObject.Find("Main Camera OW");

        temp.SetActive(false);
        if (GameObject.Find("Main Camera OW"))
        {
            GameObject.Destroy(GameObject.Find("Main Camera OW"));
        }
        temp.SetActive(true);

        // After battle tweaks
        ControlPanel.instance.FrameBasedMovement = false;
        if (GlobalControls.realName != null)
        {
            PlayerCharacter.instance.Name = GlobalControls.realName;
        }

        //GameObject.Destroy(gameObject);

        GameObject.DontDestroyOnLoad(GameObject.Find("Canvas OW"));
        GameObject.DontDestroyOnLoad(GameObject.Find("Canvas Two"));
        GameObject.DontDestroyOnLoad(GameObject.Find("Player").transform.parent.gameObject);
        GameObject.DontDestroyOnLoad(GameObject.Find("Main Camera OW"));
        string mapName;

        if (!isStart)
        {
            try {
                if (UnitaleUtil.MapCorrespondanceList.ContainsValue(LuaScriptBinder.Get(null, "PlayerMap").String))
                {
                    mapName = UnitaleUtil.MapCorrespondanceList.FirstOrDefault(x => x.Value == LuaScriptBinder.Get(null, "PlayerMap").String).Key;
                }
                else
                {
                    mapName = LuaScriptBinder.Get(null, "PlayerMap").String;
                }
            } catch { mapName = LuaScriptBinder.Get(null, "PlayerMap").String; }
        }
        else
        {
            mapName = FirstLevelToLoad;
        }

        if (!FileLoader.SceneExists(mapName))
        {
            UnitaleUtil.DisplayLuaError("TransitionOverworld", "The map named \"" + mapName + "\" doesn't exist.");
            return;
        }
        if (GlobalControls.nonOWScenes.Contains(mapName))
        {
            UnitaleUtil.DisplayLuaError("TransitionOverworld", "Sorry, but \"" + mapName + "\" is not the name of an overworld scene.");
            return;
        }
        SceneManager.LoadScene(mapName);
        GameObject.Find("Don't show it again").GetComponent <Image>().color = new Color(0, 0, 0, 0);
        StartCoroutine(GetIntoDaMap("transitionoverworld", null));
    }
コード例 #5
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";
        }
    }