Merge branch 'master' into remove-current-room

This commit is contained in:
smoogipoo
2021-08-20 16:23:36 +09:00
67 changed files with 1666 additions and 896 deletions

View File

@ -10,8 +10,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Screens.Ranking.Expanded;
using osuTK;
namespace osu.Game.Screens.OnlinePlay.Components
@ -64,8 +64,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
minDisplay = new StarRatingDisplay(default),
maxDisplay = new StarRatingDisplay(default)
minDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range),
maxDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range)
}
}
};

View File

@ -78,6 +78,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] IdleTracker idleTracker)
{
const float controls_area_height = 25f;
if (idleTracker != null)
isIdle.BindTo(idleTracker.IsIdle);
@ -86,87 +88,74 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
InternalChildren = new Drawable[]
{
ListingPollingComponent = CreatePollingComponent().With(c => c.Filter.BindTarget = filter),
loadingLayer = new LoadingLayer(true),
new Container
{
Name = @"Rooms area",
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{
Left = WaveOverlayContainer.WIDTH_PADDING,
Right = WaveOverlayContainer.WIDTH_PADDING,
Horizontal = WaveOverlayContainer.WIDTH_PADDING,
Top = Header.HEIGHT + controls_area_height + 20,
},
Child = new GridContainer
Child = scrollContainer = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
ScrollbarOverlapsContent = false,
Child = roomsContainer = new RoomsContainer
{
new Dimension(GridSizeMode.Absolute, Header.HEIGHT),
new Dimension(GridSizeMode.Absolute, 25),
new Dimension(GridSizeMode.Absolute, 20)
Filter = { BindTarget = filter },
SelectedRoom = { BindTarget = selectedRoom }
}
},
},
loadingLayer = new LoadingLayer(true),
new FillFlowContainer
{
Name = @"Header area flow",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
Height = Header.HEIGHT,
Child = searchTextBox = new LoungeSearchTextBox
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.X,
Width = 0.6f,
},
},
Content = new[]
new Container
{
new Drawable[]
RelativeSizeAxes = Axes.X,
Height = controls_area_height,
Children = new Drawable[]
{
searchTextBox = new LoungeSearchTextBox
Buttons.WithChild(CreateNewRoomButton().With(d =>
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.X,
Width = 0.6f,
},
},
new Drawable[]
{
new Container
d.Anchor = Anchor.BottomLeft;
d.Origin = Anchor.BottomLeft;
d.Size = new Vector2(150, 37.5f);
d.Action = () => Open();
})),
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Depth = float.MinValue, // Contained filters should appear over the top of rooms.
Children = new Drawable[]
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10),
ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
{
Buttons.WithChild(CreateNewRoomButton().With(d =>
{
d.Anchor = Anchor.BottomLeft;
d.Origin = Anchor.BottomLeft;
d.Size = new Vector2(150, 37.5f);
d.Action = () => Open();
})),
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;
}))
}
}
d.Anchor = Anchor.TopRight;
d.Origin = Anchor.TopRight;
}))
}
},
null,
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
scrollContainer = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarOverlapsContent = false,
Child = roomsContainer = new RoomsContainer
{
Filter = { BindTarget = filter },
SelectedRoom = { BindTarget = selectedRoom }
}
},
}
},
}
}
},

View File

@ -19,9 +19,12 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
[Resolved(CanBeNull = true)]
private ChannelManager channelManager { get; set; }
public MatchChatDisplay()
private readonly bool leaveChannelOnDispose;
public MatchChatDisplay(bool leaveChannelOnDispose = true)
: base(true)
{
this.leaveChannelOnDispose = leaveChannelOnDispose;
}
protected override void LoadComplete()
@ -42,7 +45,9 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
channelManager?.LeaveChannel(Channel.Value);
if (leaveChannelOnDispose)
channelManager?.LeaveChannel(Channel.Value);
}
}
}

View File

