Пример #1
0
        public void OnAutoSetValue()
        {
            object     value = customizeData.getInstance();
            GameObject root  = behaviour.gameObject;

            if (wxb.Editor.TypeEditor.OnAutoSetValue(value, root))
            {
                RegisterCompleteObjectUndo();

                EditorUtility.SetDirty(behaviour);
                EditorUtility.SetDirty(behaviour.gameObject);
                customizeData.OnBeforeSerialize();
            }
        }
Пример #2
0
        public void OnGUI(string newTypename)
        {
            if (newTypename == null)
            {
                newTypename = string.Empty;
            }

            string typeName = customizeData.TypeName;

            if (!string.Equals(newTypename, typeName))
            {
                RegisterCompleteObjectUndo();

                customizeData.OnTypeChange(newTypename);

                EditorUtility.SetDirty(behaviour);
            }

            if (string.IsNullOrEmpty(typeName))
            {
                return;
            }

            var type = Help.GetType(newTypename);

            if (type == null)
            {
                EditorGUILayout.LabelField(string.Format("类型:{0},查找失败!", newTypename));
                return;
            }

            object instance = customizeData.getInstance();

            if (instance == null)
            {
                ((CustomizeData)customizeData).OnAfterDeserialize(behaviour);
                return;
            }

            if (wxb.Editor.TypeEditor.OnGUI(instance))
            {
                EditorUtility.SetDirty(behaviour);
                EditorUtility.SetDirty(behaviour.gameObject);
                ((CustomizeData)customizeData).OnBeforeSerialize();
                RegisterCompleteObjectUndo();
            }
        }