Skip to content

Commit af7fbfc

Browse files
authored
Merge pull request #78 from CyberAgentGameEntertainment/feature/group-based-filter
「アドレス」や「Addressableのグループ」を基にラベルやバージョンを振れるように
2 parents eb0e722 + 2b1cfe7 commit af7fbfc

94 files changed

Lines changed: 2278 additions & 139 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/Development/Editor/Core/Tools/Addresser/Shared/AssetGroups/AssetGroupPanelDevelopmentWindow.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ private void OnEnable()
2626
_groupCollection.Add(new AssetGroup());
2727

2828
_view = new AssetGroupPanelView();
29-
_presenter = new AssetGroupPanelPresenter(_view, _history, _assetSaveService);
29+
// Use Address rule type for development window
30+
_presenter = new AssetGroupPanelPresenter(_view, _history, _assetSaveService, RuleType.Address);
3031
_presenter.SetupView(_groupCollection, 0);
3132
}
3233

Assets/SmartAddresser/Editor/Core/Models/LayoutRules/AddressRules/AddressRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public bool TryProvideAddress(
122122
return false;
123123
}
124124

125-
if (!_assetGroups.Contains(assetPath, assetType, isFolder))
125+
if (!_assetGroups.Contains(assetPath, assetType, isFolder, null, null))
126126
{
127127
address = null;
128128
return false;
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
using SmartAddresser.Editor.Core.Models.Shared;
1+
using System;
22

33
namespace SmartAddresser.Editor.Core.Models.LayoutRules.AddressRules
44
{
55
/// <summary>
66
/// Provide addresses from asset information.
77
/// </summary>
8-
public interface IAddressProvider : IProvider<string>
8+
public interface IAddressProvider
99
{
10+
void Setup();
11+
12+
string Provide(string assetPath, Type assetType, bool isFolder);
13+
14+
string GetDescription();
1015
}
1116
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using SmartAddresser.Editor.Core.Models.Shared;
3+
using UnityEditor.AddressableAssets.Settings;
4+
5+
namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
6+
{
7+
/// <summary>
8+
/// Provide the label based on the addressable entry's address.
9+
/// </summary>
10+
[Serializable]
11+
public sealed class AddressBasedLabelProvider : AddressBasedProvider, ILabelProvider
12+
{
13+
void ILabelProvider.Setup()
14+
{
15+
base.Setup();
16+
}
17+
18+
string ILabelProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
19+
AddressableAssetGroup addressableAssetGroup)
20+
{
21+
return base.Provide(address);
22+
}
23+
24+
string ILabelProvider.GetDescription()
25+
{
26+
return base.GetDescription();
27+
}
28+
}
29+
}

Assets/SmartAddresser/Editor/Core/Models/Shared/IProvider.cs.meta renamed to Assets/SmartAddresser/Editor/Core/Models/LayoutRules/LabelRules/AddressBasedLabelProvider.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using SmartAddresser.Editor.Core.Models.Shared;
3+
using UnityEditor.AddressableAssets.Settings;
4+
5+
namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
6+
{
7+
/// <summary>
8+
/// Provide the label based on the addressable asset group name.
9+
/// </summary>
10+
[Serializable]
11+
public sealed class AddressableAssetGroupNameBasedLabelProvider : AddressableAssetGroupNameBasedProvider,
12+
ILabelProvider
13+
{
14+
void ILabelProvider.Setup()
15+
{
16+
base.Setup();
17+
}
18+
19+
string ILabelProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
20+
AddressableAssetGroup addressableAssetGroup)
21+
{
22+
if (addressableAssetGroup == null)
23+
return null;
24+
25+
return base.Provide(addressableAssetGroup.Name);
26+
}
27+
28+
string ILabelProvider.GetDescription()
29+
{
30+
return base.GetDescription();
31+
}
32+
}
33+
}

Assets/SmartAddresser/Editor/Core/Models/LayoutRules/LabelRules/AddressableAssetGroupNameBasedLabelProvider.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SmartAddresser/Editor/Core/Models/LayoutRules/LabelRules/AssetPathBasedLabelProvider.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using SmartAddresser.Editor.Core.Models.Shared;
3+
using UnityEditor.AddressableAssets.Settings;
34

45
namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
56
{
@@ -9,5 +10,20 @@ namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
910
[Serializable]
1011
public sealed class AssetPathBasedLabelProvider : AssetPathBasedProvider, ILabelProvider
1112
{
13+
void ILabelProvider.Setup()
14+
{
15+
base.Setup();
16+
}
17+
18+
string ILabelProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
19+
AddressableAssetGroup addressableAssetGroup)
20+
{
21+
return base.Provide(assetPath, assetType, isFolder);
22+
}
23+
24+
string ILabelProvider.GetDescription()
25+
{
26+
return base.GetDescription();
27+
}
1228
}
1329
}

Assets/SmartAddresser/Editor/Core/Models/LayoutRules/LabelRules/ConstantLabelProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using SmartAddresser.Editor.Core.Models.Shared;
2+
using UnityEditor.AddressableAssets.Settings;
33
using UnityEngine;
44

55
namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
@@ -18,11 +18,11 @@ public string Label
1818
set => _label = value;
1919
}
2020

21-
void IProvider<string>.Setup()
21+
public void Setup()
2222
{
2323
}
2424

25-
string IProvider<string>.Provide(string assetPath, Type assetType, bool isFolder)
25+
public string Provide(string assetPath, Type assetType, bool isFolder, string address, AddressableAssetGroup addressableAssetGroup)
2626
{
2727
if (string.IsNullOrEmpty(_label))
2828
return null;

Assets/SmartAddresser/Editor/Core/Models/LayoutRules/LabelRules/CustomLabelProvider.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using UnityEditor.AddressableAssets.Settings;
23

34
namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
45
{
@@ -15,12 +16,12 @@ public void Setup()
1516
labelProvider.Setup();
1617
}
1718

18-
public string Provide(string assetPath, Type assetType, bool isFolder)
19+
public string Provide(string assetPath, Type assetType, bool isFolder, string address, AddressableAssetGroup addressableAssetGroup)
1920
{
2021
if (labelProvider == null)
2122
return null;
2223

23-
return labelProvider.Provide(assetPath, assetType, isFolder);
24+
return labelProvider.Provide(assetPath, assetType, isFolder, address, addressableAssetGroup);
2425
}
2526

2627
public string GetDescription()

0 commit comments

Comments
 (0)