osu/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs

41 lines
1.2 KiB
C#
Raw Normal View History

2019-03-04 04:24:19 +00:00
// 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.
2018-11-15 12:28:42 +00:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Screens.Gameplay.Components;
2019-06-18 06:28:36 +00:00
namespace osu.Game.Tournament.Tests.Components
2018-11-15 12:28:42 +00:00
{
2019-06-14 08:25:07 +00:00
public class TestSceneMatchScoreDisplay : LadderTestScene
2018-11-15 12:28:42 +00:00
{
[Cached(Type = typeof(MatchIPCInfo))]
private MatchIPCInfo matchInfo = new MatchIPCInfo();
2019-06-14 08:25:07 +00:00
public TestSceneMatchScoreDisplay()
2018-11-15 12:28:42 +00:00
{
Add(new MatchScoreDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
}
protected override void LoadComplete()
{
base.LoadComplete();
Scheduler.AddDelayed(() =>
{
int amount = (int)((RNG.NextDouble() - 0.5) * 10000);
if (amount < 0)
matchInfo.Score1.Value -= amount;
else
matchInfo.Score2.Value += amount;
}, 100, true);
}
}
}