mirror of
https://github.com/osukey/osukey.git
synced 2025-05-06 14:17:27 +09:00
Fix selections not working anymore
This commit is contained in:
parent
d8739d9dee
commit
a02e025f06
@ -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 event Action<SelectionState> StateChanged;
|
||||||
|
|
||||||
public Action SelectionRequested;
|
public Action SelectionRequested;
|
||||||
|
|
||||||
private readonly Box selectionBox;
|
private readonly Box selectionBox;
|
||||||
@ -78,8 +80,6 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public event Action<SelectionState> StateChanged;
|
|
||||||
|
|
||||||
public DrawableRoom(Room room)
|
public DrawableRoom(Room room)
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
@ -239,7 +239,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
State = SelectionState.Selected;
|
SelectionRequested?.Invoke();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
@ -86,11 +87,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
Filter.Tabs.Current.ValueChanged += t => filterRooms();
|
Filter.Tabs.Current.ValueChanged += t => filterRooms();
|
||||||
Filter.Search.Exit += Exit;
|
Filter.Search.Exit += Exit;
|
||||||
|
|
||||||
settings.Applied = () =>
|
settings.Applied = () => createRoom(settings.Room);
|
||||||
{
|
|
||||||
var drawableRoom = addRoom(settings.Room);
|
|
||||||
drawableRoom.State = SelectionState.Selected;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -121,11 +118,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
{
|
{
|
||||||
var drawableRoom = new DrawableRoom(room);
|
var drawableRoom = new DrawableRoom(room);
|
||||||
|
|
||||||
drawableRoom.StateChanged += s =>
|
drawableRoom.SelectionRequested = () => selectionRequested(drawableRoom);
|
||||||
{
|
|
||||||
if (s == SelectionState.Selected)
|
|
||||||
didSelect(drawableRoom);
|
|
||||||
};
|
|
||||||
|
|
||||||
RoomsContainer.Add(drawableRoom);
|
RoomsContainer.Add(drawableRoom);
|
||||||
|
|
||||||
@ -163,6 +156,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
protected override void OnSuspending(Screen next)
|
protected override void OnSuspending(Screen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
|
||||||
Filter.Search.HoldFocus = false;
|
Filter.Search.HoldFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,19 +175,38 @@ namespace osu.Game.Screens.Multi.Screens.Lounge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void didSelect(DrawableRoom room)
|
private void selectionRequested(DrawableRoom room)
|
||||||
{
|
{
|
||||||
RoomsContainer.Children.ForEach(c =>
|
if (room.State == SelectionState.Selected)
|
||||||
|
openRoom(room);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (c != room)
|
RoomsContainer.ForEach(c => c.State = c == room ? SelectionState.Selected : SelectionState.NotSelected);
|
||||||
c.State = SelectionState.NotSelected;
|
Inspector.Room = room.Room;
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openRoom(DrawableRoom room)
|
||||||
|
{
|
||||||
|
if (!IsCurrentScreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RoomsContainer.ForEach(c => c.State = c == room ? SelectionState.Selected : SelectionState.NotSelected);
|
||||||
Inspector.Room = room.Room;
|
Inspector.Room = room.Room;
|
||||||
|
|
||||||
// open the room if its selected and is clicked again
|
Push(new Match.Match(room.Room));
|
||||||
if (room.State == SelectionState.Selected)
|
}
|
||||||
Push(new Match.Match(room.Room));
|
|
||||||
|
private void createRoom(Room room)
|
||||||
|
{
|
||||||
|
openRoom(addRoom(room));
|
||||||
|
|
||||||
|
this.Delay(WaveContainer.APPEAR_DURATION).Schedule(() =>
|
||||||
|
{
|
||||||
|
Filter.Tabs.Current.Value = LoungeTab.Public;
|
||||||
|
settings.Hide();
|
||||||
|
settings.FinishTransforms(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RoomsFilterContainer : FillFlowContainer<DrawableRoom>, IHasFilterableChildren
|
private class RoomsFilterContainer : FillFlowContainer<DrawableRoom>, IHasFilterableChildren
|
||||||
|
Loading…
x
Reference in New Issue
Block a user