@ -195,14 +195,19 @@ namespace osu.Game.Screens.OnlinePlay.Match
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new[]
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex(@"28242d") // Temporary.
},
CreateFooter()
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(5),
Child = CreateFooter()
},
}
}
}
@ -252,6 +257,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
if (Room.RoomID.Value == null)
{
// room has not been created yet; exit immediately.
settingsOverlay.Hide();
return base.OnBackButton();
}

View File

@ -0,0 +1,111 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings;
using osu.Game.Screens.OnlinePlay.Match.Components;
using osu.Game.Screens.Play;
namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
public class GameplayChatDisplay : MatchChatDisplay, IKeyBindingHandler<GlobalAction>
{
[Resolved]
private ILocalUserPlayInfo localUserInfo { get; set; }
private IBindable<bool> localUserPlaying = new Bindable<bool>();
public override bool PropagatePositionalInputSubTree => !localUserPlaying.Value;
public Bindable<bool> Expanded = new Bindable<bool>();
private readonly Bindable<bool> expandedFromTextboxFocus = new Bindable<bool>();
private const float height = 100;
public override bool PropagateNonPositionalInputSubTree => true;
public GameplayChatDisplay()
: base(leaveChannelOnDispose: false)
{
RelativeSizeAxes = Axes.X;
Background.Alpha = 0.2f;
Textbox.FocusLost = () => expandedFromTextboxFocus.Value = false;
}
protected override void LoadComplete()
{
base.LoadComplete();
localUserPlaying = localUserInfo.IsPlaying.GetBoundCopy();
localUserPlaying.BindValueChanged(playing =>
{
// for now let's never hold focus. this avoid misdirected gameplay keys entering chat.
// note that this is done within this callback as it triggers an un-focus as well.
Textbox.HoldFocus = false;
// only hold focus (after sending a message) during breaks
Textbox.ReleaseFocusOnCommit = playing.NewValue;
}, true);
Expanded.BindValueChanged(_ => updateExpandedState(), true);
expandedFromTextboxFocus.BindValueChanged(focus =>
{
if (focus.NewValue)
updateExpandedState();
else
{
// on finishing typing a message there should be a brief delay before hiding.
using (BeginDelayedSequence(600))
updateExpandedState();
}
}, true);
}
public bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.ToggleChatFocus:
if (Textbox.HasFocus)
{
Schedule(() => Textbox.KillFocus());
}
else
{
expandedFromTextboxFocus.Value = true;
// schedule required to ensure the textbox has become present from above bindable update.
Schedule(() => Textbox.TakeFocus());
}
return true;
}
return false;
}
public void OnReleased(GlobalAction action)
{
}
private void updateExpandedState()
{
if (Expanded.Value || expandedFromTextboxFocus.Value)
{
this.FadeIn(300, Easing.OutQuint);
this.ResizeHeightTo(height, 500, Easing.OutQuint);
}
else
{
this.FadeOut(300, Easing.OutQuint);
this.ResizeHeightTo(0, 500, Easing.OutQuint);
}
}
}
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Screens;
using osu.Game.Online.API;
using osu.Game.Screens.OnlinePlay.Match.Components;
using osuTK;
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
{
@ -35,6 +36,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(5),
Children = new Drawable[]
{
beatmapPanelContainer = new Container

View File

@ -53,7 +53,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
{
new Dimension(),
new Dimension(maxSize: spectate_button_width),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(GridSizeMode.Absolute, 5),
new Dimension(maxSize: ready_button_width),
new Dimension()
}

View File

@ -158,6 +158,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
{
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this,
LengthLimit = 100,
},
},
new Section("Room visibility")
@ -215,6 +216,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
{
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this,
LengthLimit = 255,
},
},
}

View File

