mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 02:32:59 +08:00
Remove >-1 limitation by using a separate constructor
This commit is contained in:
parent
3d1183eea0
commit
e9b5137147
@ -29,12 +29,17 @@ namespace osu.Game.Configuration
|
||||
|
||||
public string Description { get; }
|
||||
|
||||
public int OrderPosition { get; }
|
||||
public int? OrderPosition { get; }
|
||||
|
||||
public SettingSourceAttribute(string label, string description = null, int orderPosition = -1)
|
||||
public SettingSourceAttribute(string label, string description = null)
|
||||
{
|
||||
Label = label ?? string.Empty;
|
||||
Description = description ?? string.Empty;
|
||||
}
|
||||
|
||||
public SettingSourceAttribute(string label, string description, int orderPosition)
|
||||
: this(label, description)
|
||||
{
|
||||
OrderPosition = orderPosition;
|
||||
}
|
||||
}
|
||||
@ -129,7 +134,7 @@ namespace osu.Game.Configuration
|
||||
{
|
||||
var original = obj.GetSettingsSourceProperties();
|
||||
|
||||
var orderedRelative = original.Where(attr => attr.Item1.OrderPosition > -1).OrderBy(attr => attr.Item1.OrderPosition);
|
||||
var orderedRelative = original.Where(attr => attr.Item1.OrderPosition != null).OrderBy(attr => attr.Item1.OrderPosition);
|
||||
var unordered = original.Except(orderedRelative);
|
||||
|
||||
return orderedRelative.Concat(unordered);
|
||||
|
Loading…
Reference in New Issue
Block a user