コード例 #1
0
        public bool OnGUI()
        {
            bool reInitialize = false;

            EditorGUILayout.HelpBox(projectSpecifier != null ? string.Format(moduleProjectSpecifierHelp, projectSpecifierModuleName) : noModuleProjectSpecifierHelp, MessageType.Info);
            GUITools.Space();

            if (projectSpecifier != null)
            {
                EditorGUILayout.LabelField("Current Module:", GUITools.boldLabel);
                EditorGUILayout.LabelField(projectSpecifierModuleName);

                if (!string.IsNullOrEmpty(exportWarnings))
                {
                    EditorGUILayout.HelpBox(exportWarnings, MessageType.Warning);
                    GUITools.Space();
                }

                GUITools.Space();

                // show export options
                EditorGUILayout.LabelField("Exporting:", GUITools.boldLabel);
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Export"))
                {
                    if (DoExport(false))
                    {
                        reInitialize = true;
                    }
                }
                if (GUILayout.Button("Export And Upgrade"))
                {
                    if (DoExport(true))
                    {
                        reInitialize = true;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                // create a new module project specifier
                if (GUILayout.Button("Create Module Project Specifier"))
                {
                    ModuleProjectSpecifier specifier = AssetTools.CreateScriptableObject <ModuleProjectSpecifier>(defaultSpecifierPath);
                    Selection.activeObject = specifier;
                    EditorGUIUtility.PingObject(specifier);
                    Debug.Log("Created Module Project Specifier at: " + defaultSpecifierPath);
                    reInitialize = true;
                }
            }
            return(reInitialize);
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (t == null)
            {
                t = target as ModuleProjectSpecifier;
            }

            if (t.workingModule != null)
            {
                string newName = EditorGUILayout.TextField("Module Name", t.workingModule.moduleName);
                if (t.workingModule.moduleName != newName)
                {
                    t.workingModule.moduleName = newName;
                    EditorUtility.SetDirty(t.workingModule);
                }
            }
        }
コード例 #3
0
        /*
         *  check and see if this project is a module project
         */
        public void InitializeModuleExporting()
        {
            projectSpecifier = null;
            exportWarnings   = "";

            List <ModuleProjectSpecifier> specifiers = AssetTools.FindAssetsByType <ModuleProjectSpecifier>(false, null);

            if (specifiers.Count == 0)
            {
                return;
            }

            projectSpecifier = specifiers[0];

            // show warning if we have more than one in the project...
            if (specifiers.Count > 1)
            {
                exportWarnings = "Found more than one ModuleProjectSpecifier in the project, using the first one located at path: " + AssetDatabase.GetAssetPath(projectSpecifier);
                Debug.LogWarning(exportWarnings);
            }
        }