Exemplo n.º 1
0
        protected bool Enable(bool force = false)
        {
            try
            {
                if (!force)
                {
                    switch (target)
                    {
                    case MonoBehaviour monoBehaviour when Selection.activeObject != monoBehaviour.gameObject:
                    case ScriptableObject _ when Selection.activeObject != target:
                        return(false);
                    }
                }

                m_drawer = new MightyDrawer();
                m_drawer.OnEnableMonoScript(target, serializedObject);
            }
            catch (Exception ex)
            {
                if (ex.GetType().Name != "SerializedObjectNotCreatableException")
                {
                    // This is a terrible fix, but it'll be enough until I find what's actually triggering this...
                    // It might have to do with additive scenes or prefabs
                    Debug.LogException(ex);
                }

                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
 public MightyContext(MightyDrawer drawer, Object obj, SerializedProperty scriptProperty, object target)
 {
     Object         = obj;
     ScriptProperty = scriptProperty;
     Target         = target;
     Drawer         = drawer;
 }
Exemplo n.º 3
0
        public override void OnInspectorAbort(MightyDrawer drawer)
        {
            if (!MightyEditorUtilities.HasEditorChanged() || drawer == null)
            {
                return;
            }

            drawer.ApplyAutoValues();
            drawer.RefreshAllDrawers();
        }
Exemplo n.º 4
0
        public override void OnInspectorAbort(MightyDrawer drawer)
        {
            if (MightyEditorUtilities.HasEditorChanged() && drawer != null)
            {
                drawer.ApplyAutoValues();
                drawer.RefreshAllDrawers();
            }

            GUILayout.BeginVertical();
        }
Exemplo n.º 5
0
 private void Enable()
 {
     m_drawer = new MightyDrawer();
     try
     {
         m_drawer.OnEnableMonoScript(target, serializedObject);
     }
     catch
     {
         // ignored
     }
 }
Exemplo n.º 6
0
 private void Enable()
 {
     m_drawer = new MightyDrawer();
     try
     {
         m_drawer.OnEnableWindow(this);
     }
     catch
     {
         // ignored
     }
 }
Exemplo n.º 7
0
        public static object[] GetAttributes(this SerializedProperty property, Type attributeType)
        {
            var fieldInfo = ReflectionUtility.GetField(property.GetSerializableClassProperty(out var name)?.GetSystemType() ??
                                                       property.GetTargetObject().GetType(), name);

            if (fieldInfo == null)
            {
                return(new object[0]);
            }

            var attributesList = new List <object>();
            var attributes     = fieldInfo.GetCustomAttributes(attributeType, true);

            if (attributes.Length > 0)
            {
                attributesList.AddRange(attributes);
            }

            var customWrapperDrawer = new MightyWrapperDrawer();

            attributesList.AddRange(MightyDrawer.GetAttributesFromCustomWrappers(attributeType, fieldInfo, customWrapperDrawer));

            return(attributesList.ToArray());
        }
Exemplo n.º 8
0
 private void Disable()
 {
     m_drawer?.OnDisable();
     m_drawer = null;
     DrawersDatabase.ClearCache();
 }
Exemplo n.º 9
0
        public override void OnEnableClass(SerializedProperty script, Object context, BaseClassAttribute attribute, MightyDrawer drawer)
        {
            var hideStatusAttribute = (HideStatusClassAttribute)attribute;

            drawer.hideStatus |= hideStatusAttribute.HideStatus;
        }
Exemplo n.º 10
0
 public override void EndDrawClass(SerializedProperty script, Object context, BaseClassAttribute attribute, MightyDrawer drawer)
 {
 }
Exemplo n.º 11
0
 public abstract void OnDisableClass(SerializedProperty script, Object context, BaseClassAttribute attribute, MightyDrawer drawer);
Exemplo n.º 12
0
 protected void Disable()
 {
     m_drawer?.OnDisable();
     m_drawer = null;
     MightyDrawersDatabase.ClearCachesNotOfTypes(typeof(BaseHierarchyAttribute), typeof(BaseReloadScriptsAttribute));
 }
Exemplo n.º 13
0
 public abstract void OnInspectorAbort(MightyDrawer drawer);