mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Handle ignored mappings locally in Detach
configuration
This commit is contained in:
parent
2b8706b6ce
commit
aaefd72c69
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AutoMapper;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
@ -76,10 +75,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public bool Equals(IBeatmapSetInfo? other) => other is BeatmapSetInfo b && Equals(b);
|
public bool Equals(IBeatmapSetInfo? other) => other is BeatmapSetInfo b && Equals(b);
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,9 @@ namespace osu.Game.Database
|
|||||||
private static readonly IMapper mapper = new MapperConfiguration(c =>
|
private static readonly IMapper mapper = new MapperConfiguration(c =>
|
||||||
{
|
{
|
||||||
c.ShouldMapField = fi => false;
|
c.ShouldMapField = fi => false;
|
||||||
c.ShouldMapProperty = pi => true;
|
// If we want to limit this further, we can avoid mapping properties with no setter that are not IList<>.
|
||||||
|
// Takes a bit of effort to determine whether this is the case though, see https://stackoverflow.com/questions/951536/how-do-i-tell-whether-a-type-implements-ilist
|
||||||
|
c.ShouldMapProperty = pi => pi.GetMethod?.IsPublic == true;
|
||||||
|
|
||||||
c.CreateMap<RealmKeyBinding, RealmKeyBinding>();
|
c.CreateMap<RealmKeyBinding, RealmKeyBinding>();
|
||||||
c.CreateMap<BeatmapMetadata, BeatmapMetadata>();
|
c.CreateMap<BeatmapMetadata, BeatmapMetadata>();
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AutoMapper;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -113,16 +112,9 @@ namespace osu.Game.Scoring
|
|||||||
[MapTo(nameof(Rank))]
|
[MapTo(nameof(Rank))]
|
||||||
public int RankInt { get; set; }
|
public int RankInt { get; set; }
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
IRulesetInfo IScoreInfo.Ruleset => Ruleset;
|
IRulesetInfo IScoreInfo.Ruleset => Ruleset;
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
IUser IScoreInfo.User => User;
|
IUser IScoreInfo.User => User;
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
||||||
|
|
||||||
#region Properties required to make things work with existing usages
|
#region Properties required to make things work with existing usages
|
||||||
|
Loading…
Reference in New Issue
Block a user