Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace DCL.AvatarRendering.Emotes
{
public interface IEmote : IAvatarAttachment<EmoteDTO>, ITrimmedEmote
{
int Amount { get; set; }
new int Amount { get; set; }

StreamableLoadingResult<AudioClipData>?[] AudioAssetResults { get; }
StreamableLoadingResult<AttachmentRegularAsset>?[] AssetResults { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace DCL.AvatarRendering.Emotes
public interface ITrimmedEmote : ITrimmedAvatarAttachment<TrimmedEmoteDTO>
{
public int Amount { get; set; }
TrimmedEmoteDTO TrimmedDTO { get; }
new TrimmedEmoteDTO TrimmedDTO { get; }

void ITrimmedAvatarAttachment.SetAmount(int amount)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

namespace DCL.AvatarRendering.Emotes
{
/// <summary>
/// Unloads the wearable from the catalog by a frame time budget provider.
/// </summary>
/// <param name="frameTimeBudget">The frame time budget provider.</param>
public interface ITrimmedEmoteStorage : ITrimmedAvatarElementStorage<ITrimmedEmote, TrimmedEmoteDTO>
{
/// <summary>
/// Unloads the wearable from the catalog by a frame time budget provider.
/// </summary>
/// <param name="frameTimeBudget">The frame time budget provider.</param>
void Unload(IPerformanceBudget frameTimeBudget);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public static Representation NewFakeRepresentation() =>
[Serializable]
public abstract class MetadataBase : TrimmedAvatarAttachmentDTO.TrimmedMetadataBase<DataBase>
{
public string name;

public I18n[] i18n;
public string thumbnail;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ public interface ITrimmedWearable : ITrimmedAvatarAttachment<TrimmedWearableDTO>
public int Amount { get; set; }
bool IsCompatibleWithBodyShape(string bodyShape);

TrimmedWearableDTO TrimmedDTO { get; }


public bool IsSmart() =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile error (CS1061): Removing TrimmedWearableDTO TrimmedDTO { get; } means the default method IsSmart() now resolves TrimmedDTO to the base ITrimmedAvatarAttachment.TrimmedDTO, which has return type TrimmedAvatarAttachmentDTO. That abstract base class has no metadata field (only the generic subclass TrimmedAvatarAttachmentDTO<TMetadata> does), so TrimmedDTO.metadata.isSmart fails with CS1061.

The fix that's consistent with how ITrimmedEmote was corrected is to keep the re-declaration but mark it explicit with new:

Suggested change
public bool IsSmart() =>
public bool IsSmart() =>

Apply this suggestion only after restoring the declaration above it:

new TrimmedWearableDTO TrimmedDTO { get; }

i.e., the full corrected block:

public interface ITrimmedWearable : ITrimmedAvatarAttachment<TrimmedWearableDTO>
{
    public int Amount { get; set; }
    bool IsCompatibleWithBodyShape(string bodyShape);

    new TrimmedWearableDTO TrimmedDTO { get; }

    public bool IsSmart() =>
        TrimmedDTO.metadata.isSmart;
    ...
}

TrimmedDTO.metadata.isSmart;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

namespace DCL.AvatarRendering.Wearables.Helpers
{
/// <summary>
/// Unloads the wearable from the catalog by a frame time budget provider.
/// </summary>
/// <param name="frameTimeBudget">The frame time budget provider.</param>
public interface ITrimmedWearableStorage : ITrimmedAvatarElementStorage<ITrimmedWearable, TrimmedWearableDTO>
{
/// <summary>
/// Unloads the wearable from the catalog by a frame time budget provider.
/// </summary>
/// <param name="frameTimeBudget">The frame time budget provider.</param>
void Unload(IPerformanceBudget frameTimeBudget);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public partial class WearableStorage : AvatarElementNftRegistry, IWearableStorag
private readonly Dictionary<URN, LinkedListNode<(URN key, long lastUsedFrame)>> cacheKeysDictionary = new (new Dictionary<URN, LinkedListNode<(URN key, long lastUsedFrame)>>(), URNIgnoreCaseEqualityComparer.Default);
private readonly Dictionary<URN, Dictionary<URN, NftBlockchainOperationEntry>> ownedNftsRegistry = new (new Dictionary<URN, Dictionary<URN, NftBlockchainOperationEntry>>(), URNIgnoreCaseEqualityComparer.Default);

private readonly object lockObject = new ();

internal Dictionary<URN, IWearable> wearablesCache { get; } = new (new Dictionary<URN, IWearable>(), URNIgnoreCaseEqualityComparer.Default);

public IWearable GetOrAddByDTO(WearableDTO wearableDto, bool qualifiedForUnloading = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed class GiftTransferController

public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP;

private enum State { Waiting, Success, Failed }
private new enum State { Waiting, Success, Failed }

private State currentState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void ClearRequestReceivedMemberItems()
CurrentRequestReceivedMembers.Clear();
}

public void SetRequestReceivedMemberItems(ICommunityMemberData[] members)
public void SetRequestReceivedMemberItems(IReadOnlyList<ICommunityMemberData> members)
{
foreach (var community in members)
CreateAndSetupRequestReceivedMembers(community);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DCL.Profiles;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace DCL.Communities.CommunitiesDataProvider.DTOs
{
Expand Down Expand Up @@ -48,7 +49,7 @@ public class GetCommunityInviteRequestResponseData
}

public GetCommunityInviteRequestResponseData data;
public ICommunityMemberData[] members => data.results;
public IReadOnlyList<ICommunityMemberData> members => data.results;
public int total => data.total;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using DCL.Utilities;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;

Expand Down Expand Up @@ -81,7 +82,7 @@ public class GetCommunityMembersResponseData
}

public GetCommunityMembersResponseData data;
public ICommunityMemberData[] members => data.results;
public IReadOnlyList<ICommunityMemberData> members => data.results;
public int total => data.total;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Collections.Generic;

namespace DCL.Communities.CommunitiesDataProvider.DTOs
{
public interface ICommunityMemberPagedResponse
{
ICommunityMemberData[] members { get; }
IReadOnlyList<ICommunityMemberData> members { get; }
int total { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ namespace DCL.MapRenderer.MapLayers.Atlas
{
internal interface IAtlasController : IMapLayerController
{
UniTask InitializeAsync(CancellationToken ct);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,8 @@ internal interface ICategoryMarker : IMapRendererMarker, IMapPositionProvider, I

void SetCategorySprite(Sprite sprite);

void OnBecameVisible();

void OnBecameInvisible();

void SetZoom(float baseScale, float baseZoom, float zoom);

void ResetScale(float scale);

UniTaskVoid AnimateSelectionAsync(CancellationToken ct);

UniTaskVoid AnimateDeSelectionAsync(CancellationToken ct);

GameObject? GetGameObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ internal interface IClusterMarker : IMapRendererMarker, IMapPositionProvider, ID

void ResetScale(float scale);

UniTaskVoid AnimateSelectionAsync(CancellationToken ct);

UniTaskVoid AnimateDeSelectionAsync(CancellationToken ct);

GameObject? GetGameObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public enum ScaleType

void SetData(string title, string description);

UniTaskVoid AnimateSelectionAsync(CancellationToken ct);

UniTaskVoid AnimateDeselectionAsync(CancellationToken ct);

public void DeselectImmediately(ScaleType scaleType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,8 @@ internal interface ISceneOfInterestMarker : IMapRendererMarker, IMapPositionProv

void SetData(string title, Vector3 position, PlacesData.PlaceInfo placeInfo);

void OnBecameVisible();

void OnBecameInvisible();

void SetZoom(float baseScale, float baseZoom, float zoom);

void ResetScale(float scale);

UniTaskVoid AnimateSelectionAsync(CancellationToken ct);

UniTaskVoid AnimateDeSelectionAsync(CancellationToken ct);

GameObject? GetGameObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,8 @@ internal interface ISearchResultMarker : IMapRendererMarker, IMapPositionProvide

void SetData(string title, Vector3 position, PlacesData.PlaceInfo placeInfo);

void OnBecameVisible();

void OnBecameInvisible();

void SetZoom(float baseScale, float baseZoom, float zoom);

void ResetScale(float scale);

UniTaskVoid AnimateSelectionAsync(CancellationToken ct);

UniTaskVoid AnimateDeSelectionAsync(CancellationToken ct);

GameObject? GetGameObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
public interface IMemoryProfiler : IBudgetProfiler
{
long SystemUsedMemoryInBytes { get; }
long GcUsedMemoryInBytes { get; }
float TotalGcAlloc { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void SetUp()
standardStrategy = new MockUnloadStrategy(1);
aggresiveStrategy = new MockUnloadStrategy(1);

unloadStrategies = new[]
unloadStrategies = new UnloadStrategyBase[]
{
standardStrategy,
aggresiveStrategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class ToggleWithIconAndCheckContextMenuControlSettings : ToggleContextMen
{
internal readonly ToggleGroup toggleGroup;
internal readonly Sprite icon;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile error (CS0191): Same issue as ToggleWithIconContextMenuControlSettings. Removing internal readonly Color iconColor here means line 28 (this.iconColor = iconColor == …) targets the inherited readonly field on ToggleContextMenuControlSettings, which C# does not permit from a derived-class constructor.

Suggested change
internal readonly Sprite icon;
internal readonly ToggleGroup toggleGroup;
internal readonly Sprite icon;
internal new readonly Color iconColor;

internal readonly Color iconColor;

/// <summary>
/// Settings for a toggle control that includes a checkmark and an optional icon.
Expand All @@ -29,4 +28,4 @@ public ToggleWithIconAndCheckContextMenuControlSettings(
this.iconColor = iconColor == default ? Color.white : iconColor;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace DCL.UI.Controls.Configs
{
public class ToggleWithIconContextMenuControlSettings : ToggleContextMenuControlSettings
{
internal readonly Sprite toggleIcon;

public ToggleWithIconContextMenuControlSettings(Sprite toggleIcon, string toggleText, Action<bool> toggleAction, RectOffset horizontalLayoutPadding = null, int horizontalLayoutSpacing = 30,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile error (CS0191): Removing internal readonly Sprite toggleIcon from this class causes this.toggleIcon = toggleIcon in the constructor body to target the inherited readonly field on ToggleContextMenuControlSettings. C# only allows readonly fields to be assigned in a constructor of the declaring class, so this emits CS0191.

The correct fix to suppress the CS0108 warning without breaking the build is:

Suggested change
public ToggleWithIconContextMenuControlSettings(Sprite toggleIcon, string toggleText, Action<bool> toggleAction, RectOffset horizontalLayoutPadding = null, int horizontalLayoutSpacing = 30,
internal new readonly Sprite toggleIcon;

Alternatively, change the base-constructor call to the overload that accepts toggleIcon and remove the body assignment:

: base(toggleText, toggleAction, toggleIcon, horizontalLayoutPadding, horizontalLayoutSpacing, horizontalLayoutReverseArrangement)

but that is a behavioural change (base-class field would become non-null) and is out of scope for a warning-cleanup PR.

bool horizontalLayoutReverseArrangement = false) : base(toggleText, toggleAction, horizontalLayoutPadding, horizontalLayoutSpacing, horizontalLayoutReverseArrangement)
{
Expand Down
Loading