Implement enum attributes to set display order

This commit is contained in:
Andrei Zavatski
2020-02-21 01:37:36 +03:00
parent d50cca6264
commit 58903759f1
2 changed files with 66 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.ComponentModel;
using osu.Framework.IO.Network;
using osu.Game.Overlays;
@ -92,19 +93,59 @@ namespace osu.Game.Online.API.Requests
Electronic = 10
}
[HasOrderedElements]
public enum BeatmapSearchLanguage
{
[Order(0)]
Any,
[Order(11)]
Other,
[Order(1)]
English,
[Order(6)]
Japanese,
[Order(2)]
Chinese,
[Order(10)]
Instrumental,
[Order(7)]
Korean,
[Order(3)]
French,
[Order(4)]
German,
[Order(9)]
Swedish,
[Order(8)]
Spanish,
[Order(5)]
Italian
}
[AttributeUsage(AttributeTargets.Field)]
public class OrderAttribute : Attribute
{
public readonly int Order;
public OrderAttribute(int order)
{
Order = order;
}
}
[AttributeUsage(AttributeTargets.Enum)]
public class HasOrderedElementsAttribute : Attribute
{
}
}