2020-12-19 01:55:48 +08: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.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Graphics;
|
2020-12-25 12:38:11 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-25 23:50:00 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Components;
|
2020-12-19 01:55:48 +08:00
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Playlists
|
2020-12-19 01:55:48 +08:00
|
|
|
{
|
2020-12-25 12:11:21 +08:00
|
|
|
public class PlaylistsReadyButton : ReadyButton
|
2020-12-19 01:55:48 +08:00
|
|
|
{
|
|
|
|
[Resolved(typeof(Room), nameof(Room.EndDate))]
|
2020-12-21 15:18:39 +08:00
|
|
|
private Bindable<DateTimeOffset?> endDate { get; set; }
|
2020-12-19 01:55:48 +08:00
|
|
|
|
2020-12-25 12:11:21 +08:00
|
|
|
public PlaylistsReadyButton()
|
2020-12-19 01:55:48 +08:00
|
|
|
{
|
|
|
|
Text = "Start";
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
|
|
|
BackgroundColour = colours.Green;
|
|
|
|
Triangles.ColourDark = colours.Green;
|
|
|
|
Triangles.ColourLight = colours.GreenLight;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2020-12-21 15:18:39 +08:00
|
|
|
Enabled.Value = endDate.Value != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(GameBeatmap.Value.Track.Length) < endDate.Value;
|
2020-12-19 01:55:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|