Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: backpack controller bus #219

Merged
merged 56 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f2368cc
Feat: add backpack bus logic
davidejensen Dec 19, 2023
27372ae
Added structure for commands and events
davidejensen Dec 19, 2023
dd11f09
Additions to backpack bus
davidejensen Dec 19, 2023
bfa82b1
Minor changes
davidejensen Dec 20, 2023
b4837bd
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 20, 2023
1499920
Minor changes
davidejensen Dec 20, 2023
08392cb
Additional structural changes
davidejensen Dec 20, 2023
f62aa4e
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 20, 2023
68e8913
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 21, 2023
dde1e0a
Minor changes
davidejensen Dec 21, 2023
e35aa9c
Minor changes
davidejensen Dec 22, 2023
1b9103c
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 22, 2023
414088e
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 27, 2023
e54099c
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 27, 2023
ba1d0c1
Delete duplicated common textures
RominaMarchetti Dec 27, 2023
4484c21
Organise and move textures to their proper folder
RominaMarchetti Dec 27, 2023
c297011
Add and update backpack textures
RominaMarchetti Dec 27, 2023
ccbebbc
Update AvatarSlot.prefab
RominaMarchetti Dec 27, 2023
07ccbfb
Changed bus messages and added equippables definition
davidejensen Dec 27, 2023
a151f44
Update BackpackItem.prefab
RominaMarchetti Dec 27, 2023
90ac9f3
Merge branch 'feat/backpack-controller-bus' of https://github.com/dec…
RominaMarchetti Dec 27, 2023
03d6a26
Update ItemInfoPanel.prefab
RominaMarchetti Dec 27, 2023
fe0c558
Update assets
RominaMarchetti Dec 27, 2023
0635809
Polish UI from backpack and slot
RominaMarchetti Dec 27, 2023
f52b3cd
Minor changes
davidejensen Dec 28, 2023
a153d9e
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Dec 28, 2023
31a66da
Load default wearable
dalkia Dec 29, 2023
98ee281
code cleaning
dalkia Dec 29, 2023
9910802
Added sample retrieval of equipped wearables
davidejensen Jan 2, 2024
0d1356e
Merge remote-tracking branch 'origin/feat/empty-default-wearables' in…
davidejensen Jan 2, 2024
a309334
Added wearable thumbnail resolver and initial equipped wearables logic
davidejensen Jan 2, 2024
7654f4c
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Jan 2, 2024
4591ee0
Structural changes to equipped wearables loading
davidejensen Jan 4, 2024
d7d11d9
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Jan 4, 2024
e27c412
Minor fixes
davidejensen Jan 4, 2024
24fc0f9
Minor cleanup
davidejensen Jan 4, 2024
dda0cdb
Minor test fix
davidejensen Jan 4, 2024
79f6b05
Minor changes to wearables and wearables grid
davidejensen Jan 4, 2024
ace15b6
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Jan 4, 2024
94adf68
Wired info panel behaviour in backpack
davidejensen Jan 4, 2024
6991c7d
Minor changes
davidejensen Jan 4, 2024
8ca9e81
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Jan 5, 2024
f04a900
Applied code suggestions
davidejensen Jan 8, 2024
6e5594f
Removed unneded plugin for backpack bus controller
davidejensen Jan 8, 2024
26baedc
Improvement for hash locating in wearables
davidejensen Jan 8, 2024
2e3cfb5
Improved request params handling
davidejensen Jan 8, 2024
bc4e6df
Improved thumbnail resolve type
davidejensen Jan 8, 2024
362ba73
minor improvements to info panel
davidejensen Jan 8, 2024
bf5d91d
Minor UI improvements
davidejensen Jan 8, 2024
0803d90
Minor UI changes
davidejensen Jan 9, 2024
98d0cda
Additional code suggestions applied
davidejensen Jan 9, 2024
a90945a
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Jan 9, 2024
6d6fa25
Removed hardcoded wallet id
davidejensen Jan 9, 2024
03429f5
Add minor clean-up and address allocation issues
mikhail-dcl Jan 9, 2024
fa67ffd
Applied missing cancellation tokens
davidejensen Jan 9, 2024
1dd7f8d
Merge branch 'main' into feat/backpack-controller-bus
davidejensen Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
220 changes: 115 additions & 105 deletions Explorer/Assets/AddressableAssetsData/AssetGroups/Essentials.asset
Original file line number Diff line number Diff line change
@@ -1,105 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
m_Name: Essentials
m_EditorClassIdentifier:
m_GroupName: Essentials
m_Data:
m_SerializedData: []
m_GUID: 47f803e1e9c5079449bd106df98a0b7d
m_SerializeEntries:
- m_GUID: 654e496ed12f12e4f80243ab9f1d97c7
m_Address: Character Camera
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 0eecf14978c1aa74381023946dde5c78
m_Address: Character Object
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 35aa85d68d15435418848a03a2db81ec
m_Address: Inter-Regular SDF.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 96ae0a2159a39234f858ea23bdcc74ad
m_Address: Inter-SemiBold SDF.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 8f586378b4e144a9851e7b34d9b748ee
m_Address: LiberationSans SDF.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 2e498d1c8094910479dc3e1b768306a4
m_Address: LiberationSans SDF - Fallback.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: e8cf73ccd47a385498b71ec58534d03c
m_Address: Assets/DCL/AvatarRendering/AvatarShape/Assets/ComputeShaderSkinning.compute
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 3efe8a48fc3905f47a0648abd6859394
m_Address: MapCameraObject
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: b54d9d4189903c2438fa811308f14ceb
m_Address: MapConfiguration
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 7e150ada146ad0749b39e65968780157
m_Address: MapParcelHighlightMarker
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 0ae66608be2735a4f96e0f1aa9b3a75b
m_Address: PlayerMarkerObject
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f80a8f4fcad2b4246b66c94221314244
m_Address: AtlasChunk
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 04a7ffcd277754f7c91237894604f522
m_Address: NftRarityBackgrounds
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 7491e2fb7fd484d2b8aed984dfc7c6ab
m_Address: NftRarityColors
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 4a2a7b610414b45c1b576946ce094877
m_Address: NftCategoryIcons
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 08d42937d0bc54b48baaa23c8c520175
m_Address: Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: fc8a9d2b539788c47a5b305639fa8b34, type: 2}
m_SchemaSet:
m_Schemas:
- {fileID: 11400000, guid: 9457e5517ec7d134d8c10bdce90c02c6, type: 2}
- {fileID: 11400000, guid: f1becbbb6af19b14bafe1985627ea5ea, type: 2}
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
m_Name: Essentials
m_EditorClassIdentifier:
m_GroupName: Essentials
m_Data:
m_SerializedData: []
m_GUID: 47f803e1e9c5079449bd106df98a0b7d
m_SerializeEntries:
- m_GUID: 654e496ed12f12e4f80243ab9f1d97c7
m_Address: Character Camera
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 0eecf14978c1aa74381023946dde5c78
m_Address: Character Object
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 35aa85d68d15435418848a03a2db81ec
m_Address: Inter-Regular SDF.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 96ae0a2159a39234f858ea23bdcc74ad
m_Address: Inter-SemiBold SDF.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 8f586378b4e144a9851e7b34d9b748ee
m_Address: LiberationSans SDF.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 2e498d1c8094910479dc3e1b768306a4
m_Address: LiberationSans SDF - Fallback.asset
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: e8cf73ccd47a385498b71ec58534d03c
m_Address: Assets/DCL/AvatarRendering/AvatarShape/Assets/ComputeShaderSkinning.compute
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 3efe8a48fc3905f47a0648abd6859394
m_Address: MapCameraObject
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: b54d9d4189903c2438fa811308f14ceb
m_Address: MapConfiguration
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 7e150ada146ad0749b39e65968780157
m_Address: MapParcelHighlightMarker
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 0ae66608be2735a4f96e0f1aa9b3a75b
m_Address: PlayerMarkerObject
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f80a8f4fcad2b4246b66c94221314244
m_Address: AtlasChunk
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 04a7ffcd277754f7c91237894604f522
m_Address: NftRarityBackgrounds
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 7491e2fb7fd484d2b8aed984dfc7c6ab
m_Address: NftRarityColors
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 4a2a7b610414b45c1b576946ce094877
m_Address: NftCategoryIcons
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 08d42937d0bc54b48baaa23c8c520175
m_Address: Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 66f8f8427a5c4443e95b0d298addd639
m_Address: NftInfoPanelRarityBackgrounds
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: aabac5666448b4345a76347f94ea32a4
m_Address: BackpackItem
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: fc8a9d2b539788c47a5b305639fa8b34, type: 2}
m_SchemaSet:
m_Schemas:
- {fileID: 11400000, guid: 9457e5517ec7d134d8c10bdce90c02c6, type: 2}
- {fileID: 11400000, guid: f1becbbb6af19b14bafe1985627ea5ea, type: 2}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using DCL.AvatarRendering.Wearables.Helpers;
using CommunicationData.URLHelpers;
using DCL.AvatarRendering.Wearables.Helpers;
using ECS.StreamableLoading.Common.Components;
using SceneRunner.Scene;
using System.Collections.Generic;
using UnityEngine;

