Esempio n. 1
0
 private void Start()
 {
     if (GlobalControls.crate)
     {
         Logo.GetComponent <Image>().enabled      = false;
         LogoCrate.GetComponent <Image>().enabled = true;
         Desc1.GetComponent <Text>().text         = "GO TO /R/UNITLAE. FOR UPDTAES!!!!!";
         Desc2.GetComponent <Text>().text         = "NO RELESLING HERE!!! IT'S RFEE!!! OR TUBY FEX WILL BE ANGER!!! U'LL HVAE A BED TMIE!!!";
         Desc3.GetComponent <Text>().text         = "SPACE OR KLIK TO\n<color='#ff0000'>PALY MODS!!!!!</color>";
         Desc4.GetComponent <Text>().text         = "PRSES O TO\n<color='#ffff00'>OOVERWURL!!!!!</color>";
         Desc5.GetComponent <Text>().text         = "<b><color='red'>KNOW YUOR CODE</color> R U'LL HVAE A BED TMIE!!!</b>";
         Version.GetComponent <Text>().text       = "v" + Random.Range(0, 9) + "." + Random.Range(0, 9) + "." + Random.Range(0, 9);
     }
     else if (Random.Range(0, 1000) == 021)
     {
         Logo.GetComponent <Image>().enabled = false;
         Version.GetComponent <Transform>().localPosition = new Vector3(0f, 160f, 0f);
         Version.GetComponent <Text>().color = new Color(1f, 1f, 1f, 1f);
         Version.GetComponent <Text>().text  = "Not Unitale v0.2.1a";
     }
     else
     {
         Version.GetComponent <Text>().text = "v" + GlobalControls.CYFversion;
     }
 }
Esempio n. 2
0
 // Use this for initialization
 private void Start()
 {
     if (!SaveLoad.started)
     {
         StaticInits.Start();
         SaveLoad.Start();
         new ControlPanel();
         new PlayerCharacter();
         #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
         Misc.WindowName = GlobalControls.crate ? ControlPanel.instance.WinodwBsaisNmae : ControlPanel.instance.WindowBasisName;
         #endif
         SaveLoad.LoadAlMighty();
         LuaScriptBinder.Set(null, "ModFolder", MoonSharp.Interpreter.DynValue.NewString("@Title"));
         UnitaleUtil.AddKeysToMapCorrespondanceList();
     }
     GameObject firstCamera = GameObject.Find("Main Camera");
     firstCamera.SetActive(false);
     if (GameObject.Find("Main Camera"))
     {
         Destroy(firstCamera);
     }
     else
     {
         firstCamera.SetActive(true);
     }
     tmName.SetHorizontalSpacing(2);
     tmName.SetFont(SpriteFontRegistry.Get(SpriteFontRegistry.UI_DEFAULT_NAME));
     diff    = calcTotalLength(tmName);
     actualX = tmName.transform.localPosition.x;
     actualY = tmName.transform.localPosition.y;
     if (GlobalControls.crate)
     {
         Logo.GetComponent <SpriteRenderer>().enabled      = false;
         LogoCrate.GetComponent <SpriteRenderer>().enabled = true;
     }
     DontDestroyOnLoad(Camera.main.gameObject);
     StartCoroutine(TitlePhase1());
 }
