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-22 11:07:04 +08:00
|
|
|
|
|
2020-12-29 15:20:43 +08:00
|
|
|
|
using System;
|
2021-08-12 13:56:58 +08:00
|
|
|
|
using System.Diagnostics;
|
2021-08-12 18:48:15 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-07-09 16:28:22 +08:00
|
|
|
|
using System.Linq;
|
2020-12-29 15:20:43 +08:00
|
|
|
|
using JetBrains.Annotations;
|
2019-02-08 14:20:11 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2021-07-17 21:31:47 +08:00
|
|
|
|
using osu.Framework.Extensions;
|
2018-05-22 11:07:04 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-08-12 18:48:15 +08:00
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2018-10-02 11:02:47 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2021-08-13 16:39:09 +08:00
|
|
|
|
using osu.Framework.Logging;
|
2018-05-22 11:24:39 +08:00
|
|
|
|
using osu.Framework.Screens;
|
2021-08-12 18:48:15 +08:00
|
|
|
|
using osu.Framework.Threading;
|
|
|
|
|
using osu.Game.Graphics;
|
2019-06-14 14:55:32 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-12-26 20:10:31 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2021-08-13 16:39:09 +08:00
|
|
|
|
using osu.Game.Input;
|
2020-12-25 12:38:11 +08:00
|
|
|
|
using osu.Game.Online.Rooms;
|
2020-07-10 15:33:45 +08:00
|
|
|
|
using osu.Game.Overlays;
|
2021-08-12 18:48:15 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2021-08-13 16:39:09 +08:00
|
|
|
|
using osu.Game.Screens.OnlinePlay.Components;
|
2020-12-25 23:50:00 +08:00
|
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
|
|
|
|
using osu.Game.Screens.OnlinePlay.Match;
|
2020-11-08 20:21:21 +08:00
|
|
|
|
using osu.Game.Users;
|
2021-07-14 17:55:01 +08:00
|
|
|
|
using osuTK;
|
2018-05-22 11:07:04 +08:00
|
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Lounge
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2020-08-16 04:06:16 +08:00
|
|
|
|
[Cached]
|
2020-12-26 00:02:35 +08:00
|
|
|
|
public abstract class LoungeSubScreen : OnlinePlaySubScreen
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2019-01-25 18:32:37 +08:00
|
|
|
|
public override string Title => "Lounge";
|
2019-01-25 16:44:33 +08:00
|
|
|
|
|
2020-11-08 20:21:21 +08:00
|
|
|
|
protected override UserActivity InitialActivity => new UserActivity.SearchingForLobby();
|
|
|
|
|
|
2021-07-14 17:55:01 +08:00
|
|
|
|
protected Container<OsuButton> Buttons { get; } = new Container<OsuButton>
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
AutoSizeAxes = Axes.Both
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-16 12:09:04 +08:00
|
|
|
|
protected ListingPollingComponent ListingPollingComponent { get; private set; }
|
|
|
|
|
|
2019-02-08 14:20:11 +08:00
|
|
|
|
[Resolved]
|
2020-02-27 18:23:21 +08:00
|
|
|
|
private Bindable<Room> selectedRoom { get; set; }
|
2019-02-08 14:20:11 +08:00
|
|
|
|
|
2020-08-11 11:40:58 +08:00
|
|
|
|
[Resolved]
|
2020-07-10 15:33:45 +08:00
|
|
|
|
private MusicController music { get; set; }
|
|
|
|
|
|
2020-12-29 05:54:52 +08:00
|
|
|
|
[Resolved(CanBeNull = true)]
|
2020-12-29 15:20:43 +08:00
|
|
|
|
private OngoingOperationTracker ongoingOperationTracker { get; set; }
|
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
|
[Resolved]
|
|
|
|
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
|
|
|
|
|
2020-12-29 15:20:43 +08:00
|
|
|
|
[CanBeNull]
|
|
|
|
|
private IDisposable joiningRoomOperation { get; set; }
|
2020-06-05 19:52:27 +08:00
|
|
|
|
|
2021-08-13 21:24:01 +08:00
|
|
|
|
[CanBeNull]
|
|
|
|
|
private LeasedBindable<Room> selectionLease;
|
|
|
|
|
|
2021-08-17 08:36:43 +08:00
|
|
|
|
private readonly Bindable<FilterCriteria> filter = new Bindable<FilterCriteria>(new FilterCriteria());
|
2021-08-13 16:39:09 +08:00
|
|
|
|
private readonly IBindable<bool> operationInProgress = new Bindable<bool>();
|
|
|
|
|
private readonly IBindable<bool> isIdle = new BindableBool();
|
|
|
|
|
private LoadingLayer loadingLayer;
|
2021-07-12 17:54:17 +08:00
|
|
|
|
private RoomsContainer roomsContainer;
|
2021-08-12 18:48:15 +08:00
|
|
|
|
private SearchTextBox searchTextBox;
|
|
|
|
|
private Dropdown<RoomStatusFilter> statusDropdown;
|
2021-07-12 17:54:17 +08:00
|
|
|
|
|
2021-08-13 17:11:52 +08:00
|
|
|
|
[BackgroundDependencyLoader(true)]
|
|
|
|
|
private void load([CanBeNull] IdleTracker idleTracker)
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2021-08-13 17:11:52 +08:00
|
|
|
|
if (idleTracker != null)
|
|
|
|
|
isIdle.BindTo(idleTracker.IsIdle);
|
|
|
|
|
|
2020-07-09 16:28:22 +08:00
|
|
|
|
OsuScrollContainer scrollContainer;
|
2020-02-20 18:47:50 +08:00
|
|
|
|
|
2021-07-14 17:24:30 +08:00
|
|
|
|
InternalChildren = new Drawable[]
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2021-08-17 08:36:43 +08:00
|
|
|
|
ListingPollingComponent = CreatePollingComponent().With(c => c.Filter.BindTarget = filter),
|
2021-08-13 15:20:53 +08:00
|
|
|
|
loadingLayer = new LoadingLayer(true),
|
2021-07-14 17:55:01 +08:00
|
|
|
|
new Container
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-07-14 17:24:30 +08:00
|
|
|
|
Padding = new MarginPadding
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2021-07-14 17:24:30 +08:00
|
|
|
|
Left = WaveOverlayContainer.WIDTH_PADDING,
|
|
|
|
|
Right = WaveOverlayContainer.WIDTH_PADDING,
|
2021-07-14 16:46:45 +08:00
|
|
|
|
},
|
2021-07-14 17:24:30 +08:00
|
|
|
|
Child = new GridContainer
|
2021-07-14 16:46:45 +08:00
|
|
|
|
{
|
2021-07-14 17:24:30 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
RowDimensions = new[]
|
2021-07-14 16:46:45 +08:00
|
|
|
|
{
|
2021-08-12 18:48:15 +08:00
|
|
|
|
new Dimension(GridSizeMode.Absolute, Header.HEIGHT),
|
2021-08-13 14:35:45 +08:00
|
|
|
|
new Dimension(GridSizeMode.Absolute, 25),
|
2021-07-14 17:24:30 +08:00
|
|
|
|
new Dimension(GridSizeMode.Absolute, 20)
|
2021-07-14 16:46:45 +08:00
|
|
|
|
},
|
2021-07-14 17:24:30 +08:00
|
|
|
|
Content = new[]
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2021-07-14 17:24:30 +08:00
|
|
|
|
new Drawable[]
|
2018-05-22 11:07:04 +08:00
|
|
|
|
{
|
2021-08-12 18:48:15 +08:00
|
|
|
|
searchTextBox = new LoungeSearchTextBox
|
2021-07-14 17:55:01 +08:00
|
|
|
|
{
|
2021-08-12 18:48:15 +08:00
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2021-07-14 17:55:01 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2021-08-12 18:48:15 +08:00
|
|
|
|
Width = 0.6f,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Depth = float.MinValue, // Contained filters should appear over the top of rooms.
|
2021-07-14 17:55:01 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
Buttons.WithChild(CreateNewRoomButton().With(d =>
|
|
|
|
|
{
|
2021-08-13 14:35:45 +08:00
|
|
|
|
d.Anchor = Anchor.BottomLeft;
|
|
|
|
|
d.Origin = Anchor.BottomLeft;
|
|
|
|
|
d.Size = new Vector2(150, 37.5f);
|
2021-08-03 19:02:31 +08:00
|
|
|
|
d.Action = () => Open();
|
2021-08-12 18:48:15 +08:00
|
|
|
|
})),
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Spacing = new Vector2(10),
|
|
|
|
|
ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
|
|
|
|
|
{
|
|
|
|
|
d.Anchor = Anchor.TopRight;
|
|
|
|
|
d.Origin = Anchor.TopRight;
|
|
|
|
|
}))
|
|
|
|
|
}
|
2021-07-14 17:55:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-14 17:24:30 +08:00
|
|
|
|
},
|
|
|
|
|
null,
|
|
|
|
|
new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
2021-07-14 16:46:45 +08:00
|
|
|
|
{
|
2021-07-14 17:24:30 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
2021-07-14 16:46:45 +08:00
|
|
|
|
{
|
2021-07-14 17:24:30 +08:00
|
|
|
|
scrollContainer = new OsuScrollContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
ScrollbarOverlapsContent = false,
|
2021-08-17 08:36:43 +08:00
|
|
|
|
Child = roomsContainer = new RoomsContainer
|
|
|
|
|
{
|
|
|
|
|
Filter = { BindTarget = filter }
|
|
|
|
|
}
|
2021-07-14 17:24:30 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
2021-07-13 15:00:42 +08:00
|
|
|
|
}
|
2021-07-14 17:24:30 +08:00
|
|
|
|
},
|
2021-08-13 13:27:28 +08:00
|
|
|
|
},
|
2018-05-22 11:07:04 +08:00
|
|
|
|
};
|
2020-07-09 16:28:22 +08:00
|
|
|
|
|
|
|
|
|
// scroll selected room into view on selection.
|
|
|
|
|
selectedRoom.BindValueChanged(val =>
|
|
|
|
|
{
|
|
|
|
|
var drawable = roomsContainer.Rooms.FirstOrDefault(r => r.Room == val.NewValue);
|
|
|
|
|
if (drawable != null)
|
|
|
|
|
scrollContainer.ScrollIntoView(drawable);
|
|
|
|
|
});
|
2018-05-22 11:07:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-05 19:52:27 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
|
searchTextBox.Current.BindValueChanged(_ => updateFilterDebounced());
|
|
|
|
|
ruleset.BindValueChanged(_ => UpdateFilter());
|
|
|
|
|
|
2021-08-13 17:17:18 +08:00
|
|
|
|
isIdle.BindValueChanged(_ => updatePollingRate(this.IsCurrentScreen()), true);
|
2020-12-29 04:39:11 +08:00
|
|
|
|
|
2020-12-29 15:20:43 +08:00
|
|
|
|
if (ongoingOperationTracker != null)
|
2020-12-29 05:54:52 +08:00
|
|
|
|
{
|
2021-01-09 05:23:38 +08:00
|
|
|
|
operationInProgress.BindTo(ongoingOperationTracker.InProgress);
|
2021-08-17 16:18:23 +08:00
|
|
|
|
operationInProgress.BindValueChanged(_ => updateLoadingLayer());
|
2020-12-29 05:54:52 +08:00
|
|
|
|
}
|
2021-08-12 18:48:15 +08:00
|
|
|
|
|
2021-08-17 16:18:23 +08:00
|
|
|
|
ListingPollingComponent.InitialRoomsReceived.BindValueChanged(_ => updateLoadingLayer(), true);
|
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
|
updateFilter();
|
2020-06-05 19:52:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
|
#region Filtering
|
|
|
|
|
|
2021-08-17 08:36:43 +08:00
|
|
|
|
public void UpdateFilter() => Scheduler.AddOnce(updateFilter);
|
2021-08-12 18:48:15 +08:00
|
|
|
|
|
|
|
|
|
private ScheduledDelegate scheduledFilterUpdate;
|
|
|
|
|
|
|
|
|
|
private void updateFilterDebounced()
|
|
|
|
|
{
|
|
|
|
|
scheduledFilterUpdate?.Cancel();
|
|
|
|
|
scheduledFilterUpdate = Scheduler.AddDelayed(UpdateFilter, 200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateFilter()
|
|
|
|
|
{
|
|
|
|
|
scheduledFilterUpdate?.Cancel();
|
|
|
|
|
filter.Value = CreateFilterCriteria();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual FilterCriteria CreateFilterCriteria() => new FilterCriteria
|
|
|
|
|
{
|
|
|
|
|
SearchString = searchTextBox.Current.Value,
|
|
|
|
|
Ruleset = ruleset.Value,
|
|
|
|
|
Status = statusDropdown.Current.Value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
protected virtual IEnumerable<Drawable> CreateFilterControls()
|
2018-05-22 11:24:39 +08:00
|
|
|
|
{
|
2021-08-12 18:48:15 +08:00
|
|
|
|
statusDropdown = new SlimEnumDropdown<RoomStatusFilter>
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.None,
|
|
|
|
|
Width = 160,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
statusDropdown.Current.BindValueChanged(_ => UpdateFilter());
|
|
|
|
|
|
|
|
|
|
yield return statusDropdown;
|
2018-05-22 11:24:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
2019-01-25 18:32:37 +08:00
|
|
|
|
public override void OnEntering(IScreen last)
|
2018-05-22 11:24:39 +08:00
|
|
|
|
{
|
2019-01-25 18:32:37 +08:00
|
|
|
|
base.OnEntering(last);
|
2020-02-06 13:22:01 +08:00
|
|
|
|
onReturning();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnResuming(IScreen last)
|
|
|
|
|
{
|
|
|
|
|
base.OnResuming(last);
|
|
|
|
|
|
2021-08-12 13:56:58 +08:00
|
|
|
|
Debug.Assert(selectionLease != null);
|
|
|
|
|
|
|
|
|
|
selectionLease.Return();
|
|
|
|
|
selectionLease = null;
|
|
|
|
|
|
2020-02-27 18:23:21 +08:00
|
|
|
|
if (selectedRoom.Value?.RoomID.Value == null)
|
|
|
|
|
selectedRoom.Value = new Room();
|
2020-02-06 13:22:01 +08:00
|
|
|
|
|
2020-08-10 07:16:01 +08:00
|
|
|
|
music?.EnsurePlayingSomething();
|
2020-07-10 15:33:45 +08:00
|
|
|
|
|
2020-02-06 13:22:01 +08:00
|
|
|
|
onReturning();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-25 18:32:37 +08:00
|
|
|
|
public override bool OnExiting(IScreen next)
|
2018-05-22 11:24:39 +08:00
|
|
|
|
{
|
2021-07-17 21:31:47 +08:00
|
|
|
|
onLeaving();
|
2019-01-25 18:32:37 +08:00
|
|
|
|
return base.OnExiting(next);
|
2019-01-25 16:44:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-25 18:32:37 +08:00
|
|
|
|
public override void OnSuspending(IScreen next)
|
2019-01-25 16:44:33 +08:00
|
|
|
|
{
|
2021-07-17 21:31:47 +08:00
|
|
|
|
onLeaving();
|
2019-01-25 18:32:37 +08:00
|
|
|
|
base.OnSuspending(next);
|
2021-07-17 21:31:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
|
protected override void OnFocus(FocusEvent e)
|
|
|
|
|
{
|
|
|
|
|
searchTextBox.TakeFocus();
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-17 21:31:47 +08:00
|
|
|
|
private void onReturning()
|
|
|
|
|
{
|
2021-08-13 17:17:18 +08:00
|
|
|
|
updatePollingRate(true);
|
2021-08-12 18:48:15 +08:00
|
|
|
|
searchTextBox.HoldFocus = true;
|
2021-07-17 21:31:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onLeaving()
|
|
|
|
|
{
|
2021-08-13 17:17:18 +08:00
|
|
|
|
updatePollingRate(false);
|
2021-08-12 18:48:15 +08:00
|
|
|
|
searchTextBox.HoldFocus = false;
|
2021-07-12 17:54:17 +08:00
|
|
|
|
|
|
|
|
|
// ensure any password prompt is dismissed.
|
2021-07-17 21:31:47 +08:00
|
|
|
|
this.HidePopover();
|
2018-05-22 11:24:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-23 01:23:37 +08:00
|
|
|
|
public void Join(Room room, string password) => Schedule(() =>
|
2018-12-26 20:10:31 +08:00
|
|
|
|
{
|
2021-03-26 13:49:02 +08:00
|
|
|
|
if (joiningRoomOperation != null)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-12-29 15:20:43 +08:00
|
|
|
|
joiningRoomOperation = ongoingOperationTracker?.BeginOperation();
|
2020-06-05 19:52:27 +08:00
|
|
|
|
|
2021-07-10 15:08:12 +08:00
|
|
|
|
RoomManager?.JoinRoom(room, password, r =>
|
2018-12-26 20:10:31 +08:00
|
|
|
|
{
|
2019-02-05 18:00:01 +08:00
|
|
|
|
Open(room);
|
2020-12-29 15:20:43 +08:00
|
|
|
|
joiningRoomOperation?.Dispose();
|
|
|
|
|
joiningRoomOperation = null;
|
2020-06-05 19:52:27 +08:00
|
|
|
|
}, _ =>
|
|
|
|
|
{
|
2020-12-29 15:20:43 +08:00
|
|
|
|
joiningRoomOperation?.Dispose();
|
|
|
|
|
joiningRoomOperation = null;
|
2020-06-05 19:52:27 +08:00
|
|
|
|
});
|
2021-07-23 01:23:37 +08:00
|
|
|
|
});
|
2018-12-26 20:10:31 +08:00
|
|
|
|
|
2018-12-26 19:21:30 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Push a room as a new subscreen.
|
|
|
|
|
/// </summary>
|
2021-08-03 19:02:31 +08:00
|
|
|
|
/// <param name="room">An optional template to use when creating the room.</param>
|
|
|
|
|
public void Open(Room room = null) => Schedule(() =>
|
2018-12-04 14:26:06 +08:00
|
|
|
|
{
|
2018-12-11 18:07:40 +08:00
|
|
|
|
// Handles the case where a room is clicked 3 times in quick succession
|
2019-01-23 19:52:00 +08:00
|
|
|
|
if (!this.IsCurrentScreen())
|
2018-12-04 14:26:06 +08:00
|
|
|
|
return;
|
|
|
|
|
|
2021-08-03 19:02:31 +08:00
|
|
|
|
OpenNewRoom(room ?? CreateNewRoom());
|
2021-07-23 01:23:37 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
protected virtual void OpenNewRoom(Room room)
|
|
|
|
|
{
|
2021-08-12 13:56:58 +08:00
|
|
|
|
selectionLease = selectedRoom.BeginLease(false);
|
|
|
|
|
Debug.Assert(selectionLease != null);
|
|
|
|
|
selectionLease.Value = room;
|
2019-02-08 14:20:11 +08:00
|
|
|
|
|
2020-12-20 23:21:30 +08:00
|
|
|
|
this.Push(CreateRoomSubScreen(room));
|
2018-05-22 11:33:41 +08:00
|
|
|
|
}
|
2020-12-20 22:36:56 +08:00
|
|
|
|
|
2021-08-13 16:39:09 +08:00
|
|
|
|
private void updateLoadingLayer()
|
|
|
|
|
{
|
2021-08-16 12:09:04 +08:00
|
|
|
|
if (operationInProgress.Value || !ListingPollingComponent.InitialRoomsReceived.Value)
|
2021-08-13 16:39:09 +08:00
|
|
|
|
loadingLayer.Show();
|
|
|
|
|
else
|
|
|
|
|
loadingLayer.Hide();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-13 17:17:18 +08:00
|
|
|
|
private void updatePollingRate(bool isCurrentScreen)
|
2021-08-13 16:39:09 +08:00
|
|
|
|
{
|
2021-08-13 17:17:18 +08:00
|
|
|
|
if (!isCurrentScreen)
|
2021-08-16 12:09:04 +08:00
|
|
|
|
ListingPollingComponent.TimeBetweenPolls.Value = 0;
|
2021-08-13 16:39:09 +08:00
|
|
|
|
else
|
2021-08-16 12:09:04 +08:00
|
|
|
|
ListingPollingComponent.TimeBetweenPolls.Value = isIdle.Value ? 120000 : 15000;
|
2021-08-13 16:39:09 +08:00
|
|
|
|
|
2021-08-16 12:09:04 +08:00
|
|
|
|
Logger.Log($"Polling adjusted (listing: {ListingPollingComponent.TimeBetweenPolls.Value})");
|
2021-08-13 16:39:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-14 17:55:01 +08:00
|
|
|
|
protected abstract OsuButton CreateNewRoomButton();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates a new room.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>The created <see cref="Room"/>.</returns>
|
|
|
|
|
protected abstract Room CreateNewRoom();
|
|
|
|
|
|
2020-12-20 23:21:30 +08:00
|
|
|
|
protected abstract RoomSubScreen CreateRoomSubScreen(Room room);
|
2021-07-23 01:23:37 +08:00
|
|
|
|
|
2021-08-13 16:39:09 +08:00
|
|
|
|
protected abstract ListingPollingComponent CreatePollingComponent();
|
2021-08-12 18:48:15 +08:00
|
|
|
|
|
|
|
|
|
private class LoungeSearchTextBox : SearchTextBox
|
|
|
|
|
{
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
BackgroundUnfocused = OsuColour.Gray(0.06f);
|
|
|
|
|
BackgroundFocused = OsuColour.Gray(0.12f);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-22 11:07:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|