示例#1
0
        protected virtual void OnEnable()
        {
            // Debug.Log("OnEnable");
            // scan the project for enumfiles generated by this Wizard
            _list = EventProxyFileFinder.FindFiles();


            ListFoldOut = EditorPrefs.GetBool(__ListFoldOutPrefKey__, true);
        }
示例#2
0
        void OnGUI_DoDefinitionForm()
        {
            Color _orig = Color.clear;

            ReBuildPreview = false;

            /*
             * if (currentFileDetails!=null)
             * {
             *      GUILayout.Label("You are editing an existing enum");
             *      FsmEditorGUILayout.Divider();
             * }
             */
            // FOLDER
            _orig = GUI.color;
            if (!currentDefinition.FolderPathValidation.success)
            {
                GUI.color = new Color(255, 165, 0);
            }
            GUILayout.Label("Project Folder: <color=#ffa500><b>" + currentDefinition.FolderPathValidation.message + "</b></color>");
            currentDefinition.FolderPath = GUILayout.TextField(currentDefinition.FolderPath);
            GUI.color = _orig;

            // NAMESPACE
            _orig = GUI.color;
            if (!currentDefinition.NameSpaceValidation.success)
            {
                GUI.color = Color.red;
            }
            GUILayout.Label("NameSpace: <color=#B20000><b>" + currentDefinition.NameSpaceValidation.message + "</b></color>");
            string _nameSpace = GUILayout.TextField(currentDefinition.NameSpace);

            GUI.color = _orig;
            if (!string.Equals(_nameSpace, currentDefinition.NameSpace))
            {
                currentDefinition.NameSpace = _nameSpace;
                ReBuildPreview = true;
            }

            // Method Name
            _orig = GUI.color;
            if (!currentDefinition.PublicMethodValidation.success)
            {
                GUI.color = Color.red;
            }
            GUILayout.Label("Public Method/Message Name: <color=#B20000><b>" + currentDefinition.PublicMethodValidation.message + "</b></color>");
            string _methodName = GUILayout.TextField(currentDefinition.PublicMethodName);

            GUI.color = _orig;
            if (!string.Equals(_methodName, currentDefinition.PublicMethodName))
            {
                currentDefinition.Name             = _methodName + "Proxy";
                currentDefinition.PublicMethodName = _methodName;
                ReBuildPreview = true;
            }

            GUILayout.Label("FileName being generated: " + currentDefinition.Name + ".cs");

            FsmEditorGUILayout.Divider();

            if (!currentDefinition.DefinitionValidation.success)
            {
                GUILayout.Label("<color=#B20000><b>" + currentDefinition.DefinitionValidation.message + "</b></color>");
            }

            if (currentDefinition.DefinitionValidation.success)
            {
                //if (_currentFileDetails!=null) GUILayout.Label(_currentFileDetails.projectPath);
                // check if this is the item we are currently editing
                string _label      = "Create";
                bool   _isUpdating = _currentFileDetails != null && (currentDefinition.FolderPath + currentDefinition.Name + ".cs").Equals(_currentFileDetails.projectPath);
                if (_isUpdating)
                {
                    _label    = "Save Modification";
                    GUI.color = Color.yellow;
                }

                if (GUILayout.Button(_label))                 // Label "Save Changes" when we detected that we are editing an existing enum
                {
                    eventProxyCreator.CreateProxy(currentDefinition);
                    _list = EventProxyFileFinder.FindFiles();
                }
                GUI.color = Color.white;

                if (_isUpdating)
                {
                    GUILayout.Label("If this component is already in use, this may break your logic.");
                }
            }
            else
            {
                Color _color = GUI.color;

                _color.a  = 0.5f;
                GUI.color = _color;
                GUILayout.Label("Fix form before saving", "Button");
                _color.a  = 1f;
                GUI.color = _color;
            }


            if (ReBuildPreview)
            {
                currentDefinition.ValidateDefinition();

                //enumCreator.BuildScriptLiteral(currentEnum);
                Repaint();
            }
        }