@ -130,79 +130,68 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
// Spacer
null,
// Main right column
new FillFlowContainer
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new FillFlowContainer
new Drawable[] { new OverlinedHeader("Beatmap") },
new Drawable[] { new BeatmapSelectionControl { RelativeSizeAxes = Axes.X } },
new[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
UserModsSection = new FillFlowContainer
{
new OverlinedHeader("Beatmap"),
new BeatmapSelectionControl { RelativeSizeAxes = Axes.X }
}
},
UserModsSection = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 10 },
Children = new Drawable[]
{
new OverlinedHeader("Extra mods"),
new FillFlowContainer
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 10 },
Alpha = 0,
Children = new Drawable[]
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
new OverlinedHeader("Extra mods"),
new FillFlowContainer
{
new UserModSelectButton
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 90,
Text = "Select",
Action = ShowUserModSelect,
},
new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = UserMods,
Scale = new Vector2(0.8f),
},
}
new UserModSelectButton
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 90,
Text = "Select",
Action = ShowUserModSelect,
},
new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = UserMods,
Scale = new Vector2(0.8f),
},
}
},
}
}
}
},
},
new Drawable[] { new OverlinedHeader("Chat") { Margin = new MarginPadding { Vertical = 5 }, }, },
new Drawable[] { new MatchChatDisplay { RelativeSizeAxes = Axes.Both } }
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
}
},
}
}
}
}
},
new Drawable[]
{
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize)
},
Content = new[]
{
new Drawable[] { new OverlinedHeader("Chat") },
new Drawable[] { new MatchChatDisplay { RelativeSizeAxes = Axes.Both } }
}
}
}
},
};

View File

@ -68,6 +68,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(5)
});
// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
@ -78,7 +79,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
((IBindable<bool>)leaderboard.Expanded).BindTo(HUDOverlay.ShowHud);
leaderboardFlow.Add(l);
leaderboardFlow.Insert(0, l);
if (leaderboard.TeamScores.Count >= 2)
{
@ -87,10 +88,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
Team1Score = { BindTarget = leaderboard.TeamScores.First().Value },
Team2Score = { BindTarget = leaderboard.TeamScores.Last().Value },
Expanded = { BindTarget = HUDOverlay.ShowHud },
}, leaderboardFlow.Add);
}, scoreDisplay => leaderboardFlow.Insert(1, scoreDisplay));
}
});
LoadComponentAsync(new GameplayChatDisplay
{
Expanded = { BindTarget = HUDOverlay.ShowHud },
}, chat => leaderboardFlow.Insert(2, chat));
HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue });
}

View File

@ -23,12 +23,6 @@ namespace osu.Game.Screens.OnlinePlay
RelativeSizeAxes = Axes.Both;
}
public const float X_SHIFT = 200;
public const double X_MOVE_DURATION = 800;
public const double RESUME_TRANSITION_DELAY = DISAPPEAR_DURATION / 2;
public const double APPEAR_DURATION = 800;
public const double DISAPPEAR_DURATION = 500;
@ -36,9 +30,7 @@ namespace osu.Game.Screens.OnlinePlay
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint);
this.MoveToX(X_SHIFT).MoveToX(0, X_MOVE_DURATION, Easing.OutQuint);
}
public override bool OnExiting(IScreen next)
@ -46,7 +38,6 @@ namespace osu.Game.Screens.OnlinePlay
base.OnExiting(next);
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
this.MoveToX(X_SHIFT, X_MOVE_DURATION, Easing.OutQuint);
return false;
}
@ -54,9 +45,7 @@ namespace osu.Game.Screens.OnlinePlay
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
this.Delay(RESUME_TRANSITION_DELAY).FadeIn(APPEAR_DURATION, Easing.OutQuint);
this.MoveToX(0, X_MOVE_DURATION, Easing.OutQuint);
this.FadeIn(APPEAR_DURATION, Easing.OutQuint);
}
public override void OnSuspending(IScreen next)
@ -64,7 +53,6 @@ namespace osu.Game.Screens.OnlinePlay
base.OnSuspending(next);
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
this.MoveToX(-X_SHIFT, X_MOVE_DURATION, Easing.OutQuint);
}
public override string ToString() => Title;

View File

@ -120,6 +120,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Alpha = 0,
Margin = new MarginPadding { Bottom = 10 },
Children = new Drawable[]
{