Esempio n. 3
0
    // Update is called once per frame
    private void Update()
    {
        if (GlobalControls.input.Confirm == UndertaleInput.ButtonState.PRESSED && phase == 0)
        {
            phase++;
            Camera.main.GetComponent <AudioSource>().Stop();
            StopCoroutine(TitlePhase1());
        }
        else
        {
            switch (phase)
            {
            case 1: {
                if (!initPhase)
                {
                    initPhase = true;

                    Camera.main.GetComponent <AudioSource>().clip = AudioClipRegistry.GetMusic("mus_menu");
                    Camera.main.GetComponent <AudioSource>().Play();
                    try {
                        if (!SaveLoad.Load())
                        {
                            SceneManager.LoadScene("EnterName");
                        }
                        else
                        {
                            PressEnterOrZ.gameObject.SetActive(false);
                            Logo.SetActive(false);
                            LogoCrate.SetActive(false);
                            GameObject.Find("Back1").SetActive(false);
                            TextManagerName.SetHorizontalSpacing(2);
                            TextManagerLevel.SetHorizontalSpacing(2);
                            TextManagerTime.SetHorizontalSpacing(2);
                            TextManagerMap.SetHorizontalSpacing(2);
                            TextManagerName.SetTextQueue(new[] { new TextMessage("[noskipatall]" + PlayerCharacter.instance.Name, false, true) });
                            TextManagerLevel.SetTextQueue(new[] { new TextMessage("[noskipatall]" + (GlobalControls.crate ? "VL" : "LV") + PlayerCharacter.instance.LV, false, true) });
                            TextManagerTime.SetTextQueue(new[] { new TextMessage("[noskipatall]" + UnitaleUtil.TimeFormatter(SaveLoad.savedGame.playerTime), false, true) });
                            TextManagerMap.SetTextQueue(new[] { new TextMessage("[noskipatall]" + SaveLoad.savedGame.lastScene, false, true) });
                            tmName.SetTextQueue(new[] { new TextMessage(PlayerCharacter.instance.Name, false, true) });
                            diff = calcTotalLength(tmName);
                            tmName.SetEffect(new ShakeEffect(tmName));
                        }
                    } catch {
                        GlobalControls.allowWipeSave = true;
                        if (GlobalControls.crate)
                        {
                            UnitaleUtil.DisplayLuaError(StaticInits.ENCOUNTER, "U USED AN ODL VERSOIN OF CFY? IT ISN'T COMAPTIBEL.\n\n"
                                                        + "DELEET UR SAVE OT NOT HVAE DA ERRRO AGAIN. HREE: <b>\n"
                                                        + Application.persistentDataPath + "/save.gd</b>\n\n"
                                                        + "OR <b>PERS R NWO</b> TO DELEET SAV N CLOSE YCF.\n\n\n"
                                                        + "IF MOAR PORBLMES, TELL EM! :D\n\n");
                        }
                        else
                        {
                            UnitaleUtil.DisplayLuaError(StaticInits.ENCOUNTER, "Have you saved on a previous or newer version of CYF? Your save isn't compatible with this version.\n\n"
                                                        + "To fix this, you must delete your save file. It can be found here: \n<b>"
                                                        + Application.persistentDataPath + "/save.gd</b>\n\n"
                                                        + "Or, you can <b>Press R now</b> to delete your save and close CYF.\n\n\n"
                                                        + "Tell me if you have any more problems, and thanks for following my fork! ^^\n\n");
                        }
                    }
                }
                else
                {
                    if (GlobalControls.input.Right == UndertaleInput.ButtonState.PRESSED || GlobalControls.input.Left == UndertaleInput.ButtonState.PRESSED)
                    {
                        setColor(choiceLetter == 2 ? 2 : (choiceLetter + 1) % 2);
                    }
                    if (GlobalControls.input.Up == UndertaleInput.ButtonState.PRESSED || GlobalControls.input.Down == UndertaleInput.ButtonState.PRESSED)
                    {
                        setColor(choiceLetter == 2 ? 0 : 2);
                    }
                    else if (GlobalControls.input.Confirm == UndertaleInput.ButtonState.PRESSED)
                    {
                        switch (choiceLetter)
                        {
                        case 0:
                            phase = -1;
                            StartCoroutine(LoadGame());
                            break;

                        case 1:
                            phase = 2;
                            GameObject.Find(firstPhaseEventNames[choiceLetter]).GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
                            GameObject.Find("CanvasReset").transform.position = new Vector3(320, 240, -500);
                            setColor(0, 2);
                            break;

                        case 2:
                            SceneManager.LoadScene("EnterName");
                            break;
                        }
                    }
                }

                break;
            }

            case 2: {
                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);
                }
                if (GlobalControls.input.Right == UndertaleInput.ButtonState.PRESSED || GlobalControls.input.Left == UndertaleInput.ButtonState.PRESSED)
                {
                    setColor((choiceLetter + 1) % 2, 2);
                }
                else if (GlobalControls.input.Confirm == UndertaleInput.ButtonState.PRESSED)
                {
                    if (choiceLetter == 1)
                    {
                        Camera.main.GetComponent <AudioSource>().Stop();
                        Camera.main.GetComponent <AudioSource>().PlayOneShot(AudioClipRegistry.GetSound("intro_holdup"));
                        phase = -1;
                        StartCoroutine(NewGame());
                    }
                    else
                    {
                        phase = 1;
                        GameObject.Find(secondPhaseEventNames[choiceLetter]).GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
                        GameObject.Find("CanvasReset").transform.position = new Vector3(320, 240, 50);
                        tmName.transform.localPosition = new Vector3(actualX, actualY, tmName.transform.localPosition.z);
                        tmName.transform.localScale    = new Vector3(1, 1, 1);
                        setColor(0);
                    }
                }

                break;
            }
            }
        }
    }