mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix naming conflicts in RoomSettingsOverlay.
This commit is contained in:
@ -7,6 +7,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Screens.Multi.Screens.Match.Settings;
|
using osu.Game.Screens.Multi.Screens.Match.Settings;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using osu.Framework.Testing.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
@ -61,8 +62,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
AddStep(@"apply", () =>
|
AddStep(@"apply", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(overlay.ApplyButton);
|
overlay.ClickApplyButton(InputManager);
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +78,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public string CurrentName
|
public string CurrentName
|
||||||
{
|
{
|
||||||
get => Name.Text;
|
get => NameField.Text;
|
||||||
set => Name.Text = value;
|
set => NameField.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int? CurrentMaxParticipants
|
public int? CurrentMaxParticipants
|
||||||
@ -87,31 +87,35 @@ namespace osu.Game.Tests.Visual
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
if (int.TryParse(MaxParticipants.Text, out max))
|
if (int.TryParse(MaxParticipantsField.Text, out max))
|
||||||
return max;
|
return max;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
set => MaxParticipants.Text = value?.ToString();
|
set => MaxParticipantsField.Text = value?.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoomAvailability CurrentAvailability
|
public RoomAvailability CurrentAvailability
|
||||||
{
|
{
|
||||||
get => Availability.Current.Value;
|
get => AvailabilityPicker.Current.Value;
|
||||||
set => Availability.Current.Value = value;
|
set => AvailabilityPicker.Current.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameType CurrentType
|
public GameType CurrentType
|
||||||
{
|
{
|
||||||
get => Type.Current.Value;
|
get => TypePicker.Current.Value;
|
||||||
set => Type.Current.Value = value;
|
set => TypePicker.Current.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TriangleButton ApplyButton => Apply;
|
|
||||||
|
|
||||||
public TestRoomSettingsOverlay(Room room) : base(room)
|
public TestRoomSettingsOverlay(Room room) : base(room)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClickApplyButton(ManualInputManager inputManager)
|
||||||
|
{
|
||||||
|
inputManager.MoveMouseTo(ApplyButton);
|
||||||
|
inputManager.Click(MouseButton.Left);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,10 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
private readonly OsuSpriteText typeLabel;
|
private readonly OsuSpriteText typeLabel;
|
||||||
|
|
||||||
protected readonly OsuTextBox Name, MaxParticipants;
|
protected readonly OsuTextBox NameField, MaxParticipantsField;
|
||||||
protected readonly RoomAvailabilityPicker Availability;
|
protected readonly RoomAvailabilityPicker AvailabilityPicker;
|
||||||
protected readonly GameTypePicker Type;
|
protected readonly GameTypePicker TypePicker;
|
||||||
protected readonly TriangleButton Apply;
|
protected readonly TriangleButton ApplyButton;
|
||||||
|
|
||||||
public RoomSettingsOverlay(Room room)
|
public RoomSettingsOverlay(Room room)
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
{
|
{
|
||||||
new Section("ROOM NAME")
|
new Section("ROOM NAME")
|
||||||
{
|
{
|
||||||
Child = Name = new SettingsTextBox
|
Child = NameField = new SettingsTextBox
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
OnCommit = (sender, text) => apply(),
|
OnCommit = (sender, text) => apply(),
|
||||||
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
},
|
},
|
||||||
new Section("ROOM VISIBILITY")
|
new Section("ROOM VISIBILITY")
|
||||||
{
|
{
|
||||||
Child = Availability = new RoomAvailabilityPicker(),
|
Child = AvailabilityPicker = new RoomAvailabilityPicker(),
|
||||||
},
|
},
|
||||||
new Section("GAME TYPE")
|
new Section("GAME TYPE")
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
Spacing = new Vector2(7),
|
Spacing = new Vector2(7),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Type = new GameTypePicker
|
TypePicker = new GameTypePicker
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
},
|
||||||
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
{
|
{
|
||||||
new Section("MAX PARTICIPANTS")
|
new Section("MAX PARTICIPANTS")
|
||||||
{
|
{
|
||||||
Child = MaxParticipants = new SettingsTextBox
|
Child = MaxParticipantsField = new SettingsTextBox
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
OnCommit = (sender, text) => apply(),
|
OnCommit = (sender, text) => apply(),
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Apply = new ApplyButton
|
ApplyButton = new ApplySettingsButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
@ -135,12 +135,12 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Type.Current.ValueChanged += t => typeLabel.Text = t.Name;
|
TypePicker.Current.ValueChanged += t => typeLabel.Text = t.Name;
|
||||||
|
|
||||||
nameBind.ValueChanged += n => Name.Text = n;
|
nameBind.ValueChanged += n => NameField.Text = n;
|
||||||
availabilityBind.ValueChanged += a => Availability.Current.Value = a;
|
availabilityBind.ValueChanged += a => AvailabilityPicker.Current.Value = a;
|
||||||
typeBind.ValueChanged += t => Type.Current.Value = t;
|
typeBind.ValueChanged += t => TypePicker.Current.Value = t;
|
||||||
maxParticipantsBind.ValueChanged += m => MaxParticipants.Text = m?.ToString();
|
maxParticipantsBind.ValueChanged += m => MaxParticipantsField.Text = m?.ToString();
|
||||||
|
|
||||||
nameBind.BindTo(room.Name);
|
nameBind.BindTo(room.Name);
|
||||||
availabilityBind.BindTo(room.Availability);
|
availabilityBind.BindTo(room.Availability);
|
||||||
@ -177,12 +177,12 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
{
|
{
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
room.Name.Value = Name.Text;
|
room.Name.Value = NameField.Text;
|
||||||
room.Availability.Value = Availability.Current.Value;
|
room.Availability.Value = AvailabilityPicker.Current.Value;
|
||||||
room.Type.Value = Type.Current.Value;
|
room.Type.Value = TypePicker.Current.Value;
|
||||||
|
|
||||||
int max;
|
int max;
|
||||||
if (int.TryParse(MaxParticipants.Text, out max))
|
if (int.TryParse(MaxParticipantsField.Text, out max))
|
||||||
room.MaxParticipants.Value = max;
|
room.MaxParticipants.Value = max;
|
||||||
else
|
else
|
||||||
room.MaxParticipants.Value = null;
|
room.MaxParticipants.Value = null;
|
||||||
@ -249,9 +249,9 @@ namespace osu.Game.Screens.Multi.Screens.Match.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApplyButton : TriangleButton
|
private class ApplySettingsButton : TriangleButton
|
||||||
{
|
{
|
||||||
public ApplyButton()
|
public ApplySettingsButton()
|
||||||
{
|
{
|
||||||
Text = "Apply";
|
Text = "Apply";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user