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

Animate song bar based on game mode

This commit is contained in:
Dean Herbert 2018-11-11 01:29:42 +09:00
parent 976180ecc2
commit 86423dce5f
4 changed files with 53 additions and 18 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -11,6 +12,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Menu;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Tournament.Components
{
@ -44,6 +46,28 @@ namespace osu.Game.Tournament.Components
}
private Container panelContents;
private Container innerPanel;
private Container outerPanel;
private const float main_width = 0.97f;
public bool Expanded
{
set
{
if (value)
{
innerPanel.ResizeWidthTo(0.7f, 800, Easing.OutQuint);
outerPanel.ResizeWidthTo(main_width, 800, Easing.OutQuint);
}
else
{
innerPanel.ResizeWidthTo(1, 800, Easing.OutQuint);
outerPanel.ResizeWidthTo(0.3f, 800, Easing.OutQuint);
}
}
}
[BackgroundDependencyLoader]
private void load()
@ -52,12 +76,20 @@ namespace osu.Game.Tournament.Components
InternalChildren = new Drawable[]
{
new Container
outerPanel = new Container
{
Masking = true,
EdgeEffect = new EdgeEffectParameters
{
Colour = Color4.Black.Opacity(0.2f),
Type = EdgeEffectType.Shadow,
Radius = 5,
},
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
RelativePositionAxes = Axes.X,
X = -(1 - main_width) / 2,
Y = -10,
Width = 0.95f,
Height = TournamentBeatmapPanel.HEIGHT,
@ -69,7 +101,7 @@ namespace osu.Game.Tournament.Components
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.93f),
},
new Container
innerPanel = new Container
{
Masking = true,
CornerRadius = TournamentBeatmapPanel.HEIGHT / 2,

View File

@ -87,9 +87,8 @@ namespace osu.Game.Tournament.IPC
State.Value = (TourneyState)Enum.Parse(typeof(TourneyState), sr.ReadLine());
}
}
catch (Exception e)
catch (Exception)
{
Logger.Log(e.ToString(), LoggingTarget.Runtime);
// file might be in use.
}
@ -102,9 +101,8 @@ namespace osu.Game.Tournament.IPC
Score2 = int.Parse(sr.ReadLine());
}
}
catch (Exception e)
catch (Exception)
{
Logger.Log(e.ToString(), LoggingTarget.Runtime);
// file might be in use.
}
}, 250, true);

View File

@ -19,8 +19,8 @@ namespace osu.Game.Tournament.Screens
{
Add(SongBar = new SongBar
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
});
}

View File

@ -54,7 +54,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
Colour = Color4.Gray,
RelativeSizeAxes = Axes.X,
Text = "Toggle warmup",
Action = toggleWarmup
Action = () => warmup.Toggle()
}
}
}
@ -64,6 +64,8 @@ namespace osu.Game.Tournament.Screens.Gameplay
State.BindTo(ipc.State);
currentMatch.BindTo(ladder.CurrentMatch);
warmup.BindValueChanged(w => warmupButton.Colour = !w ? Color4.White : Color4.Gray, true);
}
private void stateChanged(TourneyState state)
@ -77,15 +79,18 @@ namespace osu.Game.Tournament.Screens.Gameplay
else
currentMatch.Value.Team2Score.Value++;
}
}
private void toggleWarmup()
{
warmup.Toggle();
if (warmup.Value)
warmupButton.Colour = Color4.White;
if (state == TourneyState.Idle)
{
// show chat
SongBar.Expanded = false;
}
else
warmupButton.Colour = Color4.Gray;
{
SongBar.Expanded = true;
}
}
}
}