示例#1
0
        private void Start()
        {
            // The offset to give buttons to make space for the Mods button
            Vector3 buttonOffset = new Vector3(0f, -1f, 0f);

            GameUIRoot.Instance.TitleScreenUI.RootButtonsContainer.transform.GetChild(5).transform.position += buttonOffset; // Level editor button
            GameUIRoot.Instance.TitleScreenUI.RootButtonsContainer.transform.GetChild(6).transform.position += buttonOffset; // Options button
            GameUIRoot.Instance.TitleScreenUI.RootButtonsContainer.transform.GetChild(7).transform.position += buttonOffset; // Credits button
            GameUIRoot.Instance.TitleScreenUI.RootButtonsContainer.transform.GetChild(8).transform.position += buttonOffset; // Quit button

            // Copy the options button to make into the Mods button
            GameObject modsButton = GameObject.Instantiate(GameUIRoot.Instance.TitleScreenUI.RootButtonsContainer.transform.GetChild(6).gameObject, GameUIRoot.Instance.TitleScreenUI.RootButtonsContainer.transform);

            modsButton.transform.localPosition = new Vector3(0f, -146f, 0f);

            modsButton.GetComponentInChildren <Text>().text = "MODS"; // Set title

            GameObject modsWindowPrefab = AssetLoader.getObjectFromFile("modswindow", "ModsMenu", "Clone Drone in the Danger Zone_Data/");

            ModsWindow = GameObject.Instantiate(modsWindowPrefab);

            ModdedObjectModsWindow = ModsWindow.GetComponent <moddedObject>();

            ModsWindow.SetActive(false);

            modsButton.GetComponent <Button>().onClick = new Button.ButtonClickedEvent();   // This is used to remove the persistent listeners that the options button has
            modsButton.GetComponent <Button>().onClick.AddListener(OpenModsMenu);
            ((Button)ModdedObjectModsWindow.objects[1]).onClick.AddListener(CloseModsMenu); // Close menu button

            //ModsWindow.transform.GetChild(0).gameObject.GetComponent<Image>().sprite = GameUIRoot.Instance.SettingsMenu.gameObject.transform.GetChild(1).GetComponent<Image>().sprite;

            //Component[] components = GameUIRoot.Instance.SettingsMenu.gameObject.transform.GetChild(1).GetComponents(typeof(Component));

            ReloadModItems();
        }
示例#2
0
 private void CloseModsMenu()
 {
     ModsWindow.SetActive(false);
 }
示例#3
0
 private void OpenModsMenu()
 {
     ModsWindow.SetActive(true);
 }