浏览代码

Updated NaughtyAttributes to b933f7e - Apr 21 2019

/main
Thomas ICHÉ 5 年前
当前提交
c080b085
共有 22 个文件被更改,包括 221 次插入51 次删除
  1. 3
      Editor/GameplayIngredients-Editor.asmdef
  2. 2
      NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs
  3. 2
      NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs
  4. 17
      NaughtyAttributes/Editor/Editors/InspectorEditor.cs
  5. 11
      NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs
  6. 11
      Runtime/GameplayIngredients.asmdef
  7. 18
      NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs
  8. 11
      NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs.meta
  9. 12
      NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs
  10. 11
      NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs.meta
  11. 12
      NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef
  12. 7
      NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef.meta
  13. 16
      NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef
  14. 7
      NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef.meta
  15. 16
      NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs
  16. 11
      NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs.meta
  17. 56
      NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs
  18. 11
      NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta
  19. 8
      NaughtyAttributes/Core/NaughtyAttributes.asmdef
  20. 7
      NaughtyAttributes/Core/NaughtyAttributes.asmdef.meta
  21. 16
      NaughtyAttributes/Editor/NaughtyAttributes-Editor.asmdef
  22. 7
      NaughtyAttributes/Editor/NaughtyAttributes-Editor.asmdef.meta

3
Editor/GameplayIngredients-Editor.asmdef


{
"name": "GameplayIngredients-Editor",
"references": [
"NaughtyAttributes",
"NaughtyAttributes.Core",
"NaughtyAttributes>Editor",
"GameplayIngredients",
"Unity.ugui",
"Unity.Timeline"

2
NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs


private static readonly string DRAW_CONDITION_ENTRY_FORMAT = "drawConditionsByAttributeType[typeof({0})] = new {1}();" + Environment.NewLine;
//[UnityEditor.Callbacks.DidReloadScripts]
//[MenuItem("Tools/NaughtyAttributes/Update Attributes Database")]
[MenuItem("Tools/NaughtyAttributes/Update Attributes Database")]
private static void GenerateCode()
{
GenerateScript<PropertyMeta, PropertyMetaAttribute>("PropertyMetaDatabase", "PropertyMetaDatabaseTemplate", META_ENTRY_FORMAT);

2
NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs


drawersByAttributeType[typeof(DisableIfAttribute)] = new DisableIfPropertyDrawer();
drawersByAttributeType[typeof(DropdownAttribute)] = new DropdownPropertyDrawer();
drawersByAttributeType[typeof(EnableIfAttribute)] = new EnableIfPropertyDrawer();
drawersByAttributeType[typeof(LabelAttribute)] = new LabelPropertyDrawer();
drawersByAttributeType[typeof(MinMaxSliderAttribute)] = new MinMaxSliderPropertyDrawer();
drawersByAttributeType[typeof(ProgressBarAttribute)] = new ProgressBarPropertyDrawer();
drawersByAttributeType[typeof(ReadOnlyAttribute)] = new ReadOnlyPropertyDrawer();

drawersByAttributeType[typeof(SliderAttribute)] = new SliderPropertyDrawer();
drawersByAttributeType[typeof(TagAttribute)] = new TagPropertyDrawer();
}

17
NaughtyAttributes/Editor/Editors/InspectorEditor.cs


private void ValidateAndDrawField(FieldInfo field)
{
if (!ShouldDrawField(field))
{
return;
}
this.ValidateField(field);
this.ApplyFieldMeta(field);
this.DrawField(field);

}
}
private void DrawField(FieldInfo field)
private bool ShouldDrawField(FieldInfo field)
{
// Check if the field has draw conditions
PropertyDrawCondition drawCondition = this.GetPropertyDrawConditionForField(field);

if (!canDrawProperty)
{
return;
return false;
}
}

{
return;
return false;
// Draw the field
return true;
}
private void DrawField(FieldInfo field)
{
EditorGUI.BeginChangeCheck();
PropertyDrawer drawer = this.GetPropertyDrawerForField(field);
if (drawer != null)

11
NaughtyAttributes/Editor/PropertyDrawers/Reorder