mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Add edit button to room panel
This commit is contained in:
@ -124,17 +124,23 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool FilteringActive { get; set; }
|
||||||
|
|
||||||
|
protected readonly Container ButtonsContainer = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
AutoSizeAxes = Axes.X
|
||||||
|
};
|
||||||
|
|
||||||
private readonly Bindable<RoomCategory> roomCategory = new Bindable<RoomCategory>();
|
private readonly Bindable<RoomCategory> roomCategory = new Bindable<RoomCategory>();
|
||||||
|
private readonly Bindable<bool> hasPassword = new Bindable<bool>();
|
||||||
|
|
||||||
private RecentParticipantsList recentParticipantsList;
|
private RecentParticipantsList recentParticipantsList;
|
||||||
private RoomSpecialCategoryPill specialCategoryPill;
|
private RoomSpecialCategoryPill specialCategoryPill;
|
||||||
|
|
||||||
public bool FilteringActive { get; set; }
|
|
||||||
|
|
||||||
private PasswordProtectedIcon passwordIcon;
|
private PasswordProtectedIcon passwordIcon;
|
||||||
|
|
||||||
private readonly Bindable<bool> hasPassword = new Bindable<bool>();
|
|
||||||
|
|
||||||
public DrawableRoom(Room room)
|
public DrawableRoom(Room room)
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
@ -289,13 +295,15 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Spacing = new Vector2(5),
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Right = 10,
|
Right = 10,
|
||||||
Vertical = 5
|
Vertical = 20,
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
ButtonsContainer,
|
||||||
recentParticipantsList = new RecentParticipantsList
|
recentParticipantsList = new RecentParticipantsList
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
// 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 System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
|
using osu.Game.Users;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||||
|
{
|
||||||
|
public class DrawableMultiplayerRoom : DrawableRoom
|
||||||
|
{
|
||||||
|
public Action OnEdit;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
|
private readonly IBindable<User> host = new Bindable<User>();
|
||||||
|
|
||||||
|
private Drawable editButton;
|
||||||
|
|
||||||
|
public DrawableMultiplayerRoom(Room room)
|
||||||
|
: base(room)
|
||||||
|
{
|
||||||
|
host.BindTo(room.Host);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
ButtonsContainer.Add(editButton = new PurpleTriangleButton
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Size = new Vector2(100, 1),
|
||||||
|
Text = "Edit",
|
||||||
|
Action = () => OnEdit?.Invoke()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
host.BindValueChanged(h => editButton.Alpha = h.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool ShouldBeConsideredForInput(Drawable child) => true;
|
||||||
|
}
|
||||||
|
}
|
@ -110,7 +110,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
Mods.Value = client.LocalUser.Mods.Select(m => m.ToMod(ruleset)).Concat(SelectedItem.Value.RequiredMods).ToList();
|
Mods.Value = client.LocalUser.Mods.Select(m => m.ToMod(ruleset)).Concat(SelectedItem.Value.RequiredMods).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableRoom CreateDrawableRoom(Room room) => new DrawableRoom(room);
|
protected override DrawableRoom CreateDrawableRoom(Room room) => new DrawableMultiplayerRoom(room)
|
||||||
|
{
|
||||||
|
OnEdit = () => SettingsOverlay.Show()
|
||||||
|
};
|
||||||
|
|
||||||
protected override Drawable CreateMainContent() => new Container
|
protected override Drawable CreateMainContent() => new Container
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user