namespace DCL.AvatarRendering.Wearables.Components
{
Expand All @@ -15,15 +17,26 @@ public interface IWearable
StreamableLoadingResult<SceneAssetBundleManifest>? ManifestResult { get; set; }
StreamableLoadingResult<WearableAsset>?[] WearableAssetResults { get; }
StreamableLoadingResult<WearableDTO> WearableDTO { get; set; }
StreamableLoadingResult<Sprite>? WearableThumbnail { get; set; }

string GetMainFileHash(BodyShape bodyShape);

string GetHash();

string GetUrn();

string GetName();

string GetCategory();

string GetDescription();

string GetCreator();

string GetRarity();

URLPath GetThumbnail();

bool IsUnisex();

bool IsCompatibleWithBodyShape(string bodyShape);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public struct GetWearableByParamIntention : IEquatable<GetWearableByParamIntenti

//ValidParams: pageNum, pageSize, includeEntities (bool), rarity, category, name, orderBy, direction,
//collectionType (base-wearable, on-chain, third-party), thirdPartyCollectionId
public (string, string)[] Params;
public IReadOnlyList<(string, string)> Params;
public string UserID;

//Used for pooling
public List<IWearable> Results;

public GetWearableByParamIntention((string, string)[] requestParams, string userID, List<IWearable> results)
public GetWearableByParamIntention(IReadOnlyList<(string, string)> requestParams, string userID, List<IWearable> results)
{
Params = requestParams;
UserID = userID;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,50 @@
using CommunicationData.URLHelpers;
using DCL.AvatarRendering.Wearables.Helpers;
using ECS.StreamableLoading.Common.Components;
using SceneRunner.Scene;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

//Removed all references to EmoteData in WearableItem
namespace DCL.AvatarRendering.Wearables.Components
{
[Serializable]
public class Wearable : IWearable
{
private const string THUMBNAIL_DEFAULT_KEY = "thumbnail.png";
public StreamableLoadingResult<SceneAssetBundleManifest>? ManifestResult { get; set; }
public StreamableLoadingResult<WearableAsset>?[] WearableAssetResults { get; private set; } = new StreamableLoadingResult<WearableAsset>?[BodyShape.COUNT];
public StreamableLoadingResult<WearableDTO> WearableDTO { get; set; }

public StreamableLoadingResult<Sprite>? WearableThumbnail { get; set; }
public bool IsLoading { get; set; } = true;

public URLPath GetThumbnail()
{
string thumbnailHash = WearableDTO.Asset.metadata.thumbnail;

if (thumbnailHash == THUMBNAIL_DEFAULT_KEY)
thumbnailHash = GetContentHashByKey(THUMBNAIL_DEFAULT_KEY);

return new URLPath(thumbnailHash);
}

private string GetContentHashByKey(string key)
{
for (var i = 0; i < WearableDTO.Asset.content.Length; i++)
{
if (WearableDTO.Asset.content[i].file == key)
return WearableDTO.Asset.content[i].hash;
}

return "";
}

public string GetMainFileHash(BodyShape bodyShape)
{
var mainFileKey = "";
var hashToReturn = "";

// The length of arrays is small, so O(N) complexity is fine
// Avoid iterator allocations with "for" loop
Expand All @@ -34,18 +59,7 @@ public string GetMainFileHash(BodyShape bodyShape)
}
}

for (var i = 0; i < WearableDTO.Asset.content.Length; i++)
{
WearableDTO.WearableContentDto wearableContentDto = WearableDTO.Asset.content[i];

if (wearableContentDto.file.Equals(mainFileKey))
{
hashToReturn = wearableContentDto.hash;
break;
}
}

return hashToReturn;
return GetContentHashByKey(mainFileKey);
}

public string GetHash() =>
Expand All @@ -54,9 +68,21 @@ public string GetHash() =>
public string GetUrn() =>
WearableDTO.Asset.metadata.id;

public string GetName() =>
WearableDTO.Asset.metadata.name;

public string GetCategory() =>
WearableDTO.Asset.metadata.data.category;

public string GetDescription() =>
WearableDTO.Asset.metadata.description;

public string GetCreator() =>
"";

public string GetRarity() =>
WearableDTO.Asset.metadata.rarity ?? "common";

public bool IsUnisex() =>
WearableDTO.Asset.metadata.data.representations.Length > 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public IWearable GetOrAddWearableByDTO(WearableDTO wearableDto, bool qualifiedFo
{
WearableDTO = new StreamableLoadingResult<WearableDTO>(wearableDto),
IsLoading = false

}, qualifiedForUnloading);
}

Expand All @@ -30,6 +31,7 @@ public void AddEmptyWearable(string loadingIntentionPointer, bool qualifiedForUn
AddWearable(loadingIntentionPointer, new Wearable(), qualifiedForUnloading);
}


internal IWearable AddWearable(string loadingIntentionPointer, IWearable wearable, bool qualifiedForUnloading)
{
wearablesCache.Add(loadingIntentionPointer, wearable);
Expand Down
Loading