Skip to content

Commit 02bd5b1

Browse files
committed
refactor: fix compile error; wrap helper class to namespace
1 parent 3170c4c commit 02bd5b1

File tree

3 files changed

+37
-33
lines changed

3 files changed

+37
-33
lines changed

Samples~/AvatarCreatorSamples/AvatarCreatorWizard/Scripts/UI/AssetButtonCreator.cs

+21-21
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void CreateColorUI(Dictionary<AssetType, AssetColor[]> colorLibrary, Acti
8383
button.SetColor(assetColor.HexColor);
8484

8585
int equippedValue = 0;
86-
if (colorAssets.TryGetValue(assetColor.AssetType, out var value))
86+
if (colorAssets.TryGetValue(assetColor.AssetType, out var value))
8787
{
8888
equippedValue = value;
8989
}
@@ -176,31 +176,31 @@ private void ConfigureOutfitSelection(AssetType category)
176176
case AssetType.Top:
177177
case AssetType.Bottom:
178178
case AssetType.Footwear:
179-
{
180-
if (selectedButtonsByCategory.TryGetValue(AssetType.Outfit, out AssetButton outfitButton))
181179
{
182-
outfitButton.SetSelect(false);
180+
if (selectedButtonsByCategory.TryGetValue(AssetType.Outfit, out AssetButton outfitButton))
181+
{
182+
outfitButton.SetSelect(false);
183+
}
184+
break;
183185
}
184-
break;
185-
}
186186
case AssetType.Outfit:
187-
{
188-
if (selectedButtonsByCategory.TryGetValue(AssetType.Top, out AssetButton topButton))
189-
{
190-
topButton.SetSelect(false);
191-
}
192-
193-
if (selectedButtonsByCategory.TryGetValue(AssetType.Bottom, out AssetButton bottomButton))
194187
{
195-
bottomButton.SetSelect(false);
188+
if (selectedButtonsByCategory.TryGetValue(AssetType.Top, out AssetButton topButton))
189+
{
190+
topButton.SetSelect(false);
191+
}
192+
193+
if (selectedButtonsByCategory.TryGetValue(AssetType.Bottom, out AssetButton bottomButton))
194+
{
195+
bottomButton.SetSelect(false);
196+
}
197+
198+
if (selectedButtonsByCategory.TryGetValue(AssetType.Footwear, out AssetButton footwearButton))
199+
{
200+
footwearButton.SetSelect(false);
201+
}
202+
break;
196203
}
197-
198-
if (selectedButtonsByCategory.TryGetValue(AssetType.Footwear, out AssetButton footwearButton))
199-
{
200-
footwearButton.SetSelect(false);
201-
}
202-
break;
203-
}
204204
}
205205
}
206206

Samples~/AvatarCreatorSamples/AvatarCreatorWizard/Scripts/UI/SelectionScreens/AvatarCreatorSelection.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private async Task LoadAvatarColors()
209209

210210
private Dictionary<AssetType, int> GetEquippedColors()
211211
{
212-
var colorAssetTypes = AssetFilterHelper.GetAssetTypesByFilter(AssetFilter.Color).ToHashSet();
212+
var colorAssetTypes = AssetTypeHelper.GetAssetTypesByFilter(AssetFilter.Color).ToHashSet();
213213
return AvatarCreatorData.AvatarProperties.Assets
214214
.Where(kvp => colorAssetTypes.Contains(kvp.Key))
215215
.ToDictionary(

Samples~/AvatarCreatorSamples/AvatarCreatorWizard/Scripts/Utils/AssetTypeHelper.cs

+15-11
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
using System.Linq;
44
using System.Reflection;
55
using ReadyPlayerMe.AvatarCreator;
6-
public static class AssetTypeHelper
6+
7+
namespace ReadyPlayerMe.Samples.AvatarCreatorWizard
78
{
8-
public static IEnumerable<AssetType> GetAssetTypesByFilter(AssetFilter filter)
9+
public static class AssetTypeHelper
910
{
10-
return Enum.GetValues(typeof(AssetType))
11-
.Cast<AssetType>()
12-
.Where(assetType =>
13-
{
14-
var fieldInfo = typeof(AssetType).GetField(assetType.ToString());
15-
var attribute = fieldInfo?.GetCustomAttribute<AssetTypeFilterAttribute>();
16-
return attribute?.filter == filter;
17-
});
11+
public static IEnumerable<AssetType> GetAssetTypesByFilter(AssetFilter filter)
12+
{
13+
return Enum.GetValues(typeof(AssetType))
14+
.Cast<AssetType>()
15+
.Where(assetType =>
16+
{
17+
var fieldInfo = typeof(AssetType).GetField(assetType.ToString());
18+
var attribute = fieldInfo?.GetCustomAttribute<AssetTypeFilterAttribute>();
19+
return attribute?.filter == filter;
20+
});
21+
}
1822
}
19-
}
23+
}

0 commit comments

Comments
 (0)