2019-01-24 16:43:03 +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.
|
2018-05-16 08:14:10 +08:00
|
|
|
|
|
2019-02-12 10:19:34 +08:00
|
|
|
|
using System;
|
2018-12-11 16:32:01 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2020-02-19 18:42:25 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2020-02-19 18:42:25 +08:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2018-12-27 19:06:07 +08:00
|
|
|
|
using osu.Framework.Logging;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
using osu.Framework.Screens;
|
2019-06-19 12:15:58 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2020-02-19 18:42:25 +08:00
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-12-19 15:56:51 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-12-27 19:06:07 +08:00
|
|
|
|
using osu.Game.Input;
|
2018-12-26 15:46:50 +08:00
|
|
|
|
using osu.Game.Online.API;
|
2018-12-19 15:56:51 +08:00
|
|
|
|
using osu.Game.Online.Multiplayer;
|
2018-05-28 11:28:11 +08:00
|
|
|
|
using osu.Game.Screens.Menu;
|
2020-02-19 18:42:25 +08:00
|
|
|
|
using osu.Game.Screens.Multi.Components;
|
2018-12-10 18:20:41 +08:00
|
|
|
|
using osu.Game.Screens.Multi.Lounge;
|
2019-02-05 14:38:19 +08:00
|
|
|
|
using osu.Game.Screens.Multi.Lounge.Components;
|
2018-12-18 16:07:47 +08:00
|
|
|
|
using osu.Game.Screens.Multi.Match;
|
2020-02-20 17:43:47 +08:00
|
|
|
|
using osu.Game.Screens.Multi.Match.Components;
|
2019-02-12 10:19:34 +08:00
|
|
|
|
using osu.Game.Screens.Play;
|
2018-12-19 15:56:51 +08:00
|
|
|
|
using osuTK;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multi
|
|
|
|
|
{
|
2018-12-11 16:32:01 +08:00
|
|
|
|
[Cached]
|
2019-02-11 18:11:34 +08:00
|
|
|
|
public class Multiplayer : OsuScreen, IOnlineComponent
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2019-02-11 18:11:34 +08:00
|
|
|
|
public override bool CursorVisible => (screenStack.CurrentScreen as IMultiplayerSubScreen)?.CursorVisible ?? true;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
|
2020-02-06 13:22:01 +08:00
|
|
|
|
// this is required due to PlayerLoader eventually being pushed to the main stack
|
|
|
|
|
// while leases may be taken out by a subscreen.
|
2019-02-12 10:19:34 +08:00
|
|
|
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
2019-01-25 19:25:55 +08:00
|
|
|
|
|
|
|
|
|
private readonly MultiplayerWaveContainer waves;
|
2018-12-14 16:35:18 +08:00
|
|
|
|
|
2018-12-19 15:56:51 +08:00
|
|
|
|
private readonly OsuButton createButton;
|
2018-12-26 19:05:57 +08:00
|
|
|
|
private readonly LoungeSubScreen loungeSubScreen;
|
2019-01-23 19:52:00 +08:00
|
|
|
|
private readonly ScreenStack screenStack;
|
2018-12-14 16:35:18 +08:00
|
|
|
|
|
2019-02-08 14:38:05 +08:00
|
|
|
|
private readonly IBindable<bool> isIdle = new BindableBool();
|
|
|
|
|
|
2019-02-05 14:38:19 +08:00
|
|
|
|
[Cached]
|
2020-02-27 18:23:21 +08:00
|
|
|
|
private readonly Bindable<Room> selectedRoom = new Bindable<Room>();
|
2019-02-08 13:57:51 +08:00
|
|
|
|
|
|
|
|
|
[Cached]
|
2019-02-16 10:18:17 +08:00
|
|
|
|
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>(new FilterCriteria());
|
2018-12-14 16:35:18 +08:00
|
|
|
|
|
2018-12-25 10:45:50 +08:00
|
|
|
|
[Cached(Type = typeof(IRoomManager))]
|
2018-12-22 11:45:36 +08:00
|
|
|
|
private RoomManager roomManager;
|
|
|
|
|
|
2019-01-25 19:25:55 +08:00
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuGameBase game { get; set; }
|
|
|
|
|
|
2018-12-26 15:46:50 +08:00
|
|
|
|
[Resolved]
|
2019-03-13 11:56:47 +08:00
|
|
|
|
private IAPIProvider api { get; set; }
|
2018-12-26 15:46:50 +08:00
|
|
|
|
|
2019-01-31 12:50:37 +08:00
|
|
|
|
[Resolved(CanBeNull = true)]
|
2019-01-25 19:25:55 +08:00
|
|
|
|
private OsuLogo logo { get; set; }
|
|
|
|
|
|
2020-02-19 18:42:25 +08:00
|
|
|
|
private readonly Drawable header;
|
|
|
|
|
private readonly Drawable headerBackground;
|
|
|
|
|
|
2018-05-16 08:14:10 +08:00
|
|
|
|
public Multiplayer()
|
|
|
|
|
{
|
2019-01-25 19:47:31 +08:00
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
|
Origin = Anchor.Centre;
|
2019-01-25 19:25:55 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
2019-02-12 12:02:33 +08:00
|
|
|
|
Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING };
|
2019-01-25 19:25:55 +08:00
|
|
|
|
|
2020-03-11 09:18:41 +08:00
|
|
|
|
var backgroundColour = Color4Extensions.FromHex(@"3e3a44");
|
2020-02-19 18:48:34 +08:00
|
|
|
|
|
2019-01-23 19:52:00 +08:00
|
|
|
|
InternalChild = waves = new MultiplayerWaveContainer
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-02-12 12:02:33 +08:00
|
|
|
|
Children = new Drawable[]
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2020-02-19 18:42:25 +08:00
|
|
|
|
new Box
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2019-02-12 12:02:33 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-19 18:48:34 +08:00
|
|
|
|
Colour = backgroundColour,
|
2018-05-16 08:14:10 +08:00
|
|
|
|
},
|
2019-02-12 12:02:33 +08:00
|
|
|
|
new Container
|
2018-12-19 15:56:51 +08:00
|
|
|
|
{
|
2019-02-12 12:02:33 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = Header.HEIGHT },
|
2020-02-19 18:42:25 +08:00
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
header = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 400,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
headerBackground = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Width = 1.25f,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new HeaderBackgroundSprite
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2020-02-20 13:28:38 +08:00
|
|
|
|
Height = 400 // Keep a static height so the header doesn't change as it's resized between subscreens
|
2020-02-19 18:42:25 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Bottom = -1 }, // 1px padding to avoid a 1px gap due to masking
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-19 18:48:34 +08:00
|
|
|
|
Colour = ColourInfo.GradientVertical(backgroundColour.Opacity(0.7f), backgroundColour)
|
2020-02-19 18:42:25 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
screenStack = new MultiplayerSubScreenStack { RelativeSizeAxes = Axes.Both }
|
|
|
|
|
}
|
2018-12-19 15:56:51 +08:00
|
|
|
|
},
|
2019-02-12 12:02:33 +08:00
|
|
|
|
new Header(screenStack),
|
2020-02-20 17:28:20 +08:00
|
|
|
|
createButton = new CreateRoomButton
|
2018-12-26 15:46:50 +08:00
|
|
|
|
{
|
2019-02-12 12:02:33 +08:00
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
2020-02-20 17:28:20 +08:00
|
|
|
|
Action = createRoom
|
2019-02-12 12:02:33 +08:00
|
|
|
|
},
|
|
|
|
|
roomManager = new RoomManager()
|
|
|
|
|
}
|
|
|
|
|
};
|
2018-12-26 19:05:57 +08:00
|
|
|
|
|
2020-01-31 18:10:44 +08:00
|
|
|
|
screenStack.Push(loungeSubScreen = new LoungeSubScreen());
|
|
|
|
|
|
2019-01-23 19:52:00 +08:00
|
|
|
|
screenStack.ScreenPushed += screenPushed;
|
|
|
|
|
screenStack.ScreenExited += screenExited;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-27 19:17:27 +08:00
|
|
|
|
[BackgroundDependencyLoader(true)]
|
2018-12-27 19:06:07 +08:00
|
|
|
|
private void load(IdleTracker idleTracker)
|
2018-12-27 16:12:47 +08:00
|
|
|
|
{
|
|
|
|
|
api.Register(this);
|
2018-12-27 19:17:27 +08:00
|
|
|
|
|
|
|
|
|
if (idleTracker != null)
|
|
|
|
|
isIdle.BindTo(idleTracker.IsIdle);
|
2018-12-27 19:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
2019-02-22 19:13:38 +08:00
|
|
|
|
isIdle.BindValueChanged(idle => updatePollingRate(idle.NewValue), true);
|
2018-12-27 19:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-05 14:56:18 +08:00
|
|
|
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
|
{
|
2019-02-12 12:02:33 +08:00
|
|
|
|
var dependencies = new CachedModelDependencyContainer<Room>(base.CreateChildDependencies(parent));
|
2020-02-27 18:23:21 +08:00
|
|
|
|
dependencies.Model.BindTo(selectedRoom);
|
2019-02-05 14:56:18 +08:00
|
|
|
|
return dependencies;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-27 19:06:07 +08:00
|
|
|
|
private void updatePollingRate(bool idle)
|
|
|
|
|
{
|
2020-02-27 18:23:21 +08:00
|
|
|
|
if (!this.IsCurrentScreen())
|
|
|
|
|
{
|
|
|
|
|
roomManager.TimeBetweenListingPolls = 0;
|
|
|
|
|
roomManager.TimeBetweenSelectionPolls = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (screenStack.CurrentScreen)
|
|
|
|
|
{
|
|
|
|
|
case LoungeSubScreen _:
|
|
|
|
|
roomManager.TimeBetweenListingPolls = idle ? 120000 : 15000;
|
2020-02-27 18:42:19 +08:00
|
|
|
|
roomManager.TimeBetweenSelectionPolls = idle ? 120000 : 15000;
|
2020-02-27 18:23:21 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MatchSubScreen _:
|
|
|
|
|
roomManager.TimeBetweenListingPolls = 0;
|
|
|
|
|
roomManager.TimeBetweenSelectionPolls = idle ? 30000 : 5000;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
roomManager.TimeBetweenListingPolls = 0;
|
|
|
|
|
roomManager.TimeBetweenSelectionPolls = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Logger.Log($"Polling adjusted (listing: {roomManager.TimeBetweenListingPolls}, selection: {roomManager.TimeBetweenSelectionPolls})");
|
2018-12-27 16:12:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-12 12:02:33 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Push a <see cref="Player"/> to the main screen stack to begin gameplay.
|
|
|
|
|
/// Generally called from a <see cref="MatchSubScreen"/> via DI resolution.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Start(Func<Player> player)
|
2019-02-08 14:39:11 +08:00
|
|
|
|
{
|
|
|
|
|
if (!this.IsCurrentScreen())
|
|
|
|
|
return;
|
|
|
|
|
|
2019-02-12 12:02:33 +08:00
|
|
|
|
this.Push(new PlayerLoader(player));
|
2019-02-08 14:39:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 11:56:47 +08:00
|
|
|
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
2018-12-27 16:12:47 +08:00
|
|
|
|
{
|
|
|
|
|
if (state != APIState.Online)
|
2019-10-31 12:43:25 +08:00
|
|
|
|
Schedule(forcefullyExit);
|
2018-12-27 16:12:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void forcefullyExit()
|
|
|
|
|
{
|
|
|
|
|
// This is temporary since we don't currently have a way to force screens to be exited
|
2019-01-23 19:52:00 +08:00
|
|
|
|
if (this.IsCurrentScreen())
|
2019-10-31 12:42:11 +08:00
|
|
|
|
{
|
|
|
|
|
while (this.IsCurrentScreen())
|
|
|
|
|
this.Exit();
|
|
|
|
|
}
|
2018-12-27 16:12:47 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2019-01-23 19:52:00 +08:00
|
|
|
|
this.MakeCurrent();
|
2018-12-27 16:12:47 +08:00
|
|
|
|
Schedule(forcefullyExit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 18:11:34 +08:00
|
|
|
|
public override void OnEntering(IScreen last)
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2019-01-23 19:52:00 +08:00
|
|
|
|
this.FadeIn();
|
2018-05-16 08:14:10 +08:00
|
|
|
|
waves.Show();
|
2019-06-19 12:15:58 +08:00
|
|
|
|
|
|
|
|
|
beginHandlingTrack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnResuming(IScreen last)
|
|
|
|
|
{
|
|
|
|
|
this.FadeIn(250);
|
|
|
|
|
this.ScaleTo(1, 250, Easing.OutSine);
|
|
|
|
|
|
|
|
|
|
base.OnResuming(last);
|
|
|
|
|
|
|
|
|
|
beginHandlingTrack();
|
2020-02-27 18:23:21 +08:00
|
|
|
|
|
|
|
|
|
updatePollingRate(isIdle.Value);
|
2019-06-19 12:15:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnSuspending(IScreen next)
|
|
|
|
|
{
|
|
|
|
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
|
|
|
|
this.FadeOut(250);
|
|
|
|
|
|
|
|
|
|
endHandlingTrack();
|
|
|
|
|
|
2020-02-27 18:23:21 +08:00
|
|
|
|
updatePollingRate(isIdle.Value);
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 18:11:34 +08:00
|
|
|
|
public override bool OnExiting(IScreen next)
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2019-10-30 13:42:14 +08:00
|
|
|
|
roomManager.PartRoom();
|
|
|
|
|
|
2019-07-29 09:33:34 +08:00
|
|
|
|
if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen))
|
2019-06-25 16:29:37 +08:00
|
|
|
|
{
|
|
|
|
|
screenStack.Exit();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 08:14:10 +08:00
|
|
|
|
waves.Hide();
|
2018-12-18 16:07:47 +08:00
|
|
|
|
|
2019-01-23 19:52:00 +08:00
|
|
|
|
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
2018-12-26 19:05:57 +08:00
|
|
|
|
|
2019-01-30 22:56:03 +08:00
|
|
|
|
if (screenStack.CurrentScreen != null)
|
|
|
|
|
loungeSubScreen.MakeCurrent();
|
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
endHandlingTrack();
|
2018-12-20 19:58:34 +08:00
|
|
|
|
|
2019-02-12 12:29:41 +08:00
|
|
|
|
base.OnExiting(next);
|
2019-01-25 19:25:55 +08:00
|
|
|
|
return false;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-12 12:29:41 +08:00
|
|
|
|
protected override void LogoExiting(OsuLogo logo)
|
|
|
|
|
{
|
|
|
|
|
base.LogoExiting(logo);
|
|
|
|
|
|
|
|
|
|
// the wave overlay transition takes longer than expected to run.
|
|
|
|
|
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-20 17:28:20 +08:00
|
|
|
|
private void createRoom()
|
|
|
|
|
{
|
|
|
|
|
loungeSubScreen.Open(new Room { Name = { Value = $"{api.LocalUser}'s awesome room" } });
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
private void beginHandlingTrack()
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2019-06-19 12:15:58 +08:00
|
|
|
|
Beatmap.BindValueChanged(updateTrack, true);
|
|
|
|
|
}
|
2019-01-25 20:02:35 +08:00
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
private void endHandlingTrack()
|
|
|
|
|
{
|
|
|
|
|
cancelLooping();
|
|
|
|
|
Beatmap.ValueChanged -= updateTrack;
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-19 18:42:25 +08:00
|
|
|
|
private void screenPushed(IScreen lastScreen, IScreen newScreen)
|
|
|
|
|
{
|
|
|
|
|
subScreenChanged(newScreen);
|
|
|
|
|
}
|
2019-06-19 12:15:58 +08:00
|
|
|
|
|
|
|
|
|
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
2018-05-16 08:14:10 +08:00
|
|
|
|
{
|
2019-06-19 12:15:58 +08:00
|
|
|
|
subScreenChanged(newScreen);
|
2018-12-11 16:32:01 +08:00
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
|
|
|
|
|
this.Exit();
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
private void subScreenChanged(IScreen newScreen)
|
2018-12-26 21:37:09 +08:00
|
|
|
|
{
|
2020-02-19 18:42:25 +08:00
|
|
|
|
switch (newScreen)
|
|
|
|
|
{
|
|
|
|
|
case LoungeSubScreen _:
|
2020-02-20 17:03:53 +08:00
|
|
|
|
header.Delay(MultiplayerSubScreen.RESUME_TRANSITION_DELAY).ResizeHeightTo(400, MultiplayerSubScreen.APPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
headerBackground.MoveToX(0, MultiplayerSubScreen.X_MOVE_DURATION, Easing.OutQuint);
|
2020-02-19 18:42:25 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MatchSubScreen _:
|
2020-02-20 17:03:53 +08:00
|
|
|
|
header.ResizeHeightTo(135, MultiplayerSubScreen.APPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
headerBackground.MoveToX(-MultiplayerSubScreen.X_SHIFT, MultiplayerSubScreen.X_MOVE_DURATION, Easing.OutQuint);
|
2020-02-19 18:42:25 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
updatePollingRate(isIdle.Value);
|
2019-06-24 10:54:41 +08:00
|
|
|
|
createButton.FadeTo(newScreen is LoungeSubScreen ? 1 : 0, 200);
|
2019-02-11 15:30:12 +08:00
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
updateTrack();
|
2018-12-26 21:37:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
private void updateTrack(ValueChangedEvent<WorkingBeatmap> _ = null)
|
2018-12-18 16:07:47 +08:00
|
|
|
|
{
|
2020-02-06 13:22:01 +08:00
|
|
|
|
if (screenStack.CurrentScreen is MatchSubScreen)
|
2018-12-18 16:07:47 +08:00
|
|
|
|
{
|
2019-06-19 12:15:58 +08:00
|
|
|
|
var track = Beatmap.Value?.Track;
|
2019-04-01 11:16:05 +08:00
|
|
|
|
|
2018-12-18 16:07:47 +08:00
|
|
|
|
if (track != null)
|
|
|
|
|
{
|
2019-06-17 11:44:19 +08:00
|
|
|
|
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
|
2018-12-18 16:07:47 +08:00
|
|
|
|
track.Looping = true;
|
|
|
|
|
|
|
|
|
|
if (!track.IsRunning)
|
2019-06-17 11:44:19 +08:00
|
|
|
|
track.Restart();
|
2018-12-18 16:07:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-19 12:15:58 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cancelLooping();
|
|
|
|
|
}
|
2018-12-18 16:07:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
private void cancelLooping()
|
2018-12-14 16:35:18 +08:00
|
|
|
|
{
|
2019-06-19 12:15:58 +08:00
|
|
|
|
var track = Beatmap?.Value?.Track;
|
2019-01-25 19:25:55 +08:00
|
|
|
|
|
2019-06-19 12:15:58 +08:00
|
|
|
|
if (track != null)
|
|
|
|
|
{
|
|
|
|
|
track.Looping = false;
|
|
|
|
|
track.RestartPoint = 0;
|
|
|
|
|
}
|
2018-12-14 16:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-27 16:12:47 +08:00
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
|
api?.Unregister(this);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 08:14:10 +08:00
|
|
|
|
private class MultiplayerWaveContainer : WaveContainer
|
|
|
|
|
{
|
|
|
|
|
protected override bool StartHidden => true;
|
|
|
|
|
|
|
|
|
|
public MultiplayerWaveContainer()
|
|
|
|
|
{
|
2020-03-11 09:18:41 +08:00
|
|
|
|
FirstWaveColour = Color4Extensions.FromHex(@"654d8c");
|
|
|
|
|
SecondWaveColour = Color4Extensions.FromHex(@"554075");
|
|
|
|
|
ThirdWaveColour = Color4Extensions.FromHex(@"44325e");
|
|
|
|
|
FourthWaveColour = Color4Extensions.FromHex(@"392850");
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-19 18:42:25 +08:00
|
|
|
|
|
|
|
|
|
private class HeaderBackgroundSprite : MultiplayerBackgroundSprite
|
|
|
|
|
{
|
|
|
|
|
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new BackgroundSprite { RelativeSizeAxes = Axes.Both };
|
|
|
|
|
|
|
|
|
|
private class BackgroundSprite : UpdateableBeatmapBackgroundSprite
|
|
|
|
|
{
|
|
|
|
|
protected override double TransformDuration => 200;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-20 17:28:20 +08:00
|
|
|
|
|
2020-02-20 17:43:47 +08:00
|
|
|
|
public class CreateRoomButton : PurpleTriangleButton
|
2020-02-20 17:28:20 +08:00
|
|
|
|
{
|
|
|
|
|
public CreateRoomButton()
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(150, Header.HEIGHT - 20);
|
|
|
|
|
Margin = new MarginPadding
|
|
|
|
|
{
|
|
|
|
|
Top = 10,
|
|
|
|
|
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
Triangles.TriangleScale = 1.5f;
|
|
|
|
|
|
|
|
|
|
Text = "Create room";
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-16 08:14:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|