Centralise chat display

This commit is contained in:
Dean Herbert 2018-11-17 21:27:02 +09:00
parent 8b820f7346
commit 4b047ad9cc
3 changed files with 51 additions and 18 deletions

View File

@ -207,5 +207,17 @@ namespace osu.Game.Tournament.Components
}
}
}
public void Contract()
{
this.FadeIn(300);
this.MoveToY(0, 500, Easing.OutQuint);
}
public void Expand()
{
this.FadeOut(200);
this.MoveToY(100, 500, Easing.In);
}
}
}

View File

@ -13,7 +13,6 @@ using osu.Game.Tournament.Components;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Screens.Gameplay.Components;
using osu.Game.Tournament.Screens.Ladder.Components;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay
@ -32,9 +31,11 @@ namespace osu.Game.Tournament.Screens.Gameplay
private readonly Color4 blue = new Color4(17, 136, 170, 255);
[BackgroundDependencyLoader]
private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc)
private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc, MatchChatDisplay chat)
{
this.chat = chat;
this.ipc = ipc;
AddRange(new Drawable[]
{
new MatchHeader(),
@ -83,15 +84,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
},
}
},
chat = new MatchChatDisplay
{
RelativeSizeAxes = Axes.X,
Y = 100,
Size = new Vector2(0.45f, 120),
Margin = new MarginPadding(10),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
},
scoreDisplay = new MatchScoreDisplay
{
Y = -65,
@ -147,8 +139,8 @@ namespace osu.Game.Tournament.Screens.Gameplay
void expand()
{
chat.FadeOut(200);
chat.MoveToY(100, 500, Easing.In);
chat.Expand();
using (BeginDelayedSequence(300, true))
{
scoreDisplay.FadeIn(100);
@ -161,10 +153,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
SongBar.Expanded = false;
scoreDisplay.FadeOut(100);
using (chat.BeginDelayedSequence(500))
{
chat.FadeIn(300);
chat.MoveToY(0, 500, Easing.OutQuint);
}
chat.Contract();
}
switch (state)
@ -176,6 +165,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
scheduledBarContract = Scheduler.AddDelayed(contract, 10000);
break;
default:
chat.Expand();
expand();
break;
}

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Video;
using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Drawings;
using osu.Game.Tournament.Screens.Gameplay;
using osu.Game.Tournament.Screens.Groupings;
@ -38,6 +39,20 @@ namespace osu.Game.Tournament.Screens
private ShowcaseScreen showcase;
private VideoSprite video;
//todo: make less temporary
[Cached]
private MatchChatDisplay chat = new MatchChatDisplay
{
RelativeSizeAxes = Axes.X,
Y = 100,
Size = new Vector2(0.45f, 120),
Margin = new MarginPadding(10),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
};
private Container chatContainer;
[BackgroundDependencyLoader]
private void load(LadderInfo ladder, Storage storage)
{
@ -48,7 +63,7 @@ namespace osu.Game.Tournament.Screens
RelativeSizeAxes = Axes.Both,
X = 200,
FillMode = FillMode.Fit,
FillAspectRatio = 16/9f,
FillAspectRatio = 16 / 9f,
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Size = new Vector2(0.8f, 1),
@ -78,6 +93,11 @@ namespace osu.Game.Tournament.Screens
winner = new TeamWinScreen()
}
},
chatContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Child = chat
},
}
},
new Container
@ -135,6 +155,17 @@ namespace osu.Game.Tournament.Screens
else
s.Hide();
}
switch (screen)
{
case GameplayScreen _:
case MapPoolScreen _:
chatContainer.FadeIn(100);
break;
default:
chatContainer.FadeOut(100);
break;
}
}
}
}