-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2582 from decentraland/dev
release: 24-10-24 (v39)
- Loading branch information
Showing
53 changed files
with
567 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
Explorer/Assets/DCL/AvatarRendering/Wearables/ApplicationParametersWearablesProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using Arch.Core; | ||
using CommunicationData.URLHelpers; | ||
using Cysharp.Threading.Tasks; | ||
using DCL.AvatarRendering.Loading.Components; | ||
using DCL.AvatarRendering.Wearables.Components; | ||
using DCL.AvatarRendering.Wearables.Helpers; | ||
using ECS.Prioritization.Components; | ||
using ECS.StreamableLoading.Common; | ||
using Global.AppArgs; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
using WearablePromise = ECS.StreamableLoading.Common.AssetPromise<DCL.AvatarRendering.Wearables.Components.WearablesResolution, | ||
DCL.AvatarRendering.Wearables.Components.Intentions.GetWearablesByPointersIntention>; | ||
|
||
namespace DCL.AvatarRendering.Wearables | ||
{ | ||
public class ApplicationParametersWearablesProvider : IWearablesProvider | ||
{ | ||
private readonly IAppArgs applicationParametersParser; | ||
private readonly IWearablesProvider source; | ||
private readonly World world; | ||
private readonly string[] allWearableCategories = WearablesConstants.CATEGORIES_PRIORITY.ToArray(); | ||
private readonly List<IWearable> resultWearablesBuffer = new (); | ||
|
||
public ApplicationParametersWearablesProvider(IAppArgs applicationParametersParser, | ||
IWearablesProvider source, | ||
World world) | ||
{ | ||
this.applicationParametersParser = applicationParametersParser; | ||
this.source = source; | ||
this.world = world; | ||
} | ||
|
||
public async UniTask<(IReadOnlyList<IWearable> results, int totalAmount)> GetAsync(int pageSize, int pageNumber, CancellationToken ct, | ||
IWearablesProvider.SortingField sortingField = IWearablesProvider.SortingField.Date, | ||
IWearablesProvider.OrderBy orderBy = IWearablesProvider.OrderBy.Descending, | ||
string? category = null, | ||
IWearablesProvider.CollectionType collectionType = IWearablesProvider.CollectionType.All, | ||
string? name = null, | ||
List<IWearable>? results = null) | ||
{ | ||
if (!applicationParametersParser.TryGetValue("self-preview-wearables", out string? wearablesCsv)) | ||
return await source.GetAsync(pageSize, pageNumber, ct, sortingField, orderBy, category, collectionType, name, results); | ||
|
||
URN[] pointers = wearablesCsv!.Split(',', StringSplitOptions.RemoveEmptyEntries) | ||
.Select(s => new URN(s)).ToArray(); | ||
|
||
IReadOnlyCollection<IWearable>? maleWearables = await RequestPointersAsync(pointers, BodyShape.MALE, ct); | ||
IReadOnlyCollection<IWearable>? femaleWearables = await RequestPointersAsync(pointers, BodyShape.FEMALE, ct); | ||
|
||
lock (resultWearablesBuffer) | ||
{ | ||
resultWearablesBuffer.Clear(); | ||
|
||
if (maleWearables != null) | ||
resultWearablesBuffer.AddRange(maleWearables); | ||
|
||
if (femaleWearables != null) | ||
resultWearablesBuffer.AddRange(femaleWearables); | ||
|
||
int pageIndex = pageNumber - 1; | ||
return (resultWearablesBuffer.Skip(pageIndex * pageSize).Take(pageSize).ToArray(), resultWearablesBuffer.Count); | ||
} | ||
} | ||
|
||
private async UniTask<IReadOnlyCollection<IWearable>?> RequestPointersAsync(IReadOnlyCollection<URN> pointers, | ||
BodyShape bodyShape, | ||
CancellationToken ct) | ||
{ | ||
var promise = WearablePromise.Create(world, | ||
// We pass all categories as force renderer to force the download of all of them | ||
// Otherwise they will be skipped if any wearable is hiding the category | ||
WearableComponentsUtils.CreateGetWearablesByPointersIntention(bodyShape, pointers, allWearableCategories), | ||
PartitionComponent.TOP_PRIORITY); | ||
|
||
promise = await promise.ToUniTaskAsync(world, cancellationToken: ct); | ||
|
||
if (!promise.TryGetResult(world, out var result)) | ||
return null; | ||
|
||
if (!result.Succeeded) | ||
return null; | ||
|
||
return result.Asset.Wearables; | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Explorer/Assets/DCL/AvatarRendering/Wearables/ApplicationParametersWearablesProvider.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
68 changes: 34 additions & 34 deletions
68
Explorer/Assets/DCL/AvatarRendering/Wearables/Wearables.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
{ | ||
"name": "Wearables", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:9e314663ce958b746873cb22d57ede55", | ||
"GUID:f51ebe6a0ceec4240a699833d6309b23", | ||
"GUID:286980af24684da6acc1caa413039811", | ||
"GUID:1b8e1e1bd01505f478f0369c04a4fb2f", | ||
"GUID:fa7b3fdbb04d67549916da7bd2af58ab", | ||
"GUID:101b8b6ebaf64668909b49c4b7a1420d", | ||
"GUID:3c7b57a14671040bd8c549056adc04f5", | ||
"GUID:e0eedfa2deb9406daf86fd8368728e39", | ||
"GUID:8322ea9340a544c59ddc56d4793eac74", | ||
"GUID:4794e238ed0f65142a4aea5848b513e5", | ||
"GUID:3640f3c0b42946b0b8794a1ed8e06ca5", | ||
"GUID:275e22790c04e9b47a5085d7b0c4432a", | ||
"GUID:4a12c0b1b77ec6b418a8d7bd5c925be3", | ||
"GUID:b46779583a009f04ba9f5f31d0e7e6ac", | ||
"GUID:56e8195b069a4dca9c4c4f313c65f526", | ||
"GUID:e25ef972de004615a22937e739de2def", | ||
"GUID:ca4e81cdd6a34d1aa54c32ad41fc5b3b", | ||
"GUID:5ab29fa8ae5769b49ab29e390caca7a4", | ||
"GUID:91cf8206af184dac8e30eb46747e9939", | ||
"GUID:543b8f091a5947a3880b7f2bca2358bd", | ||
"GUID:e5a23cdae0ef4d86aafc237a73280975" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
"name": "Wearables", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:9e314663ce958b746873cb22d57ede55", | ||
"GUID:f51ebe6a0ceec4240a699833d6309b23", | ||
"GUID:286980af24684da6acc1caa413039811", | ||
"GUID:1b8e1e1bd01505f478f0369c04a4fb2f", | ||
"GUID:fa7b3fdbb04d67549916da7bd2af58ab", | ||
"GUID:3c7b57a14671040bd8c549056adc04f5", | ||
"GUID:e0eedfa2deb9406daf86fd8368728e39", | ||
"GUID:8322ea9340a544c59ddc56d4793eac74", | ||
"GUID:4794e238ed0f65142a4aea5848b513e5", | ||
"GUID:3640f3c0b42946b0b8794a1ed8e06ca5", | ||
"GUID:275e22790c04e9b47a5085d7b0c4432a", | ||
"GUID:4a12c0b1b77ec6b418a8d7bd5c925be3", | ||
"GUID:b46779583a009f04ba9f5f31d0e7e6ac", | ||
"GUID:56e8195b069a4dca9c4c4f313c65f526", | ||
"GUID:e25ef972de004615a22937e739de2def", | ||
"GUID:ca4e81cdd6a34d1aa54c32ad41fc5b3b", | ||
"GUID:5ab29fa8ae5769b49ab29e390caca7a4", | ||
"GUID:91cf8206af184dac8e30eb46747e9939", | ||
"GUID:543b8f091a5947a3880b7f2bca2358bd", | ||
"GUID:e5a23cdae0ef4d86aafc237a73280975", | ||
"GUID:8baf705856414dad9a73b3f382f1bc8b" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.