1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Fix GameplayScreen test not working

This commit is contained in:
Dean Herbert 2019-06-14 16:57:29 +09:00
parent 1eb15c39f9
commit 4cd6955a96
4 changed files with 26 additions and 24 deletions

View File

@ -1,25 +1,23 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Gameplay;
namespace osu.Game.Tournament.Tests namespace osu.Game.Tournament.Tests
{ {
public class TestCaseGameplay : OsuTestScene public class TestCaseGameplayScreen : OsuTestScene
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] [Cached]
{ private MatchChatDisplay chat = new MatchChatDisplay();
typeof(GameplayScreen)
};
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Add(new GameplayScreen()); Add(new GameplayScreen());
Add(chat);
} }
} }
} }

View File

@ -4,9 +4,11 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Tournament.Components namespace osu.Game.Tournament.Components
@ -17,6 +19,16 @@ namespace osu.Game.Tournament.Components
private ChannelManager manager; private ChannelManager manager;
public MatchChatDisplay()
{
RelativeSizeAxes = Axes.X;
Y = 100;
Size = new Vector2(0.45f, 112);
Margin = new MarginPadding(10);
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(MatchIPCInfo ipc) private void load(MatchIPCInfo ipc)
{ {

View File

@ -32,13 +32,15 @@ namespace osu.Game.Tournament.Screens.Gameplay
private readonly Color4 red = new Color4(186, 0, 18, 255); private readonly Color4 red = new Color4(186, 0, 18, 255);
private readonly Color4 blue = new Color4(17, 136, 170, 255); private readonly Color4 blue = new Color4(17, 136, 170, 255);
[Resolved] [Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; } private TournamentSceneManager sceneManager { get; set; }
[Resolved]
private MatchChatDisplay chat { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LadderInfo ladder, MatchIPCInfo ipc, MatchChatDisplay chat) private void load(LadderInfo ladder, MatchIPCInfo ipc)
{ {
this.chat = chat;
this.ipc = ipc; this.ipc = ipc;
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
@ -132,7 +134,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
} }
private ScheduledDelegate scheduledOperation; private ScheduledDelegate scheduledOperation;
private MatchChatDisplay chat;
private MatchScoreDisplay scoreDisplay; private MatchScoreDisplay scoreDisplay;
private TourneyState lastState; private TourneyState lastState;
@ -155,7 +156,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
void expand() void expand()
{ {
chat.Expand(); chat?.Expand();
using (BeginDelayedSequence(300, true)) using (BeginDelayedSequence(300, true))
{ {
@ -168,8 +169,8 @@ namespace osu.Game.Tournament.Screens.Gameplay
{ {
SongBar.Expanded = false; SongBar.Expanded = false;
scoreDisplay.FadeOut(100); scoreDisplay.FadeOut(100);
using (chat.BeginDelayedSequence(500)) using (chat?.BeginDelayedSequence(500))
chat.Contract(); chat?.Contract();
} }
switch (state.NewValue) switch (state.NewValue)

View File

@ -32,17 +32,8 @@ namespace osu.Game.Tournament.Screens
private Container screens; private Container screens;
private VideoSprite video; private VideoSprite video;
//todo: make less temporary
[Cached] [Cached]
private MatchChatDisplay chat = new MatchChatDisplay private MatchChatDisplay chat = new MatchChatDisplay();
{
RelativeSizeAxes = Axes.X,
Y = 100,
Size = new Vector2(0.45f, 112),
Margin = new MarginPadding(10),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
};
private Container chatContainer; private Container chatContainer;