Beispiel #1
0
        private void GUIModulesInstalation()
        {
            if (ModuleHandler.GetModules() == null)
            {
                return;
            }
            if (ModuleHandler.GetModules().Count > 0)
            {
                GUILayout.Label(Locale.editor.Get("header_modules"), EditorStyles.boldLabel);
            }
            bool disabled = false;

            foreach (Module module in ModuleHandler.GetModules())
            {
                if (module.is_being_installed_or_removed)
                {
                    disabled = true;
                }
            }
            EditorGUI.BeginDisabledGroup(disabled);
            foreach (Module module in ModuleHandler.GetModules())
            {
                ModuleUI(module);
            }
            GUILayout.Label(Locale.editor.Get("header_thrird_party"), EditorStyles.boldLabel);
            foreach (Module module in ModuleHandler.GetThirdPartyModules())
            {
                ModuleUI(module);
            }
            EditorGUI.EndDisabledGroup();
        }
Beispiel #2
0
        private void GUIModulesInstalation()
        {
            if (ModuleHandler.GetModules() == null)
            {
                return;
            }
            if (ModuleHandler.GetModules().Count > 0)
            {
                GUILayout.Label("Extra Modules", EditorStyles.boldLabel);
            }
            bool disabled = false;

            foreach (ModuleHeader module in ModuleHandler.GetModules())
            {
                if (module.is_being_installed_or_removed)
                {
                    disabled = true;
                }
            }
            EditorGUI.BeginDisabledGroup(disabled);
            foreach (ModuleHeader module in ModuleHandler.GetModules())
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(!module.available_requirement_fullfilled);
                EditorGUI.BeginChangeCheck();
                bool is_installed     = Helper.ClassExists(module.available_module.classname);
                bool update_available = is_installed;
                if (module.installed_module != null)
                {
                    update_available = Helper.compareVersions(module.installed_module.version, module.available_module.version) == 1;
                }
                string displayName = module.available_module.name;
                if (module.installed_module != null)
                {
                    displayName += " v" + module.installed_module.version;
                }

                bool install = GUILayout.Toggle(is_installed, new GUIContent(displayName, module.available_module.description), GUILayout.ExpandWidth(false));
                if (EditorGUI.EndChangeCheck())
                {
                    ModuleHandler.InstallRemoveModule(module, install);
                }
                if (update_available)
                {
                    if (GUILayout.Button("update to v" + module.available_module.version, GUILayout.ExpandWidth(false)))
                    {
                        ModuleHandler.UpdateModule(module);
                    }
                }
                EditorGUI.EndDisabledGroup();
                if (module.available_module.requirement != null && (update_available || !is_installed))
                {
                    GUIStyle requirementStyle = new GUIStyle(EditorStyles.label);
                    requirementStyle.normal.textColor = greenStyle.normal.textColor;
                    if (!module.available_requirement_fullfilled)
                    {
                        requirementStyle.normal.textColor = redInfostyle.normal.textColor;
                    }
                    GUILayout.Label("Requirements: " + module.available_module.requirement.ToString(), requirementStyle);
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUI.EndDisabledGroup();
        }