2020-12-20 22:40:19 +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;
|
2021-02-01 12:40:59 +08:00
|
|
|
using System.Collections.Generic;
|
2020-12-20 22:40:19 +08:00
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
2020-12-24 15:53:25 +08:00
|
|
|
using osu.Framework.Audio;
|
|
|
|
using osu.Framework.Audio.Sample;
|
2020-12-20 22:40:19 +08:00
|
|
|
using osu.Framework.Bindables;
|
2021-08-12 18:51:03 +08:00
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2021-02-16 14:14:48 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-08-12 18:51:03 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-12-20 22:40:19 +08:00
|
|
|
using osu.Framework.Screens;
|
|
|
|
using osu.Game.Audio;
|
|
|
|
using osu.Game.Beatmaps;
|
2020-12-25 12:38:11 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-22 18:53:01 +08:00
|
|
|
using osu.Game.Overlays;
|
2021-02-16 14:14:48 +08:00
|
|
|
using osu.Game.Overlays.Mods;
|
2021-11-15 15:13:03 +08:00
|
|
|
using osu.Game.Rulesets;
|
2020-12-20 22:40:19 +08:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2021-08-13 13:04:43 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
2020-12-20 22:40:19 +08:00
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Match
|
2020-12-20 22:40:19 +08:00
|
|
|
{
|
|
|
|
[Cached(typeof(IPreviewTrackOwner))]
|
2020-12-26 00:02:35 +08:00
|
|
|
public abstract class RoomSubScreen : OnlinePlaySubScreen, IPreviewTrackOwner
|
2020-12-20 22:40:19 +08:00
|
|
|
{
|
2021-02-16 16:35:44 +08:00
|
|
|
[Cached(typeof(IBindable<PlaylistItem>))]
|
2021-12-10 19:08:59 +08:00
|
|
|
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
2020-12-20 22:40:19 +08:00
|
|
|
|
2021-09-17 12:23:02 +08:00
|
|
|
public override bool? AllowTrackAdjustments => true;
|
|
|
|
|
2021-08-20 20:40:35 +08:00
|
|
|
protected override BackgroundScreen CreateBackground() => new RoomBackgroundScreen(Room.Playlist.FirstOrDefault())
|
|
|
|
{
|
|
|
|
SelectedItem = { BindTarget = SelectedItem }
|
|
|
|
};
|
2021-08-20 17:14:12 +08:00
|
|
|
|
2020-12-20 22:40:19 +08:00
|
|
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
|
|
|
|
2021-02-16 14:14:48 +08:00
|
|
|
/// <summary>
|
|
|
|
/// A container that provides controls for selection of user mods.
|
|
|
|
/// This will be shown/hidden automatically when applicable.
|
|
|
|
/// </summary>
|
|
|
|
protected Drawable UserModsSection;
|
|
|
|
|
2021-01-19 16:11:40 +08:00
|
|
|
private Sample sampleStart;
|
2020-12-24 15:53:25 +08:00
|
|
|
|
2021-02-01 12:40:59 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Any mods applied by/to the local user.
|
|
|
|
/// </summary>
|
2021-02-01 16:57:32 +08:00
|
|
|
protected readonly Bindable<IReadOnlyList<Mod>> UserMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
2021-02-01 12:40:59 +08:00
|
|
|
|
2021-08-18 15:09:00 +08:00
|
|
|
protected readonly IBindable<long?> RoomId = new Bindable<long?>();
|
|
|
|
|
2020-12-22 18:53:01 +08:00
|
|
|
[Resolved]
|
|
|
|
private MusicController music { get; set; }
|
|
|
|
|
2020-12-20 22:40:19 +08:00
|
|
|
[Resolved]
|
|
|
|
private BeatmapManager beatmapManager { get; set; }
|
|
|
|
|
2021-11-15 15:13:03 +08:00
|
|
|
[Resolved]
|
|
|
|
private RulesetStore rulesets { get; set; }
|
|
|
|
|
2020-12-24 15:53:25 +08:00
|
|
|
[Resolved(canBeNull: true)]
|
2020-12-26 00:00:00 +08:00
|
|
|
protected OnlinePlayScreen ParentScreen { get; private set; }
|
2020-12-24 15:53:25 +08:00
|
|
|
|
2021-01-17 04:02:30 +08:00
|
|
|
[Cached]
|
2021-12-13 15:09:53 +08:00
|
|
|
private readonly OnlinePlayBeatmapAvailabilityTracker beatmapAvailabilityTracker = new OnlinePlayBeatmapAvailabilityTracker();
|
2021-10-29 11:02:10 +08:00
|
|
|
|
|
|
|
protected IBindable<BeatmapAvailability> BeatmapAvailability => beatmapAvailabilityTracker.Availability;
|
2021-01-17 04:02:30 +08:00
|
|
|
|
2021-08-18 15:09:00 +08:00
|
|
|
public readonly Room Room;
|
2021-08-18 15:35:18 +08:00
|
|
|
private readonly bool allowEdit;
|
2021-08-17 16:05:20 +08:00
|
|
|
|
|
|
|
private ModSelectOverlay userModsSelectOverlay;
|
2021-08-18 14:16:48 +08:00
|
|
|
private RoomSettingsOverlay settingsOverlay;
|
2021-08-18 15:09:00 +08:00
|
|
|
private Drawable mainContent;
|
2021-08-17 16:05:20 +08:00
|
|
|
|
2021-08-18 15:35:18 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new <see cref="RoomSubScreen"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="room">The <see cref="Room"/>.</param>
|
|
|
|
/// <param name="allowEdit">Whether to allow editing room settings post-creation.</param>
|
|
|
|
protected RoomSubScreen(Room room, bool allowEdit = true)
|
2021-01-17 04:02:30 +08:00
|
|
|
{
|
2021-08-18 15:09:00 +08:00
|
|
|
Room = room;
|
2021-08-18 15:35:18 +08:00
|
|
|
this.allowEdit = allowEdit;
|
2021-08-17 16:05:20 +08:00
|
|
|
|
2021-08-12 17:02:00 +08:00
|
|
|
Padding = new MarginPadding { Top = Header.HEIGHT };
|
|
|
|
|
2021-08-18 15:09:00 +08:00
|
|
|
RoomId.BindTo(room.RoomID);
|
2021-01-17 04:02:30 +08:00
|
|
|
}
|
|
|
|
|
2020-12-24 15:53:25 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(AudioManager audio)
|
|
|
|
{
|
|
|
|
sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection");
|
2021-08-17 16:05:20 +08:00
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2021-10-29 11:02:10 +08:00
|
|
|
beatmapAvailabilityTracker,
|
2021-08-17 16:05:20 +08:00
|
|
|
new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-08-17 16:13:25 +08:00
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
2021-08-18 19:21:29 +08:00
|
|
|
new Dimension(GridSizeMode.Absolute, 50)
|
2021-08-17 16:13:25 +08:00
|
|
|
},
|
2021-08-17 16:05:20 +08:00
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
// Padded main content (drawable room + main content)
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-08-17 16:13:25 +08:00
|
|
|
Padding = new MarginPadding
|
|
|
|
{
|
|
|
|
Horizontal = WaveOverlayContainer.WIDTH_PADDING,
|
|
|
|
Bottom = 30
|
|
|
|
},
|
2021-08-17 17:24:04 +08:00
|
|
|
Children = new[]
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
mainContent = new GridContainer
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
RowDimensions = new[]
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 10)
|
2021-08-17 16:05:20 +08:00
|
|
|
},
|
2021-08-17 17:24:04 +08:00
|
|
|
Content = new[]
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
new Drawable[]
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-18 15:35:18 +08:00
|
|
|
new DrawableMatchRoom(Room, allowEdit)
|
2021-08-18 14:16:48 +08:00
|
|
|
{
|
2021-08-20 20:07:51 +08:00
|
|
|
OnEdit = () => settingsOverlay.Show(),
|
|
|
|
SelectedItem = { BindTarget = SelectedItem }
|
2021-08-18 14:16:48 +08:00
|
|
|
}
|
2021-08-17 17:24:04 +08:00
|
|
|
},
|
|
|
|
null,
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new[]
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
new Container
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-08-17 17:24:04 +08:00
|
|
|
Masking = true,
|
|
|
|
CornerRadius = 10,
|
|
|
|
Child = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-08-18 19:21:29 +08:00
|
|
|
Colour = Color4Extensions.FromHex(@"3e3a44") // Temporary.
|
2021-08-17 17:24:04 +08:00
|
|
|
},
|
2021-08-17 16:05:20 +08:00
|
|
|
},
|
2021-08-18 14:54:33 +08:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-08-18 16:28:20 +08:00
|
|
|
Padding = new MarginPadding(20),
|
2021-08-18 14:54:33 +08:00
|
|
|
Child = CreateMainContent(),
|
|
|
|
},
|
2021-08-17 17:24:04 +08:00
|
|
|
new Container
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-17 17:24:04 +08:00
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Child = userModsSelectOverlay = new UserModSelectOverlay
|
|
|
|
{
|
|
|
|
SelectedMods = { BindTarget = UserMods },
|
|
|
|
IsValidMod = _ => false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2021-08-17 16:05:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-17 17:24:04 +08:00
|
|
|
},
|
2021-08-18 14:29:01 +08:00
|
|
|
new Container
|
2021-08-18 14:11:52 +08:00
|
|
|
{
|
2021-08-18 14:29:01 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
// Resolves 1px masking errors between the settings overlay and the room panel.
|
|
|
|
Padding = new MarginPadding(-1),
|
2021-08-19 15:40:27 +08:00
|
|
|
Child = settingsOverlay = CreateRoomSettingsOverlay(Room)
|
2021-08-18 14:29:01 +08:00
|
|
|
}
|
2021-08-17 17:24:04 +08:00
|
|
|
},
|
|
|
|
},
|
2021-08-17 16:05:20 +08:00
|
|
|
},
|
|
|
|
// Footer
|
2021-08-18 19:21:29 +08:00
|
|
|
new Drawable[]
|
2021-08-17 16:05:20 +08:00
|
|
|
{
|
2021-08-18 19:21:29 +08:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-08-19 18:08:46 +08:00
|
|
|
Children = new Drawable[]
|
2021-08-18 19:21:29 +08:00
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4Extensions.FromHex(@"28242d") // Temporary.
|
|
|
|
},
|
2021-08-19 18:08:46 +08:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Padding = new MarginPadding(5),
|
|
|
|
Child = CreateFooter()
|
|
|
|
},
|
2021-08-18 19:21:29 +08:00
|
|
|
}
|
|
|
|
}
|
2021-08-17 16:05:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-12-24 15:53:25 +08:00
|
|
|
}
|
|
|
|
|
2020-12-20 22:40:19 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-08-18 15:09:00 +08:00
|
|
|
RoomId.BindValueChanged(id =>
|
|
|
|
{
|
|
|
|
if (id.NewValue == null)
|
|
|
|
{
|
|
|
|
// A new room is being created.
|
|
|
|
// The main content should be hidden until the settings overlay is hidden, signaling the room is ready to be displayed.
|
|
|
|
mainContent.Hide();
|
|
|
|
settingsOverlay.Show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mainContent.Show();
|
|
|
|
settingsOverlay.Hide();
|
|
|
|
}
|
|
|
|
}, true);
|
|
|
|
|
2020-12-20 22:40:19 +08:00
|
|
|
SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged));
|
2021-02-11 15:00:35 +08:00
|
|
|
UserMods.BindValueChanged(_ => Scheduler.AddOnce(UpdateMods));
|
2021-12-13 15:09:53 +08:00
|
|
|
|
|
|
|
beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem);
|
|
|
|
beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateWorkingBeatmap());
|
2020-12-22 18:53:01 +08:00
|
|
|
}
|
|
|
|
|
2021-08-19 15:53:07 +08:00
|
|
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
{
|
|
|
|
return new CachedModelDependencyContainer<Room>(base.CreateChildDependencies(parent))
|
|
|
|
{
|
|
|
|
Model = { Value = Room }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-02-16 14:14:48 +08:00
|
|
|
public override bool OnBackButton()
|
|
|
|
{
|
2021-08-18 15:09:00 +08:00
|
|
|
if (Room.RoomID.Value == null)
|
2021-08-17 17:24:04 +08:00
|
|
|
{
|
|
|
|
// room has not been created yet; exit immediately.
|
2021-08-19 17:14:45 +08:00
|
|
|
settingsOverlay.Hide();
|
2021-08-17 17:24:04 +08:00
|
|
|
return base.OnBackButton();
|
|
|
|
}
|
|
|
|
|
2021-02-16 14:14:48 +08:00
|
|
|
if (userModsSelectOverlay.State.Value == Visibility.Visible)
|
|
|
|
{
|
|
|
|
userModsSelectOverlay.Hide();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-08-18 14:16:48 +08:00
|
|
|
if (settingsOverlay.State.Value == Visibility.Visible)
|
2021-08-17 17:24:04 +08:00
|
|
|
{
|
2021-08-18 14:16:48 +08:00
|
|
|
settingsOverlay.Hide();
|
2021-08-17 17:24:04 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-02-16 14:14:48 +08:00
|
|
|
return base.OnBackButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void ShowUserModSelect() => userModsSelectOverlay.Show();
|
|
|
|
|
2020-12-22 18:53:01 +08:00
|
|
|
public override void OnEntering(IScreen last)
|
|
|
|
{
|
|
|
|
base.OnEntering(last);
|
2020-12-23 20:47:28 +08:00
|
|
|
beginHandlingTrack();
|
2020-12-22 18:53:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnSuspending(IScreen next)
|
|
|
|
{
|
2020-12-23 20:47:28 +08:00
|
|
|
endHandlingTrack();
|
2020-12-22 18:53:01 +08:00
|
|
|
base.OnSuspending(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnResuming(IScreen last)
|
|
|
|
{
|
|
|
|
base.OnResuming(last);
|
2021-12-13 15:09:53 +08:00
|
|
|
updateWorkingBeatmap();
|
2020-12-23 20:47:28 +08:00
|
|
|
beginHandlingTrack();
|
2021-02-11 15:00:35 +08:00
|
|
|
Scheduler.AddOnce(UpdateMods);
|
2020-12-20 22:40:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool OnExiting(IScreen next)
|
|
|
|
{
|
|
|
|
RoomManager?.PartRoom();
|
|
|
|
Mods.Value = Array.Empty<Mod>();
|
|
|
|
|
2020-12-23 20:47:28 +08:00
|
|
|
endHandlingTrack();
|
2020-12-22 18:53:01 +08:00
|
|
|
|
2020-12-20 22:40:19 +08:00
|
|
|
return base.OnExiting(next);
|
|
|
|
}
|
2020-12-22 18:53:01 +08:00
|
|
|
|
2021-04-22 22:37:33 +08:00
|
|
|
protected void StartPlay()
|
2020-12-24 15:53:25 +08:00
|
|
|
{
|
2021-12-06 13:03:51 +08:00
|
|
|
// User may be at song select or otherwise when the host starts gameplay.
|
|
|
|
// Ensure that they first return to this screen, else global bindables (beatmap etc.) may be in a bad state.
|
|
|
|
if (!this.IsCurrentScreen())
|
|
|
|
{
|
|
|
|
this.MakeCurrent();
|
|
|
|
|
|
|
|
Schedule(StartPlay);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-12-24 15:53:25 +08:00
|
|
|
sampleStart?.Play();
|
2021-05-14 14:02:36 +08:00
|
|
|
|
|
|
|
// fallback is to allow this class to operate when there is no parent OnlineScreen (testing purposes).
|
|
|
|
var targetScreen = (Screen)ParentScreen ?? this;
|
|
|
|
|
2021-05-14 14:32:56 +08:00
|
|
|
targetScreen.Push(CreateGameplayScreen());
|
2020-12-24 15:53:25 +08:00
|
|
|
}
|
|
|
|
|
2021-04-22 22:37:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates the gameplay screen to be entered.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The screen to enter.</returns>
|
|
|
|
protected abstract Screen CreateGameplayScreen();
|
|
|
|
|
2020-12-23 13:47:34 +08:00
|
|
|
private void selectedItemChanged()
|
2020-12-22 18:53:01 +08:00
|
|
|
{
|
2021-12-13 15:09:53 +08:00
|
|
|
updateWorkingBeatmap();
|
2020-12-23 13:47:34 +08:00
|
|
|
|
2021-02-19 13:36:51 +08:00
|
|
|
var selected = SelectedItem.Value;
|
|
|
|
|
|
|
|
if (selected == null)
|
2021-02-01 12:40:59 +08:00
|
|
|
return;
|
2020-12-23 13:47:34 +08:00
|
|
|
|
2021-02-01 17:50:32 +08:00
|
|
|
// Remove any user mods that are no longer allowed.
|
2021-02-01 16:57:32 +08:00
|
|
|
UserMods.Value = UserMods.Value
|
2021-02-19 13:36:51 +08:00
|
|
|
.Where(m => selected.AllowedMods.Any(a => m.GetType() == a.GetType()))
|
2021-02-01 16:57:32 +08:00
|
|
|
.ToList();
|
2020-12-23 13:47:34 +08:00
|
|
|
|
2021-02-11 14:55:08 +08:00
|
|
|
UpdateMods();
|
2020-12-23 13:47:34 +08:00
|
|
|
|
2021-11-15 15:13:03 +08:00
|
|
|
Ruleset.Value = rulesets.GetRuleset(selected.RulesetID);
|
2021-02-16 14:14:48 +08:00
|
|
|
|
2021-02-19 13:46:10 +08:00
|
|
|
if (!selected.AllowedMods.Any())
|
2021-02-16 14:14:48 +08:00
|
|
|
{
|
|
|
|
UserModsSection?.Hide();
|
|
|
|
userModsSelectOverlay.Hide();
|
|
|
|
userModsSelectOverlay.IsValidMod = _ => false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UserModsSection?.Show();
|
2021-02-19 13:36:51 +08:00
|
|
|
userModsSelectOverlay.IsValidMod = m => selected.AllowedMods.Any(a => a.GetType() == m.GetType());
|
2021-02-16 14:14:48 +08:00
|
|
|
}
|
2020-12-23 13:47:34 +08:00
|
|
|
}
|
|
|
|
|
2021-12-13 15:09:53 +08:00
|
|
|
private void updateWorkingBeatmap()
|
2020-12-23 13:47:34 +08:00
|
|
|
{
|
|
|
|
var beatmap = SelectedItem.Value?.Beatmap.Value;
|
|
|
|
|
|
|
|
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
2021-11-12 16:45:05 +08:00
|
|
|
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineID == beatmap.OnlineID);
|
2020-12-23 13:47:34 +08:00
|
|
|
|
|
|
|
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
|
|
|
}
|
|
|
|
|
2021-02-11 14:55:08 +08:00
|
|
|
protected virtual void UpdateMods()
|
2021-02-01 12:40:59 +08:00
|
|
|
{
|
|
|
|
if (SelectedItem.Value == null)
|
|
|
|
return;
|
|
|
|
|
2021-02-01 16:57:32 +08:00
|
|
|
Mods.Value = UserMods.Value.Concat(SelectedItem.Value.RequiredMods).ToList();
|
2021-02-01 12:40:59 +08:00
|
|
|
}
|
|
|
|
|
2020-12-23 20:47:28 +08:00
|
|
|
private void beginHandlingTrack()
|
|
|
|
{
|
|
|
|
Beatmap.BindValueChanged(applyLoopingToTrack, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void endHandlingTrack()
|
|
|
|
{
|
|
|
|
Beatmap.ValueChanged -= applyLoopingToTrack;
|
|
|
|
cancelTrackLooping();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void applyLoopingToTrack(ValueChangedEvent<WorkingBeatmap> _ = null)
|
2020-12-23 13:47:34 +08:00
|
|
|
{
|
|
|
|
if (!this.IsCurrentScreen())
|
|
|
|
return;
|
|
|
|
|
2020-12-22 18:53:01 +08:00
|
|
|
var track = Beatmap.Value?.Track;
|
|
|
|
|
|
|
|
if (track != null)
|
|
|
|
{
|
2021-02-18 14:01:11 +08:00
|
|
|
Beatmap.Value.PrepareTrackForPreviewLooping();
|
2020-12-23 13:47:34 +08:00
|
|
|
music?.EnsurePlayingSomething();
|
2020-12-22 18:53:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-23 20:47:28 +08:00
|
|
|
private void cancelTrackLooping()
|
2020-12-22 18:53:01 +08:00
|
|
|
{
|
|
|
|
var track = Beatmap?.Value?.Track;
|
|
|
|
|
|
|
|
if (track != null)
|
|
|
|
track.Looping = false;
|
|
|
|
}
|
2021-02-16 14:14:48 +08:00
|
|
|
|
2021-08-18 19:21:29 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates the main centred content.
|
|
|
|
/// </summary>
|
2021-08-17 16:05:20 +08:00
|
|
|
protected abstract Drawable CreateMainContent();
|
|
|
|
|
2021-08-18 19:21:29 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates the footer content.
|
|
|
|
/// </summary>
|
2021-08-17 16:05:20 +08:00
|
|
|
protected abstract Drawable CreateFooter();
|
|
|
|
|
2021-08-18 19:21:29 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates the room settings overlay.
|
|
|
|
/// </summary>
|
2021-08-20 20:45:24 +08:00
|
|
|
/// <param name="room">The room to change the settings of.</param>
|
2021-08-19 15:40:27 +08:00
|
|
|
protected abstract RoomSettingsOverlay CreateRoomSettingsOverlay(Room room);
|
2021-08-17 17:24:04 +08:00
|
|
|
|
2021-08-13 13:04:43 +08:00
|
|
|
public class UserModSelectButton : PurpleTriangleButton
|
|
|
|
{
|
|
|
|
}
|
2020-12-20 22:40:19 +08:00
|
|
|
}
|
|
|
|
}
|