1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Add constructors to RadioButton

This commit is contained in:
smoogipoo 2017-11-30 16:57:30 +09:00
parent ead7456978
commit 73e41f9dde
2 changed files with 18 additions and 6 deletions

View File

@ -22,11 +22,11 @@ namespace osu.Game.Tests.Visual
Width = 150,
Items = new[]
{
new RadioButton { Text = "Item 1", Action = () => { } },
new RadioButton { Text = "Item 2", Action = () => { } },
new RadioButton { Text = "Item 3", Action = () => { } },
new RadioButton { Text = "Item 4", Action = () => { } },
new RadioButton { Text = "Item 5", Action = () => { } }
new RadioButton("Item 1", () => { }),
new RadioButton("Item 2", () => { }),
new RadioButton("Item 3", () => { }),
new RadioButton("Item 4", () => { }),
new RadioButton("Item 5", () => { })
}
});
}

View File

@ -5,7 +5,7 @@ using System;
namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons
{
public class RadioButton
public struct RadioButton
{
/// <summary>
/// The text that should be displayed in this button.
@ -16,5 +16,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons
/// The <see cref="Action"/> that should be invoked when this button is selected.
/// </summary>
public Action Action;
public RadioButton(string text)
{
Text = text;
Action = null;
}
public RadioButton(string text, Action action)
{
Text = text;
Action = action;
}
}
}