Skip to content

Commit

Permalink
fix: compile wrong naming bug (close #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Aug 4, 2020
1 parent 8d839cb commit fbeef92
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using UnityEditor;
using UnityEngine;

public class AddressablesImporterFilterOdinHandler : ScriptableObject
public class AddressableImporterFilterOdinHandler : ScriptableObject
{
private AddressableImportSettings _importSettings;
private PropertyTree _drawerTree;
Expand All @@ -22,7 +22,7 @@ public class AddressablesImporterFilterOdinHandler : ScriptableObject
[HideLabel]
[OnValueChanged("OnFilterChanged")]
private string _searchFilter;

[SerializeField]
[ListDrawerSettings(
HideRemoveButton = true,
Expand All @@ -39,13 +39,13 @@ public void Initialize(AddressableImportSettings importSettings)
{
_importSettings = importSettings;
_drawerTree = PropertyTree.Create(this);

_filters = new List<Func<AddressableImportRule, string, bool>>() {
ValidateAddressableGroupName,
ValidateRulePath,
ValidateLabelsPath,
};

_drawerTree.OnPropertyValueChanged += (property, index) => EditorUtility.SetDirty(_importSettings);
}

Expand All @@ -64,20 +64,20 @@ public void Draw()

[Button]
public void Save() => _importSettings.Save();

[Button]
public void Documentation() => _importSettings.Documentation();

[Button]
public void CleanEmptyGroup() => _importSettings.CleanEmptyGroup();

#region private methods

private void OnFilterChanged()
{

}

private bool ValidateRule(AddressableImportRule rule,string filter)
{
return string.IsNullOrEmpty(filter) || _filters.Any(x => x(rule,filter));
Expand All @@ -87,12 +87,12 @@ private bool ValidateAddressableGroupName(AddressableImportRule rule, string fil
{
return rule.groupName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0;
}

private bool ValidateRulePath(AddressableImportRule rule, string filter)
{
return rule.path.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0;
}

private bool ValidateLabelsPath(AddressableImportRule rule, string filter)
{
return rule.labels.Any(x => x.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0);
Expand All @@ -116,21 +116,21 @@ private void ApplyChanges()
if(index < 0) continue;
_importSettings.rules[index] = rules[i];
}

}

private void CustomAddFunction()
{
_importSettings.rules.Add(new AddressableImportRule());
_sourceChanged = true;
}

private void CustomRemoveIndexFunction(int index)
{
var removeResult = _importSettings.rules.Remove(rules[index]);
_sourceChanged = true;
}

private void CustomRemoveElementFunction(AddressableImportRule item)
{
var index = rules.IndexOf(item);
Expand All @@ -156,7 +156,7 @@ private void OnPropertyChanged(InspectorProperty property, int index)
if (_importSettings == null) return;
EditorUtility.SetDirty(_importSettings);
}

#endregion
}
#endif
Expand Down
18 changes: 9 additions & 9 deletions Editor/OdinSupport/AddressableImporterOdinHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
public class AddressableImporterOdinHandler : IDisposable
{
private AddressableImportSettings _settings;
private AddressablesImporterFilterOdinHandler _importRulesContainer;
private AddressableImporterFilterOdinHandler _importRulesContainer;
private GUIContent _searchFieldLabel;
private string _searchField;

public void Initialize(AddressableImportSettings target)
{
_settings = target;
Expand All @@ -24,7 +24,7 @@ public void Initialize(AddressableImportSettings target)
public void Draw()
{
DrawInspectorTree(_searchField);

EditorUtility.SetDirty(_settings);
}

Expand All @@ -37,9 +37,9 @@ public void Dispose()
}
}

private AddressablesImporterFilterOdinHandler CreateDrawer(AddressableImportSettings settings)
private AddressableImporterFilterOdinHandler CreateDrawer(AddressableImportSettings settings)
{
_importRulesContainer = ScriptableObject.CreateInstance<AddressablesImporterFilterOdinHandler>();
_importRulesContainer = ScriptableObject.CreateInstance<AddressableImporterFilterOdinHandler>();
_importRulesContainer.Initialize(settings);
return _importRulesContainer;
}
Expand All @@ -49,13 +49,13 @@ private void DrawInspectorTree(string filter)
_importRulesContainer?.Draw();
}
}

#else

public class AddressablesImporterOdinHandler : IDisposable
public class AddressableImporterOdinHandler : IDisposable
{
public void Initialize(AddressableImportSettings target) { }
public void Initialize(AddressableImportSettings target) { }

public void Draw() { }

public void Dispose() { }
Expand Down

0 comments on commit fbeef92

Please sign in to comment.