Exemplo n.º 1
0
        public void CreateSettingsUI()
        {
            AssetBundle ab = LoadAssets.LoadBundle(this, "settingsui.unity3d");

            UI = ab.LoadAsset <GameObject>("MSCLoader Settings.prefab");

            ModButton         = ab.LoadAsset <GameObject>("ModButton.prefab");
            ModButton_Invalid = ab.LoadAsset <GameObject>("ModButton_Invalid.prefab");

            ModLabel = ab.LoadAsset <GameObject>("ModViewLabel.prefab");

            KeyBind = ab.LoadAsset <GameObject>("KeyBind.prefab");

            //For mod settings
            Checkbox = ab.LoadAsset <GameObject>("Checkbox.prefab");
            setBtn   = ab.LoadAsset <GameObject>("Button.prefab");
            slider   = ab.LoadAsset <GameObject>("Slider.prefab");
            textBox  = ab.LoadAsset <GameObject>("TextBox.prefab");
            header   = ab.LoadAsset <GameObject>("Header.prefab");

            UI = GameObject.Instantiate(UI);
            UI.AddComponent <ModUIDrag>();

            settings    = UI.AddComponent <SettingsView>();
            settings.ms = this;
            settings.settingViewContainer = UI.transform.GetChild(0).gameObject;
            settings.modList = settings.settingViewContainer.transform.GetChild(3).gameObject;
            settings.modView = settings.modList.transform.GetChild(0).gameObject;
            settings.modInfo = settings.settingViewContainer.transform.GetChild(2).gameObject;
            GameObject ModSettingsView = settings.modInfo.transform.GetChild(0).gameObject;

            settings.ModKeyBinds     = settings.settingViewContainer.transform.GetChild(1).gameObject;
            settings.keybindsList    = settings.ModKeyBinds.transform.GetChild(0).GetChild(4).gameObject;
            settings.modSettings     = settings.settingViewContainer.transform.GetChild(4).gameObject;
            settings.modSettingsList = settings.modSettings.transform.GetChild(0).GetChild(4).gameObject;
            settings.coreModCheckbox = settings.settingViewContainer.transform.GetChild(6).GetChild(0).GetComponent <Toggle>();
            settings.coreModCheckbox.onValueChanged.AddListener(delegate { settings.ToggleCoreCheckbox(); });
            settings.noOfMods  = settings.settingViewContainer.transform.GetChild(6).GetChild(1).GetComponent <Text>();
            settings.goBackBtn = settings.settingViewContainer.transform.GetChild(0).GetChild(1).gameObject;
            settings.goBackBtn.GetComponent <Button>().onClick.AddListener(() => settings.goBack());
            settings.settingViewContainer.transform.GetChild(0).GetChild(2).GetComponent <Button>().onClick.AddListener(() => settings.setVisibility(false));
            settings.DisableMod = ModSettingsView.transform.GetChild(5).GetComponent <Toggle>();
            settings.DisableMod.onValueChanged.AddListener(settings.disableMod);

            settings.IDtxt      = ModSettingsView.transform.GetChild(0).GetComponent <Text>();
            settings.Nametxt    = ModSettingsView.transform.GetChild(1).GetComponent <Text>();
            settings.Versiontxt = ModSettingsView.transform.GetChild(2).GetComponent <Text>();
            settings.Authortxt  = ModSettingsView.transform.GetChild(3).GetComponent <Text>();

            UI.transform.SetParent(GameObject.Find("MSCLoader Canvas").transform, false);
            settings.setVisibility(false);
            ab.Unload(false);
        }
