1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Switch to System.ComponentModel.Description

This commit is contained in:
Drew DeVault 2016-12-01 17:45:31 -05:00
parent 5456e0102c
commit cf60c52f00
8 changed files with 14 additions and 34 deletions

View File

@ -1,15 +0,0 @@
using System;
namespace osu.Game.Configuration
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class DisplayNameAttribute : Attribute
{
public string Name { get; set; }
public DisplayNameAttribute(string name)
{
Name = name;
}
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace osu.Game.Configuration
{
public class HiddenAttribute
{
public HiddenAttribute()
{
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
namespace osu.Game.Configuration
{
@ -6,9 +7,9 @@ namespace osu.Game.Configuration
{
Off,
Pie,
[DisplayName("Top Right")]
[Description("Top Right")]
TopRight,
[DisplayName("Bottom Right")]
[Description("Bottom Right")]
BottomRight,
Bottom
}

View File

@ -1,12 +1,14 @@
using System;
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum RankingType
{
Local,
[DisplayName("Global")]
[Description("Global")]
Top,
[DisplayName("Selected Mods")]
[Description("Selected Mods")]
SelectedMod,
Friends,
Country

View File

@ -1,12 +1,14 @@
using System;
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum ScreenshotFormat
{
Bmp = 0, // TODO: Figure out the best way to hide this from the dropdown
[DisplayName("JPG (web-friendly)")]
[Description("JPG (web-friendly)")]
Jpg = 1,
[DisplayName("PNG (lossless)")]
[Description("PNG (lossless)")]
Png = 2
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using OpenTK.Graphics;
@ -56,7 +57,7 @@ namespace osu.Game.Overlays.Options
AutoSizeAxes = Axes.Y;
var items = typeof(T).GetFields().Where(f => !f.IsSpecialName).Zip(
(T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple<string, T>(
a.GetCustomAttribute<DisplayNameAttribute>()?.Name ?? a.Name, b));
a.GetCustomAttribute<DescriptionAttribute>()?.Description ?? a.Name, b));
Children = new Drawable[]
{
text = new SpriteText { Alpha = 0 },

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Options.General
{
new DropdownOption<ReleaseStream>
{
Label = "Release stream",
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuConfig.ReleaseStream),
},
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality

View File

@ -225,7 +225,6 @@
<Compile Include="Overlays\Options\SliderOption.cs" />
<Compile Include="Configuration\ProgressBarType.cs" />
<Compile Include="Overlays\Options\DropdownOption.cs" />
<Compile Include="Configuration\DisplayNameAttribute.cs" />
<Compile Include="Configuration\RankingType.cs" />
<Compile Include="Configuration\ScoreMeterType.cs" />
<Compile Include="Configuration\ReleaseStream.cs" />