mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Immediately select newly-created rooms
This commit is contained in:
parent
6a28e8c696
commit
e22cefc27d
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -17,6 +18,6 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
public Bindable<GameType> Type = new Bindable<GameType>(new GameTypeVersus());
|
public Bindable<GameType> Type = new Bindable<GameType>(new GameTypeVersus());
|
||||||
public Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
public Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||||
public Bindable<int?> MaxParticipants = new Bindable<int?>();
|
public Bindable<int?> MaxParticipants = new Bindable<int?>();
|
||||||
public Bindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
public Bindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>(Enumerable.Empty<User>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private const float side_strip_width = 5;
|
private const float side_strip_width = 5;
|
||||||
private const float cover_width = 145;
|
private const float cover_width = 145;
|
||||||
|
|
||||||
|
public Action SelectionRequested;
|
||||||
|
|
||||||
private readonly Box selectionBox;
|
private readonly Box selectionBox;
|
||||||
|
|
||||||
private readonly Bindable<string> nameBind = new Bindable<string>();
|
private readonly Bindable<string> nameBind = new Bindable<string>();
|
||||||
@ -76,17 +78,6 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Action<DrawableRoom> action;
|
|
||||||
public new Action<DrawableRoom> Action
|
|
||||||
{
|
|
||||||
get { return action; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
action = value;
|
|
||||||
Enabled.Value = action != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public event Action<SelectionState> StateChanged;
|
public event Action<SelectionState> StateChanged;
|
||||||
|
|
||||||
public DrawableRoom(Room room)
|
public DrawableRoom(Room room)
|
||||||
@ -248,12 +239,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (Enabled.Value)
|
State = SelectionState.Selected;
|
||||||
{
|
|
||||||
Action?.Invoke(this);
|
|
||||||
State = SelectionState.Selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -21,6 +22,16 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private const float transition_duration = 350;
|
private const float transition_duration = 350;
|
||||||
private const float field_padding = 45;
|
private const float field_padding = 45;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when room settings were applied.
|
||||||
|
/// </summary>
|
||||||
|
public Action Applied;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The room which settings are being applied to.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Room Room;
|
||||||
|
|
||||||
private readonly Bindable<string> nameBind = new Bindable<string>();
|
private readonly Bindable<string> nameBind = new Bindable<string>();
|
||||||
private readonly Bindable<RoomAvailability> availabilityBind = new Bindable<RoomAvailability>();
|
private readonly Bindable<RoomAvailability> availabilityBind = new Bindable<RoomAvailability>();
|
||||||
private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
|
private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
|
||||||
@ -36,6 +47,8 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
public RoomSettingsOverlay(Room room)
|
public RoomSettingsOverlay(Room room)
|
||||||
{
|
{
|
||||||
|
Room = room;
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
Child = content = new Container
|
Child = content = new Container
|
||||||
@ -185,7 +198,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
else
|
else
|
||||||
maxParticipantsBind.Value = null;
|
maxParticipantsBind.Value = null;
|
||||||
|
|
||||||
Hide();
|
Applied?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SettingsTextBox : OsuTextBox
|
private class SettingsTextBox : OsuTextBox
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -30,29 +29,6 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
|
|
||||||
protected override Container<Drawable> TransitionContent => content;
|
protected override Container<Drawable> TransitionContent => content;
|
||||||
|
|
||||||
private IEnumerable<Room> rooms;
|
|
||||||
public IEnumerable<Room> Rooms
|
|
||||||
{
|
|
||||||
get { return rooms; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (Equals(value, rooms)) return;
|
|
||||||
rooms = value;
|
|
||||||
|
|
||||||
var enumerable = rooms.ToList();
|
|
||||||
|
|
||||||
RoomsContainer.Children = enumerable.Select(r => new DrawableRoom(r)
|
|
||||||
{
|
|
||||||
Action = didSelect,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
if (!enumerable.Contains(Inspector.Room))
|
|
||||||
Inspector.Room = null;
|
|
||||||
|
|
||||||
filterRooms();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Lounge()
|
public Lounge()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -108,6 +84,12 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
Filter.Search.Current.ValueChanged += s => filterRooms();
|
Filter.Search.Current.ValueChanged += s => filterRooms();
|
||||||
Filter.Tabs.Current.ValueChanged += t => filterRooms();
|
Filter.Tabs.Current.ValueChanged += t => filterRooms();
|
||||||
Filter.Search.Exit += Exit;
|
Filter.Search.Exit += Exit;
|
||||||
|
|
||||||
|
settings.Applied = () =>
|
||||||
|
{
|
||||||
|
var drawableRoom = addRoom(settings.Room);
|
||||||
|
drawableRoom.State = SelectionState.Selected;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -122,6 +104,35 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Room> Rooms
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
RoomsContainer.ForEach(r => r.Action = null);
|
||||||
|
RoomsContainer.Clear();
|
||||||
|
|
||||||
|
foreach (var room in value)
|
||||||
|
addRoom(room);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrawableRoom addRoom(Room room)
|
||||||
|
{
|
||||||
|
var drawableRoom = new DrawableRoom(room);
|
||||||
|
|
||||||
|
drawableRoom.StateChanged += s =>
|
||||||
|
{
|
||||||
|
if (s == SelectionState.Selected)
|
||||||
|
didSelect(drawableRoom);
|
||||||
|
};
|
||||||
|
|
||||||
|
RoomsContainer.Add(drawableRoom);
|
||||||
|
|
||||||
|
filterRooms();
|
||||||
|
|
||||||
|
return drawableRoom;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
GetContainingInputManager().ChangeFocus(Filter.Search);
|
GetContainingInputManager().ChangeFocus(Filter.Search);
|
||||||
|
@ -88,6 +88,8 @@ namespace osu.Game.Screens.Multi.Screens.Match
|
|||||||
header.Tabs.Current.Value = MatchHeaderPage.Room;
|
header.Tabs.Current.Value = MatchHeaderPage.Room;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settings.Applied = () => settings.Hide();
|
||||||
|
|
||||||
nameBind.BindTo(room.Name);
|
nameBind.BindTo(room.Name);
|
||||||
nameBind.BindValueChanged(n => info.Name = n, true);
|
nameBind.BindValueChanged(n => info.Name = n, true);
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ namespace osu.Game.Screens.Multi.Screens.Match
|
|||||||
|
|
||||||
public IEnumerable<User> Users
|
public IEnumerable<User> Users
|
||||||
{
|
{
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
usersFlow.Children = value.Select(u => new UserPanel(u)
|
usersFlow.Children = value.Select(u => new UserPanel(u)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
|
Loading…
Reference in New Issue
Block a user