Exemplo n.º 2
0
        public void CreateSettingsUI()
        {
            AssetBundle ab = LoadAssets.LoadBundle(this, "settingsui.unity3d");

            UI = ab.LoadAsset <GameObject>("MSCLoader Settings.prefab");

            ModButton         = ab.LoadAsset <GameObject>("ModButton.prefab");
            ModButton_Invalid = ab.LoadAsset <GameObject>("ModButton_Invalid.prefab");

            ModLabel = ab.LoadAsset <GameObject>("ModViewLabel.prefab");

            KeyBind = ab.LoadAsset <GameObject>("KeyBind.prefab");

            Button_ms = ab.LoadAsset <GameObject>("Button_ms.prefab");
            // For mod settings
            Checkbox = ab.LoadAsset <GameObject>("Checkbox.prefab");
            setBtn   = ab.LoadAsset <GameObject>("Button.prefab");
            slider   = ab.LoadAsset <GameObject>("Slider.prefab");
            textBox  = ab.LoadAsset <GameObject>("TextBox.prefab");
            header   = ab.LoadAsset <GameObject>("Header.prefab");

            UI = GameObject.Instantiate(UI);
            UI.AddComponent <ModUIDrag>();
            UI.name = "MSCLoader Settings";

            settings    = UI.AddComponent <SettingsView>();
            settings.ms = this;
            settings.settingViewContainer = UI.transform.GetChild(0).gameObject;
            settings.modList =
                settings.settingViewContainer.transform.GetChild(3).gameObject;
            settings.modView = settings.modList.transform.GetChild(0).gameObject;
            settings.modInfo =
                settings.settingViewContainer.transform.GetChild(2).gameObject;
            GameObject ModSettingsView = settings.modInfo.transform.GetChild(0).gameObject;

            settings.ModKeyBinds =
                settings.settingViewContainer.transform.GetChild(1).gameObject;
            settings.keybindsList =
                settings.ModKeyBinds.transform.GetChild(0).GetChild(4).gameObject;
            settings.modSettings =
                settings.settingViewContainer.transform.GetChild(4).gameObject;
            settings.modSettingsList =
                settings.modSettings.transform.GetChild(0).GetChild(4).gameObject;
            settings.coreModCheckbox = settings.settingViewContainer.transform.GetChild(6)
                                       .GetChild(0)
                                       .GetComponent <Toggle>();
            settings.coreModCheckbox.onValueChanged.AddListener(
                delegate { settings.ToggleCoreCheckbox(); });
            settings.noOfMods = settings.settingViewContainer.transform.GetChild(6)
                                .GetChild(1)
                                .GetComponent <Text>();
            settings.goBackBtn =
                settings.settingViewContainer.transform.GetChild(0).GetChild(1).gameObject;
            settings.goBackBtn.GetComponent <Button>().onClick.AddListener(
                () => settings.goBack());
            settings.settingViewContainer.transform.GetChild(0)
            .GetChild(2)
            .GetComponent <Button>()
            .onClick.AddListener(() => settings.toggleVisibility());
            settings.DisableMod =
                ModSettingsView.transform.GetChild(2).GetComponent <Toggle>();
            settings.DisableMod.onValueChanged.AddListener(settings.disableMod);

            settings.InfoTxt        = ModSettingsView.transform.GetChild(0).GetComponent <Text>();
            settings.descriptionTxt =
                ModSettingsView.transform.GetChild(8).GetComponent <Text>();

            settings.nexusLink =
                ModSettingsView.transform.GetChild(4).GetComponent <Button>();
            settings.rdLink = ModSettingsView.transform.GetChild(5).GetComponent <Button>();
            settings.ghLink = ModSettingsView.transform.GetChild(6).GetComponent <Button>();

            UI.transform.SetParent(ModUI.GetCanvas().transform, false);
            settings.SetVisibility(false);
            Button_ms      = GameObject.Instantiate(Button_ms);
            Button_ms.name = "MSCLoader Settings button";
            Button_ms.transform.SetParent(ModUI.GetCanvas().transform, false);
            Button_ms.GetComponent <Button>().onClick.AddListener(
                () => settings.toggleVisibility());
            Button_ms.SetActive(true);
            if (!(bool)modSetButton.GetValue())
            {
                Button_ms.SetActive(false);
            }
            ab.Unload(false);
        }