コード例 #1
0
        public override void OnInspectorGUI()
        {
            // Update
            w8Unity.EditorUpdate();

            // Get properties
            var propWizardry8Path = Prop("Wizardry8Path");

            // Browse for Wizardry8 path
            EditorGUILayout.Space();
            GUILayoutHelper.Horizontal(() =>
            {
                EditorGUILayout.LabelField(new GUIContent("Wizardry8 Path", "The local Wizardry8 path used for development only."), GUILayout.Width(EditorGUIUtility.labelWidth - 4));
                EditorGUILayout.SelectableLabel(w8Unity.Wizardry8Path, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
                if (GUILayout.Button("Browse..."))
                {
                    string path = EditorUtility.OpenFolderPanel("Locate Wizardry8 Path", "", "");
                    if (!string.IsNullOrEmpty(path))
                    {
                        if (!Wizardry8Unity.ValidateW8Path(path))
                        {
                            EditorUtility.DisplayDialog("Invalid Path", "The selected Wizardry8 path is invalid", "Close");
                        }
                        else
                        {
                            w8Unity.Wizardry8Path         = path;
                            propWizardry8Path.stringValue = path;
                            w8Unity.EditorResetW8Path();
                        }
                    }
                }
                if (GUILayout.Button("Clear"))
                {
                    w8Unity.EditorClearW8Path();
                    EditorUtility.SetDirty(target);
                }
            });

            // Prompt user to set Wizardry8 path
            if (string.IsNullOrEmpty(w8Unity.Wizardry8Path))
            {
                EditorGUILayout.HelpBox("Please set the Wizardry8 path of your Wizardry installation.", MessageType.Info);
                return;
            }

            // Display other GUI items
            //DisplayOptionsGUI();
            DisplayImporterGUI();

            // Save modified properties
            serializedObject.ApplyModifiedProperties();
            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }