コード例 #1
0
ファイル: GameFunction.cs プロジェクト: aa367421/1091-ICP
    public void GameOver()  //遊戲失敗函式,以ShipController呼叫
    {
        Instantiate(BoomSound);
        IsPlaying = false;
        HpText.SetActive(false);
        ReButtonSmall.SetActive(false);
        ReTextSmall.SetActive(false);
        ExitButtonSmall.SetActive(false);
        ExitTextSmall.SetActive(false);

        OverTitle.SetActive(true);
        ReButton.SetActive(true);
        ReText.SetActive(true);
        ExitButton.SetActive(true);
        ExitText.SetActive(true);
    }
コード例 #2
0
ファイル: GameFunction.cs プロジェクト: aa367421/1091-ICP
    void Succeed()   //通關函式,在通關後一小段間隔跳出通關文字
    {
        EndTime += Time.deltaTime;

        if (EndTime > 1)
        {
            ReButtonSmall.SetActive(false);
            ReTextSmall.SetActive(false);
            ExitButtonSmall.SetActive(false);
            ExitTextSmall.SetActive(false);

            GoodText.SetActive(true);
            ReButton.SetActive(true);
            ReText.SetActive(true);
            ExitButton.SetActive(true);
            ExitText.SetActive(true);
        }
    }
コード例 #3
0
    // Use this for initialization
    private void Start()
    {
        Destroy(GameObject.Find("Player"));
        Destroy(GameObject.Find("Main Camera OW"));
        Destroy(GameObject.Find("Canvas OW"));
        Destroy(GameObject.Find("Canvas Two"));
        UnitaleUtil.firstErrorShown = false;

        // Load directory info
        DirectoryInfo di          = new DirectoryInfo(Path.Combine(FileLoader.DataRoot, "Mods"));
        var           modDirsTemp = di.GetDirectories();

        // Remove mods with 0 encounters and hidden mods from the list
        List <DirectoryInfo> purged = (from modDir in modDirsTemp where new DirectoryInfo(Path.Combine(FileLoader.DataRoot, "Mods/" + modDir.Name + "/Lua/Encounters")).Exists
                                       let hasEncounters = new DirectoryInfo(Path.Combine(FileLoader.DataRoot, "Mods/" + modDir.Name + "/Lua/Encounters")).GetFiles("*.lua").Any() where hasEncounters && (modDir.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden && !modDir.Name.StartsWith("@")
                                                           select modDir).ToList();

        modDirs = purged;

        // Make sure that there is at least one playable mod present
        if (purged.Count == 0)
        {
            GlobalControls.modDev = false;
            UnitaleUtil.DisplayLuaError("loading", "<b>Your mod folder is empty!</b>\nYou need at least 1 playable mod to use the Mod Selector.\n\n"
                                        + "Remember:\n1. Mods whose names start with \"@\" do not count\n2. Folders without encounter files do not count");
            return;
        }

        modDirs.Sort((a, b) => a.Name.CompareTo(b.Name));

        // Bind button functions
        btnBack.GetComponent <Button>().onClick.RemoveAllListeners();
        btnBack.GetComponent <Button>().onClick.AddListener(() => {
            if (!animationDone)
            {
                return;
            }
            modFolderSelection();
            ScrollMods(-1);
        });
        btnNext.GetComponent <Button>().onClick.RemoveAllListeners();
        btnNext.GetComponent <Button>().onClick.AddListener(() => {
            if (!animationDone)
            {
                return;
            }
            modFolderSelection();
            ScrollMods(1);
        });

        // Give the mod list button a function
        btnList.GetComponent <Button>().onClick.RemoveAllListeners();
        btnList.GetComponent <Button>().onClick.AddListener(() => {
            if (animationDone)
            {
                modFolderMiniMenu();
            }
        });
        // Grab the exit button, and give it some functions
        btnExit.GetComponent <Button>().onClick.RemoveAllListeners();
        btnExit.GetComponent <Button>().onClick.AddListener(() => {
            SceneManager.LoadScene("Disclaimer");
            DiscordControls.StartTitle();
        });

        // Add devMod button functions
        if (GlobalControls.modDev)
        {
            btnOptions.GetComponent <Button>().onClick.RemoveAllListeners();
            btnOptions.GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("Options"); });
        }

        // Crate Your Frisk initializer
        if (GlobalControls.crate)
        {
            //Exit button
            ExitText.text   = "← BYEE";
            ExitShadow.text = ExitText.text;

            //Options button
            if (GlobalControls.modDev)
            {
                OptionsText.text   = "OPSHUNZ →";
                OptionsShadow.text = OptionsText.text;
            }

            //Back button within scrolling list
            content.transform.Find("Back/Text").GetComponent <Text>().text = "← BCAK";

            //Mod list button
            ListText.gameObject.GetComponent <Text>().text   = "MDO LITS";
            ListShadow.gameObject.GetComponent <Text>().text = "MDO LITS";
        }

        // This check will be true if we just exited out of an encounter
        // If that's the case, we want to open the encounter list so the user only has to click once to re enter
        modFolderSelection();
        if (StaticInits.ENCOUNTER != "")
        {
            //Check to see if there is more than one encounter in the mod just exited from
            List <string> encounters = new List <string>();
            DirectoryInfo di2        = new DirectoryInfo(Path.Combine(FileLoader.ModDataPath, "Lua/Encounters"));
            foreach (FileInfo f in di2.GetFiles("*.lua"))
            {
                if (encounters.Count < 2)
                {
                    encounters.Add(Path.GetFileNameWithoutExtension(f.Name));
                }
            }

            if (encounters.Count > 1)
            {
                // Highlight the chosen encounter whenever the user exits the mod menu
                int temp = selectedItem;
                encounterSelection();
                selectedItem = temp;
                content.transform.GetChild(selectedItem).GetComponent <MenuButton>().StartAnimation(1);
            }

            // Move the scrolly bit to where it was when the player entered the encounter
            content.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, encounterListScroll);

            // Start the Exit button at half transparency
            ExitButtonAlpha = 0.5f;
            ExitText.GetComponent <Text>().color   = new Color(1f, 1f, 1f, 0.5f);
            ExitShadow.GetComponent <Text>().color = new Color(0f, 0f, 0f, 0.5f);

            // Start the Options button at half transparency
            if (GlobalControls.modDev)
            {
                OptionsButtonAlpha = 0.5f;
                OptionsText.GetComponent <Text>().color   = new Color(1f, 1f, 1f, 0.5f);
                OptionsShadow.GetComponent <Text>().color = new Color(0f, 0f, 0f, 0.5f);
            }

            // Reset it to let us accurately tell if the player just came here from the Disclaimer scene or the Battle scene
            StaticInits.ENCOUNTER = "";
            // Player is coming here from the Disclaimer scene
        }
        else
        {
            // When the player enters from the Disclaimer screen, reset stored scroll positions
            modListScroll       = 0.0f;
            encounterListScroll = 0.0f;
        }
    }