Function of add random.

This commit is contained in:
Huo Yaoyuan 2016-12-05 01:03:18 +08:00
parent 92c21d8b12
commit 63ba3455fb

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Configuration;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.MathUtils;
namespace osu.Desktop.VisualTests.Tests
{
@ -23,20 +24,7 @@ namespace osu.Desktop.VisualTests.Tests
{
base.Reset();
KeyCounterCollection kc;
BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 1000, Default = 50 };
AddButton("Add Random", null);
Add(new SliderBar<int>
{
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Width = 150,
Height = 10,
SelectionColor = Color4.Orange,
Position = new Vector2(0, 50),
Bindable = bindable
});
Add(kc = new KeyCounterCollection
KeyCounterCollection kc = new KeyCounterCollection
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
@ -48,7 +36,24 @@ namespace osu.Desktop.VisualTests.Tests
new KeyCounterMouse(@"M1", MouseButton.Left),
new KeyCounterMouse(@"M2", MouseButton.Right),
},
};
BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 1000, Default = 50 };
AddButton("Add Random", () =>
{
Key key = (Key)((int)Key.A + RNG.Next(26));
kc.Add(new KeyCounterKeyboard(key.ToString(), key));
});
Add(new SliderBar<int>
{
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Width = 150,
Height = 10,
SelectionColor = Color4.Orange,
Position = new Vector2(0, 50),
Bindable = bindable
});
Add(kc);
}
}
}