private static void PaintModule(Module module)
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Module ID", EditorStyles.boldLabel);
            EditorGUILayout.LabelField(module.moduleID);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Version", EditorStyles.boldLabel);
            EditorGUILayout.LabelField(module.version.ToString());

            if (!string.IsNullOrEmpty(module.authorName) && !string.IsNullOrEmpty(module.authorMail))
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Author", EditorStyles.boldLabel);
                EditorGUILayout.LabelField(module.authorName);
                EditorGUILayout.LabelField(module.authorMail);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Description", EditorStyles.boldLabel);
            EditorGUILayout.LabelField(module.description, ModuleManagerContent.GetTextStyle());

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Tags", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            for (int i = 0; i < module.tags.Length; ++i)
            {
                GUILayout.Button(module.tags[i], EditorStyles.helpBox);
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
Exemple #2
0
        private void PaintContent()
        {
            this.PaintToolbar();
            this.contentScroll = EditorGUILayout.BeginScrollView(
                this.contentScroll,
                GUIStyle.none,
                GUI.skin.verticalScrollbar
                );

            EditorGUILayout.Space();

            ModuleManifest[] manifests = ModuleManager.GetProjectManifests();
            if (this.sidebarIndex < 0 || this.sidebarIndex >= manifests.Length)
            {
                ModuleManagerContent.PaintContentMessage();
            }
            else
            {
                ModuleManifest manifest = manifests[this.sidebarIndex];
                ModuleManagerContent.PaintProjectModule(manifest);
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndScrollView();
        }
        private void PaintContent()
        {
            this.PaintToolbar();
            this.contentScroll = EditorGUILayout.BeginScrollView(
                this.contentScroll,
                GUIStyle.none,
                GUI.skin.verticalScrollbar
                );

            EditorGUILayout.Space();
            switch (this.toolbarOptionsIndex)
            {
            case 0:
                ModuleManifest[] manifests = ModuleManager.GetProjectManifests();
                if (this.sidebarIndex < 0 || this.sidebarIndex >= manifests.Length)
                {
                    ModuleManagerContent.PaintContentMessage();
                }
                else
                {
                    ModuleManifest manifest = manifests[this.sidebarIndex];
                    ModuleManagerContent.PaintProjectModule(manifest);
                }
                break;

            case 1:
                if (ModuleManagerStore.REQUEST_STATUS == ModuleManagerStore.StoreRequestStatus.Error)
                {
                    ModuleManagerContent.PaintContentMessage(ModuleManagerStore.REQUEST_DATA.error);
                    break;
                }
                else if (ModuleManagerStore.REQUEST_STATUS == ModuleManagerStore.StoreRequestStatus.Requesting)
                {
                    ModuleManagerContent.PaintContentMessage("Loading...");
                    break;
                }

                Module[] modules = ModuleManager.GetStoreModules();
                if (this.sidebarIndex < 0 || this.sidebarIndex >= modules.Length)
                {
                    ModuleManagerContent.PaintContentMessage();
                }
                else
                {
                    Module module = modules[this.sidebarIndex];
                    ModuleManagerContent.PaintStoreModule(module);
                }
                break;
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndScrollView();
        }
        private static void PaintTitle(Module module)
        {
            EditorGUILayout.BeginHorizontal(GUILayout.Height(35));

            GUIContent content = new GUIContent(
                " " + module.displayName,
                ModuleManager.GetModuleIcon(module.moduleID)
                );

            EditorGUILayout.LabelField(content, ModuleManagerContent.GetTitleLabelStyle());

            EditorGUILayout.EndHorizontal();
        }
        private static void PaintDependencies(string title, Dependency[] dependencies)
        {
            EditorGUILayout.LabelField(
                string.Format(title, dependencies.Length),
                EditorStyles.boldLabel
                );

            if (dependencies.Length > 0)
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                for (int i = 0; i < dependencies.Length; ++i)
                {
                    ModuleManifest depManifest = ModuleManager.GetModuleManifest(
                        dependencies[i].moduleID
                        );

                    Texture2D dot = ModuleManagerContent.GetDotG();
                    if (depManifest == null)
                    {
                        dot = ModuleManagerContent.GetDotR();
                    }
                    else if (depManifest.module.version.Higher(dependencies[i].version) ||
                             !ModuleManager.IsEnabled(depManifest.module))
                    {
                        dot = ModuleManagerContent.GetDotO();
                    }

                    string depName = string.Format(
                        " {0} - {1}",
                        dependencies[i].moduleID,
                        dependencies[i].version
                        );

                    GUIContent depContent = new GUIContent(depName, dot);
                    EditorGUILayout.LabelField(depContent);

                    Rect depRect = GUILayoutUtility.GetLastRect();
                    EditorGUIUtility.AddCursorRect(depRect, MouseCursor.Link);
                    if (UnityEngine.Event.current.type == EventType.MouseUp &&
                        depRect.Contains(UnityEngine.Event.current.mousePosition))
                    {
                        Application.OpenURL(string.Format(
                                                "https://store.gamecreator.io/?search={0}",
                                                dependencies[i].moduleID
                                                ));
                    }
                }
                EditorGUILayout.EndVertical();
            }
        }
        public static void PaintStoreModule(Module module)
        {
            ModuleManagerContent.PaintTitle(module);

            EditorGUILayout.BeginHorizontal(ModuleManagerContent.GetPanelStyle());
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Download", ModuleManagerContent.GetLargeButtonStyle()))
            {
                ModuleManager.OpenStoreSearch(module.moduleID);
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            ModuleManagerContent.PaintModule(module);
        }
        // PAINT METHODS: -------------------------------------------------------------------------

        public static void PaintProjectModule(ModuleManifest manifest)
        {
            if (CURRENT_MODULE_ID != manifest.module.moduleID)
            {
                ModuleManagerContent.InitializeModule(manifest);
                CURRENT_MODULE_ID = manifest.module.moduleID;
            }

            bool        isEnabled         = ModuleManager.IsEnabled(manifest.module);
            bool        updateAvail       = ModuleManager.IsUpdateAvailable(manifest);
            bool        assetModuleExists = ModuleManager.AssetModuleExists(manifest.module);
            AssetModule assetModule       = ModuleManager.GetAssetModule(manifest.module.moduleID);

            ModuleManagerContent.PaintTitle(manifest.module);

            EditorGUILayout.BeginHorizontal(ModuleManagerContent.GetPanelStyle());
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Backup", ModuleManagerContent.GetLargeButtonStyle()))
            {
                ModuleManager.Backup(manifest);
            }

            EditorGUILayout.Space();
            EditorGUI.BeginDisabledGroup(!isEnabled || !updateAvail);
            if (GUILayout.Button("Update", ModuleManagerContent.GetLargeButtonLeft()))
            {
                ModuleManager.Update(manifest);
            }
            EditorGUI.EndDisabledGroup();

            if (!isEnabled && GUILayout.Button("Enable", ModuleManagerContent.GetLargeButtonMid()))
            {
                ModuleManager.Enable(manifest);
            }

            if (isEnabled && GUILayout.Button("Disable", ModuleManagerContent.GetLargeButtonMid()))
            {
                ModuleManager.Disable(manifest);
            }

            EditorGUI.BeginDisabledGroup(!assetModuleExists || isEnabled);
            if (GUILayout.Button("Remove", ModuleManagerContent.GetLargeButtonRight()))
            {
                ModuleManager.Remove(manifest);
            }
            EditorGUI.EndDisabledGroup();

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            ModuleManagerContent.PaintModule(manifest.module);

            EditorGUILayout.Space();
            ModuleManagerContent.PaintDependencies(
                "Dependencies ({0})",
                manifest.module.dependencies
                );

            if (updateAvail && assetModule != null)
            {
                EditorGUILayout.Space();
                ModuleManagerContent.PaintDependencies(
                    "Update Dependencies ({0})",
                    assetModule.module.dependencies
                    );
            }
        }