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-06 05:49:09 +00:00
|
|
|
|
2020-06-09 18:22:30 +00:00
|
|
|
using System.Drawing;
|
2020-03-11 01:18:41 +00:00
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2020-06-09 18:22:30 +00:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Configuration;
|
2018-11-06 16:20:32 +00:00
|
|
|
using osu.Framework.Graphics;
|
2020-06-09 18:22:30 +00:00
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-03-06 07:03:18 +00:00
|
|
|
using osu.Framework.Graphics.Colour;
|
2018-11-06 16:20:32 +00:00
|
|
|
using osu.Game.Graphics.Cursor;
|
2020-03-06 07:03:18 +00:00
|
|
|
using osu.Game.Tournament.Models;
|
2020-06-09 18:22:30 +00:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osuTK;
|
2020-03-03 10:14:44 +00:00
|
|
|
using osuTK.Graphics;
|
2018-11-06 05:49:09 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Tournament
|
|
|
|
{
|
2018-11-06 09:32:59 +00:00
|
|
|
public class TournamentGame : TournamentGameBase
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
2020-03-06 07:03:18 +00:00
|
|
|
public static ColourInfo GetTeamColour(TeamColour teamColour) => teamColour == TeamColour.Red ? COLOUR_RED : COLOUR_BLUE;
|
|
|
|
|
2020-03-11 01:18:41 +00:00
|
|
|
public static readonly Color4 COLOUR_RED = Color4Extensions.FromHex("#AA1414");
|
|
|
|
public static readonly Color4 COLOUR_BLUE = Color4Extensions.FromHex("#1462AA");
|
2020-03-06 07:03:18 +00:00
|
|
|
|
2020-03-11 01:18:41 +00:00
|
|
|
public static readonly Color4 ELEMENT_BACKGROUND_COLOUR = Color4Extensions.FromHex("#fff");
|
|
|
|
public static readonly Color4 ELEMENT_FOREGROUND_COLOUR = Color4Extensions.FromHex("#000");
|
2020-03-06 07:03:18 +00:00
|
|
|
|
2020-03-11 01:18:41 +00:00
|
|
|
public static readonly Color4 TEXT_COLOUR = Color4Extensions.FromHex("#fff");
|
2020-06-09 18:22:30 +00:00
|
|
|
private Drawable heightWarning;
|
|
|
|
private Bindable<Size> windowSize;
|
2020-08-20 10:41:27 +00:00
|
|
|
private Bindable<WindowMode> windowMode;
|
2020-03-03 10:14:44 +00:00
|
|
|
|
2020-06-09 18:22:30 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(FrameworkConfigManager frameworkConfig)
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
2020-06-09 18:22:30 +00:00
|
|
|
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
|
|
|
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
|
|
|
{
|
|
|
|
var minWidth = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
|
2018-11-06 16:20:32 +00:00
|
|
|
|
2020-06-09 18:22:30 +00:00
|
|
|
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
|
|
|
}), true);
|
|
|
|
|
2020-08-20 10:41:27 +00:00
|
|
|
windowMode = frameworkConfig.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
|
|
|
windowMode.BindValueChanged(mode => ScheduleAfterChildren(() =>
|
|
|
|
{
|
|
|
|
windowMode.Value = WindowMode.Windowed;
|
|
|
|
}), true);
|
|
|
|
|
2020-06-09 18:22:30 +00:00
|
|
|
AddRange(new[]
|
2018-11-06 16:20:32 +00:00
|
|
|
{
|
2020-06-09 18:22:30 +00:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
CornerRadius = 10,
|
|
|
|
Depth = float.MinValue,
|
|
|
|
Position = new Vector2(5),
|
|
|
|
Masking = true,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
Origin = Anchor.BottomRight,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
Colour = OsuColour.Gray(0.2f),
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
new TourneyButton
|
|
|
|
{
|
|
|
|
Text = "Save Changes",
|
|
|
|
Width = 140,
|
|
|
|
Height = 50,
|
|
|
|
Padding = new MarginPadding
|
|
|
|
{
|
|
|
|
Top = 10,
|
|
|
|
Left = 10,
|
|
|
|
},
|
|
|
|
Margin = new MarginPadding
|
|
|
|
{
|
|
|
|
Right = 10,
|
|
|
|
Bottom = 10,
|
|
|
|
},
|
|
|
|
Action = SaveChanges,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2020-09-02 06:18:51 +00:00
|
|
|
heightWarning = new WarningBox("Please make the window wider"),
|
2020-06-09 18:22:30 +00:00
|
|
|
new OsuContextMenuContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Child = new TournamentSceneManager()
|
|
|
|
}
|
2018-11-06 16:20:32 +00:00
|
|
|
});
|
2020-06-09 18:22:30 +00:00
|
|
|
}
|
2018-11-06 05:49:09 +00:00
|
|
|
}
|
|
|
|
}
|