1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:02:55 +08:00

Add basic spectator screen

This commit is contained in:
Dean Herbert 2020-10-26 19:47:39 +09:00
parent df5348cd93
commit 5fd97bd043
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// 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 NUnit.Framework;
using osu.Game.Screens.Play;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneSpectator : ScreenTestScene
{
private readonly User user = new User { Id = 1234, Username = "Test user" };
[Test]
public void TestSpectating()
{
AddStep("load screen", () => LoadScreen(new Spectator(user)));
}
}
}

View File

@ -0,0 +1,36 @@
// 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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
namespace osu.Game.Screens.Play
{
public class Spectator : OsuScreen
{
private readonly User targetUser;
public Spectator([NotNull] User targetUser)
{
this.targetUser = targetUser ?? throw new ArgumentNullException(nameof(targetUser));
}
[BackgroundDependencyLoader]
private void load()
{
InternalChildren = new Drawable[]
{
new OsuSpriteText
{
Text = $"Watching {targetUser}",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
};
}
}
}