1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 13:22:55 +08:00

Integrate RoomSettingsOverlay into Match.

This commit is contained in:
DrabWeb 2018-06-06 04:27:53 -03:00
parent 93b61840c8
commit a982a4ce37
2 changed files with 37 additions and 16 deletions

View File

@ -34,11 +34,15 @@ namespace osu.Game.Screens.Multi.Screens.Match
{
this.room = room;
Header header;
RoomSettingsOverlay settings;
Info info;
Children = new Drawable[]
{
header = new Header(),
header = new Header
{
Depth = -1,
},
info = new Info
{
Margin = new MarginPadding { Top = Header.HEIGHT },
@ -48,6 +52,17 @@ namespace osu.Game.Screens.Multi.Screens.Match
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = Header.HEIGHT + Info.HEIGHT },
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = Header.HEIGHT },
Child = settings = new RoomSettingsOverlay
{
RelativeSizeAxes = Axes.Both,
Height = 0.9f,
Room = room,
},
},
};
header.OnWantsSelectBeatmap = () => Push(new MatchSongSelect());
@ -64,6 +79,20 @@ namespace osu.Game.Screens.Multi.Screens.Match
info.Beatmap = b;
};
header.Tabs.Current.ValueChanged += t =>
{
if (t == MatchHeaderPage.Settings)
settings.Show();
else
settings.Hide();
};
settings.StateChanged += s =>
{
if (s == Visibility.Hidden)
header.Tabs.Current.Value = MatchHeaderPage.Room;
};
nameBind.BindTo(room.Name);
statusBind.BindTo(room.Status);
availabilityBind.BindTo(room.Availability);

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
@ -17,7 +16,7 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Multi.Screens.Match
{
public class RoomSettingsOverlay : OsuFocusedOverlayContainer
public class RoomSettingsOverlay : OverlayContainer
{
private const float transition_duration = 500;
@ -26,8 +25,6 @@ namespace osu.Game.Screens.Multi.Screens.Match
private readonly RoomAvailabilityPicker availability;
private readonly GameTypePicker type;
protected override Container<Drawable> Content => content;
private Room room;
public Room Room
{
@ -44,11 +41,11 @@ namespace osu.Game.Screens.Multi.Screens.Match
}
}
public Action OnApply;
public RoomSettingsOverlay()
{
InternalChild = content = new Container
Masking = true;
Child = content = new Container
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Y,
@ -75,7 +72,7 @@ namespace osu.Game.Screens.Multi.Screens.Match
},
new Section("ROOM VISIBILITY")
{
Child = availability =new RoomAvailabilityPicker(),
Child = availability = new RoomAvailabilityPicker(),
},
new Section("GAME TYPE")
{
@ -122,7 +119,6 @@ namespace osu.Game.Screens.Multi.Screens.Match
room.MaxParticipants.Value = null;
}
OnApply?.Invoke();
Hide();
},
},
@ -132,16 +128,12 @@ namespace osu.Game.Screens.Multi.Screens.Match
protected override void PopIn()
{
base.PopIn();
Content.MoveToY(0, transition_duration, Easing.OutQuint);
content.MoveToY(0, transition_duration, Easing.OutQuint);
}
protected override void PopOut()
{
base.PopOut();
Content.MoveToY(-1, transition_duration, Easing.InSine);
content.MoveToY(-1, transition_duration, Easing.InSine);
}
private class SettingsTextBox : OsuTextBox