mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Merge pull request #24309 from peppy/tournament-team-editor-improvements
General improvements to tournament client team editor and buttons
This commit is contained in:
commit
2f6d125588
@ -25,12 +25,11 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = new Container
|
||||
InternalChild = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Position = new Vector2(5),
|
||||
CornerRadius = 10,
|
||||
Position = new Vector2(-5),
|
||||
Masking = true,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
@ -43,18 +42,10 @@ namespace osu.Game.Tournament
|
||||
saveChangesButton = new TourneyButton
|
||||
{
|
||||
Text = "Save Changes",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 140,
|
||||
Height = 50,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 10,
|
||||
Left = 10,
|
||||
},
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Right = 10,
|
||||
Bottom = 10,
|
||||
},
|
||||
Margin = new MarginPadding(10),
|
||||
Action = saveChanges,
|
||||
// Enabled = { Value = false },
|
||||
},
|
||||
|
@ -11,10 +11,9 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
@ -59,8 +58,6 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
public TournamentTeam Model { get; }
|
||||
|
||||
private readonly Container drawableContainer;
|
||||
|
||||
[Resolved]
|
||||
private TournamentSceneManager? sceneManager { get; set; }
|
||||
|
||||
@ -74,10 +71,10 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Masking = true;
|
||||
CornerRadius = 10;
|
||||
|
||||
PlayerEditor playerEditor = new PlayerEditor(Model)
|
||||
{
|
||||
Width = 0.95f
|
||||
};
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
PlayerEditor playerEditor = new PlayerEditor(Model);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -86,17 +83,17 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Colour = OsuColour.Gray(0.1f),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
drawableContainer = new Container
|
||||
new GroupTeam(team)
|
||||
{
|
||||
Size = new Vector2(100, 50),
|
||||
Margin = new MarginPadding(10),
|
||||
Margin = new MarginPadding(16),
|
||||
Scale = new Vector2(2),
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding(5),
|
||||
Spacing = new Vector2(5),
|
||||
Padding = new MarginPadding(10),
|
||||
Direction = FillDirection.Full,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -133,25 +130,6 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Current = Model.LastYearPlacing
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
Width = 0.11f,
|
||||
Margin = new MarginPadding(10),
|
||||
Text = "Add player",
|
||||
Action = () => playerEditor.CreateNew()
|
||||
},
|
||||
new DangerousSettingsButton
|
||||
{
|
||||
Width = 0.11f,
|
||||
Text = "Delete Team",
|
||||
Margin = new MarginPadding(10),
|
||||
Action = () =>
|
||||
{
|
||||
Expire();
|
||||
ladderInfo.Teams.Remove(Model);
|
||||
},
|
||||
},
|
||||
playerEditor,
|
||||
new SettingsButton
|
||||
{
|
||||
Width = 0.2f,
|
||||
Margin = new MarginPadding(10),
|
||||
@ -161,19 +139,35 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
sceneManager?.SetScreen(new SeedingEditorScreen(team, parent));
|
||||
}
|
||||
},
|
||||
playerEditor,
|
||||
new SettingsButton
|
||||
{
|
||||
Text = "Add player",
|
||||
Action = () => playerEditor.CreateNew()
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DangerousSettingsButton
|
||||
{
|
||||
Width = 0.2f,
|
||||
Text = "Delete Team",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Action = () =>
|
||||
{
|
||||
Expire();
|
||||
ladderInfo.Teams.Remove(Model);
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Model.FlagName.BindValueChanged(updateDrawable, true);
|
||||
}
|
||||
|
||||
private void updateDrawable(ValueChangedEvent<string> flag)
|
||||
{
|
||||
drawableContainer.Child = new DrawableTeamFlag(Model);
|
||||
}
|
||||
|
||||
public partial class PlayerEditor : CompositeDrawable
|
||||
@ -193,6 +187,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(5),
|
||||
Spacing = new Vector2(5),
|
||||
ChildrenEnumerable = team.Players.Select(p => new PlayerRow(team, p))
|
||||
};
|
||||
}
|
||||
@ -208,27 +204,22 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
private readonly TournamentUser user;
|
||||
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private TournamentGameBase game { get; set; } = null!;
|
||||
|
||||
private readonly Bindable<int?> playerId = new Bindable<int?>();
|
||||
|
||||
private readonly Container drawableContainer;
|
||||
private readonly Container userPanelContainer;
|
||||
|
||||
public PlayerRow(TournamentTeam team, TournamentUser user)
|
||||
{
|
||||
this.user = user;
|
||||
|
||||
Margin = new MarginPadding(10);
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
CornerRadius = 10;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -240,10 +231,11 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding(5),
|
||||
Padding = new MarginPadding { Right = 160 },
|
||||
Padding = new MarginPadding { Right = 60 },
|
||||
Spacing = new Vector2(5),
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsNumberBox
|
||||
@ -253,9 +245,10 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Width = 200,
|
||||
Current = playerId,
|
||||
},
|
||||
drawableContainer = new Container
|
||||
userPanelContainer = new Container
|
||||
{
|
||||
Size = new Vector2(100, 70),
|
||||
Width = 400,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -298,7 +291,12 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
private void updatePanel() => Scheduler.AddOnce(() =>
|
||||
{
|
||||
drawableContainer.Child = new UserGridPanel(user.ToAPIUser()) { Width = 300 };
|
||||
userPanelContainer.Child = new UserListPanel(user.ToAPIUser())
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Scale = new Vector2(1f),
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -15,7 +13,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osuTK;
|
||||
|
||||
@ -27,23 +24,24 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
protected abstract BindableList<TModel> Storage { get; }
|
||||
|
||||
private FillFlowContainer<TDrawable> flow;
|
||||
private FillFlowContainer<TDrawable> flow = null!;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private TournamentSceneManager sceneManager { get; set; }
|
||||
[Resolved]
|
||||
private TournamentSceneManager? sceneManager { get; set; }
|
||||
|
||||
protected ControlPanel ControlPanel;
|
||||
protected ControlPanel ControlPanel = null!;
|
||||
|
||||
private readonly TournamentScreen parentScreen;
|
||||
private BackButton backButton;
|
||||
private readonly TournamentScreen? parentScreen;
|
||||
|
||||
protected TournamentEditorScreen(TournamentScreen parentScreen = null)
|
||||
private BackButton backButton = null!;
|
||||
|
||||
protected TournamentEditorScreen(TournamentScreen? parentScreen = null)
|
||||
{
|
||||
this.parentScreen = parentScreen;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
@ -63,6 +61,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(20),
|
||||
Padding = new MarginPadding(20),
|
||||
},
|
||||
},
|
||||
ControlPanel = new ControlPanel
|
||||
@ -75,9 +74,10 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Text = "Add new",
|
||||
Action = () => Storage.Add(new TModel())
|
||||
},
|
||||
new DangerousSettingsButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
BackgroundColour = colours.Pink3,
|
||||
Text = "Clear all",
|
||||
Action = Storage.Clear
|
||||
},
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -15,7 +13,15 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
{
|
||||
internal partial class ActionableInfo : LabelledDrawable<Drawable>
|
||||
{
|
||||
protected OsuButton Button;
|
||||
public const float BUTTON_SIZE = 120;
|
||||
|
||||
public Action? Action;
|
||||
|
||||
protected FillFlowContainer FlowContainer = null!;
|
||||
|
||||
protected OsuButton Button = null!;
|
||||
|
||||
private TournamentSpriteText valueText = null!;
|
||||
|
||||
public ActionableInfo()
|
||||
: base(true)
|
||||
@ -37,11 +43,6 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
set => valueText.Colour = value ? Color4.Red : Color4.White;
|
||||
}
|
||||
|
||||
public Action Action;
|
||||
|
||||
private TournamentSpriteText valueText;
|
||||
protected FillFlowContainer FlowContainer;
|
||||
|
||||
protected override Drawable CreateComponent() => new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -63,7 +64,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
{
|
||||
Button = new RoundedButton
|
||||
{
|
||||
Size = new Vector2(100, 40),
|
||||
Size = new Vector2(BUTTON_SIZE, 40),
|
||||
Action = () => Action?.Invoke()
|
||||
}
|
||||
}
|
||||
|
@ -106,8 +106,8 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
|
||||
loginOverlay.State.Value = Visibility.Visible;
|
||||
},
|
||||
Value = api?.LocalUser.Value.Username,
|
||||
Failing = api?.IsLoggedIn != true,
|
||||
Value = api.LocalUser.Value.Username,
|
||||
Failing = api.IsLoggedIn != true,
|
||||
Description = "In order to access the API and display metadata, signing in is required."
|
||||
},
|
||||
new LabelledDropdown<RulesetInfo>
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
FlowContainer.Insert(-1, folderButton = new RoundedButton
|
||||
{
|
||||
Text = "Open folder",
|
||||
Width = 100
|
||||
Width = BUTTON_SIZE
|
||||
});
|
||||
|
||||
FlowContainer.Insert(-2, dropdown = new OsuDropdown<string>
|
||||
|
@ -252,14 +252,13 @@ namespace osu.Game.Tournament
|
||||
|
||||
if (shortcutKey != null)
|
||||
{
|
||||
Add(new Container
|
||||
Add(new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(24),
|
||||
Margin = new MarginPadding(5),
|
||||
Masking = true,
|
||||
CornerRadius = 4,
|
||||
Alpha = 0.5f,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Children = new Drawable[]
|
||||
|
@ -1,18 +1,21 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Tournament
|
||||
{
|
||||
public partial class TourneyButton : OsuButton
|
||||
public partial class TourneyButton : SettingsButton
|
||||
{
|
||||
public new Box Background => base.Background;
|
||||
|
||||
public TourneyButton()
|
||||
: base(null)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Padding = new MarginPadding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
numberBox = new OutlinedNumberBox
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
CommitOnFocusLost = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user