mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:13:20 +08:00
Merge branch 'master' into lounge-redesign
This commit is contained in:
commit
fbf89493ad
@ -52,7 +52,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.804.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||||
|
52
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs
Normal file
52
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||||
|
{
|
||||||
|
public class TestSceneOsuModMuted : OsuModTestScene
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures that a final volume combo of 0 (i.e. "always muted" mode) constantly plays metronome and completely mutes track.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestZeroFinalCombo() => CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new OsuModMuted
|
||||||
|
{
|
||||||
|
MuteComboCount = { Value = 0 },
|
||||||
|
},
|
||||||
|
PassCondition = () => Beatmap.Value.Track.AggregateVolume.Value == 0.0 &&
|
||||||
|
Player.ChildrenOfType<Metronome>().SingleOrDefault()?.AggregateVolume.Value == 1.0,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures that copying from a normal mod with 0 final combo while originally inversed does not yield incorrect results.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestModCopy()
|
||||||
|
{
|
||||||
|
OsuModMuted muted = null;
|
||||||
|
|
||||||
|
AddStep("create inversed mod", () => muted = new OsuModMuted
|
||||||
|
{
|
||||||
|
MuteComboCount = { Value = 100 },
|
||||||
|
InverseMuting = { Value = true },
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("copy from normal", () => muted.CopyFrom(new OsuModMuted
|
||||||
|
{
|
||||||
|
MuteComboCount = { Value = 0 },
|
||||||
|
InverseMuting = { Value = false },
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddAssert("mute combo count = 0", () => muted.MuteComboCount.Value == 0);
|
||||||
|
AddAssert("inverse muting = false", () => muted.InverseMuting.Value == false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("Hitcircle button not clickable", () => !hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Enabled.Value);
|
AddAssert("Hitcircle button not clickable", () => !hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Enabled.Value);
|
||||||
AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));
|
AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));
|
||||||
AddAssert("Hitcircle button is clickable", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Enabled.Value);
|
AddAssert("Hitcircle button is clickable", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Enabled.Value);
|
||||||
AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Click());
|
AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").TriggerClick());
|
||||||
AddAssert("Tool changed", () => hitObjectComposer.ChildrenOfType<ComposeBlueprintContainer>().First().CurrentTool is HitCircleCompositionTool);
|
AddAssert("Tool changed", () => hitObjectComposer.ChildrenOfType<ComposeBlueprintContainer>().First().CurrentTool is HitCircleCompositionTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
var lastAction = pauseOverlay.OnRetry;
|
var lastAction = pauseOverlay.OnRetry;
|
||||||
pauseOverlay.OnRetry = () => triggered = true;
|
pauseOverlay.OnRetry = () => triggered = true;
|
||||||
|
|
||||||
getButton(1).Click();
|
getButton(1).TriggerClick();
|
||||||
pauseOverlay.OnRetry = lastAction;
|
pauseOverlay.OnRetry = lastAction;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
|
AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
|
||||||
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
|
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
|
||||||
|
|
||||||
AddStep("select first room", () => container.Rooms.First().Click());
|
AddStep("select first room", () => container.Rooms.First().TriggerClick());
|
||||||
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
DrawableRoom.PasswordEntryPopover passwordEntryPopover = null;
|
DrawableRoom.PasswordEntryPopover passwordEntryPopover = null;
|
||||||
AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType<DrawableRoom.PasswordEntryPopover>().FirstOrDefault()) != null);
|
AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType<DrawableRoom.PasswordEntryPopover>().FirstOrDefault()) != null);
|
||||||
AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType<TextBox>().First().Text = "password");
|
AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType<TextBox>().First().Text = "password");
|
||||||
AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().Click());
|
AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().TriggerClick());
|
||||||
|
|
||||||
AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
|
AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
|
||||||
AddUntilStep("wait for join", () => client.Room != null);
|
AddUntilStep("wait for join", () => client.Room != null);
|
||||||
@ -373,7 +373,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("open mod overlay", () => this.ChildrenOfType<PurpleTriangleButton>().ElementAt(2).Click());
|
AddStep("open mod overlay", () => this.ChildrenOfType<PurpleTriangleButton>().ElementAt(2).TriggerClick());
|
||||||
|
|
||||||
AddStep("invoke on back button", () => multiplayerScreen.OnBackButton());
|
AddStep("invoke on back button", () => multiplayerScreen.OnBackButton());
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddAssert("dialog overlay is hidden", () => DialogOverlay.State.Value == Visibility.Hidden);
|
AddAssert("dialog overlay is hidden", () => DialogOverlay.State.Value == Visibility.Hidden);
|
||||||
|
|
||||||
testLeave("lounge tab item", () => this.ChildrenOfType<BreadcrumbControl<IScreen>.BreadcrumbTabItem>().First().Click());
|
testLeave("lounge tab item", () => this.ChildrenOfType<BreadcrumbControl<IScreen>.BreadcrumbTabItem>().First().TriggerClick());
|
||||||
|
|
||||||
testLeave("back button", () => multiplayerScreen.OnBackButton());
|
testLeave("back button", () => multiplayerScreen.OnBackButton());
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddStep("attempt join room", () => InputManager.Key(Key.Enter));
|
AddStep("attempt join room", () => InputManager.Key(Key.Enter));
|
||||||
AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType<DrawableRoom.PasswordEntryPopover>().FirstOrDefault()) != null);
|
AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType<DrawableRoom.PasswordEntryPopover>().FirstOrDefault()) != null);
|
||||||
AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType<TextBox>().First().Text = "password");
|
AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType<TextBox>().First().Text = "password");
|
||||||
AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().Click());
|
AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().TriggerClick());
|
||||||
|
|
||||||
AddAssert("room join requested", () => lastJoinedRoom == RoomManager.Rooms.First());
|
AddAssert("room join requested", () => lastJoinedRoom == RoomManager.Rooms.First());
|
||||||
AddAssert("room join password correct", () => lastJoinedPassword == "password");
|
AddAssert("room join password correct", () => lastJoinedPassword == "password");
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("show manually", () => accountCreation.Show());
|
AddStep("show manually", () => accountCreation.Show());
|
||||||
AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible);
|
AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible);
|
||||||
|
|
||||||
AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().Click());
|
AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().TriggerClick());
|
||||||
AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true);
|
AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true);
|
||||||
|
|
||||||
AddStep("log back in", () => API.Login("dummy", "password"));
|
AddStep("log back in", () => API.Login("dummy", "password"));
|
||||||
|
@ -330,22 +330,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
InputManager.ReleaseKey(Key.AltLeft);
|
InputManager.ReleaseKey(Key.AltLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pressCloseDocumentKeys() => pressKeysFor(PlatformAction.DocumentClose);
|
private void pressCloseDocumentKeys() => InputManager.Keys(PlatformAction.DocumentClose);
|
||||||
|
|
||||||
private void pressNewTabKeys() => pressKeysFor(PlatformAction.TabNew);
|
private void pressNewTabKeys() => InputManager.Keys(PlatformAction.TabNew);
|
||||||
|
|
||||||
private void pressRestoreTabKeys() => pressKeysFor(PlatformAction.TabRestore);
|
private void pressRestoreTabKeys() => InputManager.Keys(PlatformAction.TabRestore);
|
||||||
|
|
||||||
private void pressKeysFor(PlatformAction type)
|
|
||||||
{
|
|
||||||
var binding = host.PlatformKeyBindings.First(b => (PlatformAction)b.Action == type);
|
|
||||||
|
|
||||||
foreach (var k in binding.KeyCombination.Keys)
|
|
||||||
InputManager.PressKey((Key)k);
|
|
||||||
|
|
||||||
foreach (var k in binding.KeyCombination.Keys)
|
|
||||||
InputManager.ReleaseKey((Key)k);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clickDrawable(Drawable d)
|
private void clickDrawable(Drawable d)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Show", () => overlay.Show());
|
AddStep("Show", () => overlay.Show());
|
||||||
AddUntilStep("Show More button is visible", () => showMoreButton?.Alpha == 1);
|
AddUntilStep("Show More button is visible", () => showMoreButton?.Alpha == 1);
|
||||||
setUpNewsResponse(responseWithNoCursor, "Set up no cursor response");
|
setUpNewsResponse(responseWithNoCursor, "Set up no cursor response");
|
||||||
AddStep("Click Show More", () => showMoreButton?.Click());
|
AddStep("Click Show More", () => showMoreButton?.TriggerClick());
|
||||||
AddUntilStep("Show More button is hidden", () => showMoreButton?.Alpha == 0);
|
AddUntilStep("Show More button is hidden", () => showMoreButton?.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,19 +32,19 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("click button", () => button.Click());
|
AddStep("click button", () => button.TriggerClick());
|
||||||
|
|
||||||
AddAssert("action fired once", () => fireCount == 1);
|
AddAssert("action fired once", () => fireCount == 1);
|
||||||
AddAssert("is in loading state", () => button.IsLoading);
|
AddAssert("is in loading state", () => button.IsLoading);
|
||||||
|
|
||||||
AddStep("click button", () => button.Click());
|
AddStep("click button", () => button.TriggerClick());
|
||||||
|
|
||||||
AddAssert("action not fired", () => fireCount == 1);
|
AddAssert("action not fired", () => fireCount == 1);
|
||||||
AddAssert("is in loading state", () => button.IsLoading);
|
AddAssert("is in loading state", () => button.IsLoading);
|
||||||
|
|
||||||
AddUntilStep("wait for loaded", () => !button.IsLoading);
|
AddUntilStep("wait for loaded", () => !button.IsLoading);
|
||||||
|
|
||||||
AddStep("click button", () => button.Click());
|
AddStep("click button", () => button.TriggerClick());
|
||||||
|
|
||||||
AddAssert("action fired twice", () => fireCount == 2);
|
AddAssert("action fired twice", () => fireCount == 2);
|
||||||
AddAssert("is in loading state", () => button.IsLoading);
|
AddAssert("is in loading state", () => button.IsLoading);
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Log in", logIn);
|
AddStep("Log in", logIn);
|
||||||
AddStep("User comment", () => addVotePill(getUserComment()));
|
AddStep("User comment", () => addVotePill(getUserComment()));
|
||||||
AddAssert("Background is transparent", () => votePill.Background.Alpha == 0);
|
AddAssert("Background is transparent", () => votePill.Background.Alpha == 0);
|
||||||
AddStep("Click", () => votePill.Click());
|
AddStep("Click", () => votePill.TriggerClick());
|
||||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Log in", logIn);
|
AddStep("Log in", logIn);
|
||||||
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
||||||
AddAssert("Background is visible", () => votePill.Background.Alpha == 1);
|
AddAssert("Background is visible", () => votePill.Background.Alpha == 1);
|
||||||
AddStep("Click", () => votePill.Click());
|
AddStep("Click", () => votePill.TriggerClick());
|
||||||
AddAssert("Loading", () => votePill.IsLoading);
|
AddAssert("Loading", () => votePill.IsLoading);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Hide login overlay", () => login.Hide());
|
AddStep("Hide login overlay", () => login.Hide());
|
||||||
AddStep("Log out", API.Logout);
|
AddStep("Log out", API.Logout);
|
||||||
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
||||||
AddStep("Click", () => votePill.Click());
|
AddStep("Click", () => votePill.TriggerClick());
|
||||||
AddAssert("Login overlay is visible", () => login.State.Value == Visibility.Visible);
|
AddAssert("Login overlay is visible", () => login.State.Value == Visibility.Visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
|
|
||||||
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms[0]));
|
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms[0]));
|
||||||
|
|
||||||
AddStep("select last room", () => roomsContainer.Rooms[^1].Click());
|
AddStep("select last room", () => roomsContainer.Rooms[^1].TriggerClick());
|
||||||
|
|
||||||
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms[0]));
|
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms[0]));
|
||||||
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms[^1]));
|
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms[^1]));
|
||||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().Click());
|
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().TriggerClick());
|
||||||
AddUntilStep("player loader loaded", () => Stack.CurrentScreen is PlayerLoader);
|
AddUntilStep("player loader loaded", () => Stack.CurrentScreen is PlayerLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
{
|
{
|
||||||
var resetButton = settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First();
|
var resetButton = settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First();
|
||||||
|
|
||||||
resetButton.Click();
|
resetButton.TriggerClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
||||||
@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
{
|
{
|
||||||
var resetButton = panel.ChildrenOfType<ResetButton>().First();
|
var resetButton = panel.ChildrenOfType<ResetButton>().First();
|
||||||
|
|
||||||
resetButton.Click();
|
resetButton.TriggerClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
||||||
|
@ -94,10 +94,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddAssert("selected mod matches", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.Value == 1.2);
|
AddAssert("selected mod matches", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.Value == 1.2);
|
||||||
|
|
||||||
AddStep("deselect", () => modSelect.DeselectAllButton.Click());
|
AddStep("deselect", () => modSelect.DeselectAllButton.TriggerClick());
|
||||||
AddAssert("selected mods empty", () => SelectedMods.Value.Count == 0);
|
AddAssert("selected mods empty", () => SelectedMods.Value.Count == 0);
|
||||||
|
|
||||||
AddStep("reselect", () => modSelect.GetModButton(osuModDoubleTime).Click());
|
AddStep("reselect", () => modSelect.GetModButton(osuModDoubleTime).TriggerClick());
|
||||||
AddAssert("selected mod has default value", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.IsDefault == true);
|
AddAssert("selected mod has default value", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.IsDefault == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
||||||
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
||||||
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
||||||
AddStep("open Customisation", () => modSelect.CustomiseButton.Click());
|
AddStep("open Customisation", () => modSelect.CustomiseButton.TriggerClick());
|
||||||
AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableMod));
|
AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableMod));
|
||||||
AddAssert("controls hidden", () => modSelect.ModSettingsContainer.State.Value == Visibility.Hidden);
|
AddAssert("controls hidden", () => modSelect.ModSettingsContainer.State.Value == Visibility.Hidden);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,6 @@ namespace osu.Game.Tournament.Tests.Screens
|
|||||||
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
|
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
|
||||||
|
|
||||||
private void toggleWarmup()
|
private void toggleWarmup()
|
||||||
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().Click());
|
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().TriggerClick());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Containers.Markdown
|
|||||||
|
|
||||||
public override SpriteText CreateSpriteText() => new OsuSpriteText
|
public override SpriteText CreateSpriteText() => new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 14),
|
Font = OsuFont.GetFont(Typeface.Inter, size: 14, weight: FontWeight.Regular),
|
||||||
};
|
};
|
||||||
|
|
||||||
public override MarkdownTextFlowContainer CreateTextFlow() => new OsuMarkdownTextFlowContainer();
|
public override MarkdownTextFlowContainer CreateTextFlow() => new OsuMarkdownTextFlowContainer();
|
||||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Graphics.Containers.Markdown
|
|||||||
public FontWeight FontWeight;
|
public FontWeight FontWeight;
|
||||||
|
|
||||||
protected override SpriteText CreateSpriteText()
|
protected override SpriteText CreateSpriteText()
|
||||||
=> base.CreateSpriteText().With(t => t.Font = t.Font.With(size: FontSize, weight: FontWeight));
|
=> base.CreateSpriteText().With(t => t.Font = t.Font.With(Typeface.Torus, size: FontSize, weight: FontWeight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Graphics
|
|||||||
|
|
||||||
public static FontUsage Torus => GetFont(Typeface.Torus, weight: FontWeight.Regular);
|
public static FontUsage Torus => GetFont(Typeface.Torus, weight: FontWeight.Regular);
|
||||||
|
|
||||||
|
public static FontUsage Inter => GetFont(Typeface.Inter, weight: FontWeight.Regular);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves a <see cref="FontUsage"/>.
|
/// Retrieves a <see cref="FontUsage"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,6 +56,9 @@ namespace osu.Game.Graphics
|
|||||||
|
|
||||||
case Typeface.Torus:
|
case Typeface.Torus:
|
||||||
return "Torus";
|
return "Torus";
|
||||||
|
|
||||||
|
case Typeface.Inter:
|
||||||
|
return "Inter";
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -107,7 +112,8 @@ namespace osu.Game.Graphics
|
|||||||
public enum Typeface
|
public enum Typeface
|
||||||
{
|
{
|
||||||
Venera,
|
Venera,
|
||||||
Torus
|
Torus,
|
||||||
|
Inter,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FontWeight
|
public enum FontWeight
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Add(receptor = new Receptor());
|
Add(receptor = new Receptor());
|
||||||
}
|
}
|
||||||
|
|
||||||
receptor.OnBackPressed = () => button.Click();
|
receptor.OnBackPressed = () => button.TriggerClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -257,8 +257,8 @@ namespace osu.Game.Online.API
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHubClientConnector GetHubConnector(string clientName, string endpoint) =>
|
public IHubClientConnector GetHubConnector(string clientName, string endpoint, bool preferMessagePack) =>
|
||||||
new HubClientConnector(clientName, endpoint, this, versionHash);
|
new HubClientConnector(clientName, endpoint, this, versionHash, preferMessagePack);
|
||||||
|
|
||||||
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Online.API
|
|||||||
state.Value = APIState.Offline;
|
state.Value = APIState.Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHubClientConnector GetHubConnector(string clientName, string endpoint) => null;
|
public IHubClientConnector GetHubConnector(string clientName, string endpoint, bool preferMessagePack) => null;
|
||||||
|
|
||||||
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,8 @@ namespace osu.Game.Online.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clientName">The name of the client this connector connects for, used for logging.</param>
|
/// <param name="clientName">The name of the client this connector connects for, used for logging.</param>
|
||||||
/// <param name="endpoint">The endpoint to the hub.</param>
|
/// <param name="endpoint">The endpoint to the hub.</param>
|
||||||
IHubClientConnector? GetHubConnector(string clientName, string endpoint);
|
/// <param name="preferMessagePack">Whether to use MessagePack for serialisation if available on this platform.</param>
|
||||||
|
IHubClientConnector? GetHubConnector(string clientName, string endpoint, bool preferMessagePack = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new user account. This is a blocking operation.
|
/// Create a new user account. This is a blocking operation.
|
||||||
|
@ -26,6 +26,7 @@ namespace osu.Game.Online
|
|||||||
private readonly string clientName;
|
private readonly string clientName;
|
||||||
private readonly string endpoint;
|
private readonly string endpoint;
|
||||||
private readonly string versionHash;
|
private readonly string versionHash;
|
||||||
|
private readonly bool preferMessagePack;
|
||||||
private readonly IAPIProvider api;
|
private readonly IAPIProvider api;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -51,12 +52,14 @@ namespace osu.Game.Online
|
|||||||
/// <param name="endpoint">The endpoint to the hub.</param>
|
/// <param name="endpoint">The endpoint to the hub.</param>
|
||||||
/// <param name="api"> An API provider used to react to connection state changes.</param>
|
/// <param name="api"> An API provider used to react to connection state changes.</param>
|
||||||
/// <param name="versionHash">The hash representing the current game version, used for verification purposes.</param>
|
/// <param name="versionHash">The hash representing the current game version, used for verification purposes.</param>
|
||||||
public HubClientConnector(string clientName, string endpoint, IAPIProvider api, string versionHash)
|
/// <param name="preferMessagePack">Whether to use MessagePack for serialisation if available on this platform.</param>
|
||||||
|
public HubClientConnector(string clientName, string endpoint, IAPIProvider api, string versionHash, bool preferMessagePack = true)
|
||||||
{
|
{
|
||||||
this.clientName = clientName;
|
this.clientName = clientName;
|
||||||
this.endpoint = endpoint;
|
this.endpoint = endpoint;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.versionHash = versionHash;
|
this.versionHash = versionHash;
|
||||||
|
this.preferMessagePack = preferMessagePack;
|
||||||
|
|
||||||
apiState.BindTo(api.State);
|
apiState.BindTo(api.State);
|
||||||
apiState.BindValueChanged(state =>
|
apiState.BindValueChanged(state =>
|
||||||
@ -144,13 +147,19 @@ namespace osu.Game.Online
|
|||||||
options.Headers.Add("OsuVersionHash", versionHash);
|
options.Headers.Add("OsuVersionHash", versionHash);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (RuntimeInfo.SupportsJIT)
|
if (RuntimeInfo.SupportsJIT && preferMessagePack)
|
||||||
builder.AddMessagePackProtocol();
|
builder.AddMessagePackProtocol();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// eventually we will precompile resolvers for messagepack, but this isn't working currently
|
// eventually we will precompile resolvers for messagepack, but this isn't working currently
|
||||||
// see https://github.com/neuecc/MessagePack-CSharp/issues/780#issuecomment-768794308.
|
// see https://github.com/neuecc/MessagePack-CSharp/issues/780#issuecomment-768794308.
|
||||||
builder.AddNewtonsoftJsonProtocol(options => { options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; });
|
builder.AddNewtonsoftJsonProtocol(options =>
|
||||||
|
{
|
||||||
|
options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||||
|
// TODO: This should only be required to be `TypeNameHandling.Auto`.
|
||||||
|
// See usage in osu-server-spectator for further documentation as to why this is required.
|
||||||
|
options.PayloadSerializerSettings.TypeNameHandling = TypeNameHandling.All;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var newConnection = builder.Build();
|
var newConnection = builder.Build();
|
||||||
|
@ -50,6 +50,25 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// <param name="state">The new state of the user.</param>
|
/// <param name="state">The new state of the user.</param>
|
||||||
Task UserStateChanged(int userId, MultiplayerUserState state);
|
Task UserStateChanged(int userId, MultiplayerUserState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signals that the match type state has changed for a user in this room.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The ID of the user performing a state change.</param>
|
||||||
|
/// <param name="state">The new state of the user.</param>
|
||||||
|
Task MatchUserStateChanged(int userId, MatchUserState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signals that the match type state has changed for this room.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">The new state of the room.</param>
|
||||||
|
Task MatchRoomStateChanged(MatchRoomState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send a match type specific request.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">The event to handle.</param>
|
||||||
|
Task MatchEvent(MatchServerEvent e);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Signals that a user in this room changed their beatmap availability state.
|
/// Signals that a user in this room changed their beatmap availability state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -55,6 +55,12 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// <param name="newMods">The proposed new mods, excluding any required by the room itself.</param>
|
/// <param name="newMods">The proposed new mods, excluding any required by the room itself.</param>
|
||||||
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send a match type specific request.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The request to send.</param>
|
||||||
|
Task SendMatchRequest(MatchUserRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// As the host of a room, start the match.
|
/// As the host of a room, start the match.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
23
osu.Game/Online/Multiplayer/MatchRoomState.cs
Normal file
23
osu.Game/Online/Multiplayer/MatchRoomState.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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 MessagePack;
|
||||||
|
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Room-wide state for the current match type.
|
||||||
|
/// Can be used to contain any state which should be used before or during match gameplay.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
[MessagePackObject]
|
||||||
|
[Union(0, typeof(TeamVersusRoomState))]
|
||||||
|
// TODO: this will need to be abstract or interface when/if we get messagepack working. for now it isn't as it breaks json serialisation.
|
||||||
|
public class MatchRoomState
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
17
osu.Game/Online/Multiplayer/MatchServerEvent.cs
Normal file
17
osu.Game/Online/Multiplayer/MatchServerEvent.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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 MessagePack;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An event from the server to allow clients to update gameplay to an expected state.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
[MessagePackObject]
|
||||||
|
public abstract class MatchServerEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
// 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 MessagePack;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||||
|
{
|
||||||
|
public class ChangeTeamRequest : MatchUserRequest
|
||||||
|
{
|
||||||
|
[Key(0)]
|
||||||
|
public int TeamID { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +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 System;
|
||||||
|
using MessagePack;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
[MessagePackObject]
|
||||||
|
public class MultiplayerTeam
|
||||||
|
{
|
||||||
|
[Key(0)]
|
||||||
|
public int ID { get; set; }
|
||||||
|
|
||||||
|
[Key(1)]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using MessagePack;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||||
|
{
|
||||||
|
[MessagePackObject]
|
||||||
|
public class TeamVersusRoomState : MatchRoomState
|
||||||
|
{
|
||||||
|
[Key(0)]
|
||||||
|
public List<MultiplayerTeam> Teams { get; set; } = new List<MultiplayerTeam>();
|
||||||
|
|
||||||
|
public static TeamVersusRoomState CreateDefault() =>
|
||||||
|
new TeamVersusRoomState
|
||||||
|
{
|
||||||
|
Teams =
|
||||||
|
{
|
||||||
|
new MultiplayerTeam { ID = 0, Name = "Team Red" },
|
||||||
|
new MultiplayerTeam { ID = 1, Name = "Team Blue" },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
// 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 MessagePack;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||||
|
{
|
||||||
|
public class TeamVersusUserState : MatchUserState
|
||||||
|
{
|
||||||
|
[Key(0)]
|
||||||
|
public int TeamID { get; set; }
|
||||||
|
}
|
||||||
|
}
|
17
osu.Game/Online/Multiplayer/MatchUserRequest.cs
Normal file
17
osu.Game/Online/Multiplayer/MatchUserRequest.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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 MessagePack;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A request from a user to perform an action specific to the current match type.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
[MessagePackObject]
|
||||||
|
public abstract class MatchUserRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
23
osu.Game/Online/Multiplayer/MatchUserState.cs
Normal file
23
osu.Game/Online/Multiplayer/MatchUserState.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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 MessagePack;
|
||||||
|
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// User specific state for the current match type.
|
||||||
|
/// Can be used to contain any state which should be used before or during match gameplay.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
[MessagePackObject]
|
||||||
|
[Union(0, typeof(TeamVersusUserState))]
|
||||||
|
// TODO: this will need to be abstract or interface when/if we get messagepack working. for now it isn't as it breaks json serialisation.
|
||||||
|
public class MatchUserState
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -293,6 +293,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
|
|
||||||
public abstract Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
public abstract Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||||
|
|
||||||
|
public abstract Task SendMatchRequest(MatchUserRequest request);
|
||||||
|
|
||||||
public abstract Task StartMatch();
|
public abstract Task StartMatch();
|
||||||
|
|
||||||
Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state)
|
Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state)
|
||||||
@ -420,6 +422,46 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Task IMultiplayerClient.MatchUserStateChanged(int userId, MatchUserState state)
|
||||||
|
{
|
||||||
|
if (Room == null)
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
Scheduler.Add(() =>
|
||||||
|
{
|
||||||
|
if (Room == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Room.Users.Single(u => u.UserID == userId).MatchState = state;
|
||||||
|
RoomUpdated?.Invoke();
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
Task IMultiplayerClient.MatchRoomStateChanged(MatchRoomState state)
|
||||||
|
{
|
||||||
|
if (Room == null)
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
Scheduler.Add(() =>
|
||||||
|
{
|
||||||
|
if (Room == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Room.MatchState = state;
|
||||||
|
RoomUpdated?.Invoke();
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task MatchEvent(MatchServerEvent e)
|
||||||
|
{
|
||||||
|
// not used by any match types just yet.
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
Task IMultiplayerClient.UserBeatmapAvailabilityChanged(int userId, BeatmapAvailability beatmapAvailability)
|
Task IMultiplayerClient.UserBeatmapAvailabilityChanged(int userId, BeatmapAvailability beatmapAvailability)
|
||||||
{
|
{
|
||||||
if (Room == null)
|
if (Room == null)
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// All users currently in this room.
|
/// All users currently in this room.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Key(3)]
|
[Key(3)]
|
||||||
public List<MultiplayerRoomUser> Users { get; set; } = new List<MultiplayerRoomUser>();
|
public IList<MultiplayerRoomUser> Users { get; set; } = new List<MultiplayerRoomUser>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The host of this room, in control of changing room settings.
|
/// The host of this room, in control of changing room settings.
|
||||||
@ -47,6 +47,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[Key(4)]
|
[Key(4)]
|
||||||
public MultiplayerRoomUser? Host { get; set; }
|
public MultiplayerRoomUser? Host { get; set; }
|
||||||
|
|
||||||
|
[Key(5)]
|
||||||
|
public MatchRoomState? MatchState { get; set; }
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
[SerializationConstructor]
|
[SerializationConstructor]
|
||||||
public MultiplayerRoom(long roomId)
|
public MultiplayerRoom(long roomId)
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
|
|
||||||
namespace osu.Game.Online.Multiplayer
|
namespace osu.Game.Online.Multiplayer
|
||||||
{
|
{
|
||||||
@ -39,6 +40,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[Key(7)]
|
[Key(7)]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Key(8)]
|
||||||
|
public MatchType MatchType { get; set; }
|
||||||
|
|
||||||
public bool Equals(MultiplayerRoomSettings other)
|
public bool Equals(MultiplayerRoomSettings other)
|
||||||
=> BeatmapID == other.BeatmapID
|
=> BeatmapID == other.BeatmapID
|
||||||
&& BeatmapChecksum == other.BeatmapChecksum
|
&& BeatmapChecksum == other.BeatmapChecksum
|
||||||
@ -47,7 +51,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
&& RulesetID == other.RulesetID
|
&& RulesetID == other.RulesetID
|
||||||
&& Password.Equals(other.Password, StringComparison.Ordinal)
|
&& Password.Equals(other.Password, StringComparison.Ordinal)
|
||||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
||||||
&& PlaylistItemId == other.PlaylistItemId;
|
&& PlaylistItemId == other.PlaylistItemId
|
||||||
|
&& MatchType == other.MatchType;
|
||||||
|
|
||||||
public override string ToString() => $"Name:{Name}"
|
public override string ToString() => $"Name:{Name}"
|
||||||
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
|
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
|
||||||
@ -55,6 +60,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
|
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
|
||||||
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
||||||
+ $" Ruleset:{RulesetID}"
|
+ $" Ruleset:{RulesetID}"
|
||||||
|
+ $" Type:{MatchType}"
|
||||||
+ $" Item:{PlaylistItemId}";
|
+ $" Item:{PlaylistItemId}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[Key(1)]
|
[Key(1)]
|
||||||
public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle;
|
public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle;
|
||||||
|
|
||||||
|
[Key(4)]
|
||||||
|
public MatchUserState? MatchState { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The availability state of the current beatmap.
|
/// The availability state of the current beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -37,7 +37,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
connector = api.GetHubConnector(nameof(OnlineMultiplayerClient), endpoint);
|
// Importantly, we are intentionally not using MessagePack here to correctly support derived class serialization.
|
||||||
|
// More information on the limitations / reasoning can be found in osu-server-spectator's initialisation code.
|
||||||
|
connector = api.GetHubConnector(nameof(OnlineMultiplayerClient), endpoint, false);
|
||||||
|
|
||||||
if (connector != null)
|
if (connector != null)
|
||||||
{
|
{
|
||||||
@ -56,6 +58,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
|
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
|
||||||
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
|
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
|
||||||
connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged);
|
connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged);
|
||||||
|
connection.On<MatchRoomState>(nameof(IMultiplayerClient.MatchRoomStateChanged), ((IMultiplayerClient)this).MatchRoomStateChanged);
|
||||||
|
connection.On<int, MatchUserState>(nameof(IMultiplayerClient.MatchUserStateChanged), ((IMultiplayerClient)this).MatchUserStateChanged);
|
||||||
|
connection.On<MatchServerEvent>(nameof(IMultiplayerClient.MatchEvent), ((IMultiplayerClient)this).MatchEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
IsConnected.BindTo(connector.IsConnected);
|
IsConnected.BindTo(connector.IsConnected);
|
||||||
@ -118,6 +123,14 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeUserMods), newMods);
|
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeUserMods), newMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task SendMatchRequest(MatchUserRequest request)
|
||||||
|
{
|
||||||
|
if (!IsConnected.Value)
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
return connection.InvokeAsync(nameof(IMultiplayerServer.SendMatchRequest), request);
|
||||||
|
}
|
||||||
|
|
||||||
public override Task StartMatch()
|
public override Task StartMatch()
|
||||||
{
|
{
|
||||||
if (!IsConnected.Value)
|
if (!IsConnected.Value)
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms
|
|
||||||
{
|
|
||||||
public abstract class GameType
|
|
||||||
{
|
|
||||||
public abstract string Name { get; }
|
|
||||||
|
|
||||||
public abstract Drawable GetIcon(OsuColour colours, float size);
|
|
||||||
|
|
||||||
public override int GetHashCode() => GetType().GetHashCode();
|
|
||||||
public override bool Equals(object obj) => GetType() == obj?.GetType();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypePlaylists : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Playlists";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size) => new SpriteIcon
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Icon = FontAwesome.Regular.Clock,
|
|
||||||
Size = new Vector2(size),
|
|
||||||
Colour = colours.Blue,
|
|
||||||
Shadow = false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeTag : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Tag";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new SpriteIcon
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Icon = FontAwesome.Solid.Sync,
|
|
||||||
Size = new Vector2(size),
|
|
||||||
Colour = colours.Blue,
|
|
||||||
Shadow = false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeTagTeam : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Tag Team";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(2f),
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Sync,
|
|
||||||
Size = new Vector2(size * 0.75f),
|
|
||||||
Colour = colours.Blue,
|
|
||||||
Shadow = false,
|
|
||||||
},
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Sync,
|
|
||||||
Size = new Vector2(size * 0.75f),
|
|
||||||
Colour = colours.Pink,
|
|
||||||
Shadow = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeTeamVersus : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Team Versus";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(2f),
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
|
||||||
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class GameTypeVersus : GameType
|
|
||||||
{
|
|
||||||
public override string Name => "Versus";
|
|
||||||
|
|
||||||
public override Drawable GetIcon(OsuColour colours, float size)
|
|
||||||
{
|
|
||||||
return new VersusRow(colours.Blue, colours.Blue, size * 0.6f)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms.GameTypes
|
|
||||||
{
|
|
||||||
public class VersusRow : FillFlowContainer
|
|
||||||
{
|
|
||||||
public VersusRow(Color4 first, Color4 second, float size)
|
|
||||||
{
|
|
||||||
var triangleSize = new Vector2(size);
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Spacing = new Vector2(2f, 0f);
|
|
||||||
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Size = triangleSize,
|
|
||||||
Colour = first,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new EquilateralTriangle
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Rotation = 90,
|
|
||||||
EdgeSmoothness = new Vector2(1f),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Size = triangleSize,
|
|
||||||
Colour = second,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new EquilateralTriangle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Rotation = -90,
|
|
||||||
EdgeSmoothness = new Vector2(1f),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
20
osu.Game/Online/Rooms/MatchType.cs
Normal file
20
osu.Game/Online/Rooms/MatchType.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Rooms
|
||||||
|
{
|
||||||
|
public enum MatchType
|
||||||
|
{
|
||||||
|
// used for osu-web deserialization so names shouldn't be changed.
|
||||||
|
|
||||||
|
Playlists,
|
||||||
|
|
||||||
|
[Description("Head to head")]
|
||||||
|
HeadToHead,
|
||||||
|
|
||||||
|
[Description("Team VS")]
|
||||||
|
TeamVersus,
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,6 @@ using Newtonsoft.Json;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.IO.Serialization.Converters;
|
using osu.Game.IO.Serialization.Converters;
|
||||||
using osu.Game.Online.Rooms.GameTypes;
|
|
||||||
using osu.Game.Online.Rooms.RoomStatuses;
|
using osu.Game.Online.Rooms.RoomStatuses;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -63,7 +62,16 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public readonly Bindable<GameType> Type = new Bindable<GameType>(new GameTypePlaylists());
|
public readonly Bindable<MatchType> Type = new Bindable<MatchType>();
|
||||||
|
|
||||||
|
// Todo: osu-framework bug (https://github.com/ppy/osu-framework/issues/4106)
|
||||||
|
[JsonConverter(typeof(SnakeCaseStringEnumConverter))]
|
||||||
|
[JsonProperty("type")]
|
||||||
|
private MatchType type
|
||||||
|
{
|
||||||
|
get => Type.Value;
|
||||||
|
set => Type.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Action = () => playButton.Click();
|
Action = () => playButton.TriggerClick();
|
||||||
Playing.ValueChanged += playing => progress.FadeTo(playing.NewValue ? 1 : 0, 100);
|
Playing.ValueChanged += playing => progress.FadeTo(playing.NewValue ? 1 : 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
switch (e.Button)
|
switch (e.Button)
|
||||||
{
|
{
|
||||||
case MouseButton.Middle:
|
case MouseButton.Middle:
|
||||||
CloseButton.Click();
|
CloseButton.TriggerClick();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
if (commitButton.IsBlocked.Value)
|
if (commitButton.IsBlocked.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
commitButton.Click();
|
commitButton.TriggerClick();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Programmatically clicks the first <see cref="PopupDialogOkButton"/>.
|
/// Programmatically clicks the first <see cref="PopupDialogOkButton"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PerformOkAction() => Buttons.OfType<PopupDialogOkButton>().First().Click();
|
public void PerformOkAction() => Buttons.OfType<PopupDialogOkButton>().First().TriggerClick();
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
if (!actionInvoked && content.IsPresent)
|
if (!actionInvoked && content.IsPresent)
|
||||||
// In the case a user did not choose an action before a hide was triggered, press the last button.
|
// In the case a user did not choose an action before a hide was triggered, press the last button.
|
||||||
// This is presumed to always be a sane default "cancel" action.
|
// This is presumed to always be a sane default "cancel" action.
|
||||||
buttonsContainer.Last().Click();
|
buttonsContainer.Last().TriggerClick();
|
||||||
|
|
||||||
content.FadeOut(EXIT_DURATION, Easing.InSine);
|
content.FadeOut(EXIT_DURATION, Easing.InSine);
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
private void pressButtonAtIndex(int index)
|
private void pressButtonAtIndex(int index)
|
||||||
{
|
{
|
||||||
if (index < Buttons.Count())
|
if (index < Buttons.Count())
|
||||||
Buttons.Skip(index).First().Click();
|
Buttons.Skip(index).First().TriggerClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Overlays
|
|||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case GlobalAction.Select:
|
case GlobalAction.Select:
|
||||||
CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.Click();
|
CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,11 +404,11 @@ namespace osu.Game.Overlays.Mods
|
|||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.Number1:
|
case Key.Number1:
|
||||||
DeselectAllButton.Click();
|
DeselectAllButton.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Key.Number2:
|
case Key.Number2:
|
||||||
CloseButton.Click();
|
CloseButton.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
if (action == Hotkey)
|
if (action == Hotkey)
|
||||||
{
|
{
|
||||||
Click();
|
TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
Parent.Click();
|
Parent.TriggerClick();
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Wiki
|
|||||||
Child = new OsuSpriteText
|
Child = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = blurbNode.InnerText,
|
Text = blurbNode.InnerText,
|
||||||
Font = OsuFont.GetFont(size: 12),
|
Font = OsuFont.GetFont(Typeface.Inter, size: 12, weight: FontWeight.Light),
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Wiki
|
|||||||
DocumentMargin = new MarginPadding(0);
|
DocumentMargin = new MarginPadding(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SpriteText CreateSpriteText() => base.CreateSpriteText().With(t => t.Font = t.Font.With(weight: FontWeight.Bold));
|
public override SpriteText CreateSpriteText() => base.CreateSpriteText().With(t => t.Font = t.Font.With(Typeface.Torus, weight: FontWeight.Bold));
|
||||||
|
|
||||||
public override MarkdownTextFlowContainer CreateTextFlow() => base.CreateTextFlow().With(f => f.TextAnchor = Anchor.TopCentre);
|
public override MarkdownTextFlowContainer CreateTextFlow() => base.CreateTextFlow().With(f => f.TextAnchor = Anchor.TopCentre);
|
||||||
|
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -41,7 +43,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Value = true
|
Value = true
|
||||||
};
|
};
|
||||||
|
|
||||||
[SettingSource("Final volume at combo", "The combo count at which point the track reaches its final volume.")]
|
[SettingSource("Final volume at combo", "The combo count at which point the track reaches its final volume.", SettingControlType = typeof(SettingsSlider<int, MuteComboSlider>))]
|
||||||
public BindableInt MuteComboCount { get; } = new BindableInt
|
public BindableInt MuteComboCount { get; } = new BindableInt
|
||||||
{
|
{
|
||||||
Default = 100,
|
Default = 100,
|
||||||
@ -64,6 +66,11 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Value = true
|
Value = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected ModMuted()
|
||||||
|
{
|
||||||
|
InverseMuting.BindValueChanged(i => MuteComboCount.MinValue = i.NewValue ? 1 : 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyToTrack(ITrack track)
|
public void ApplyToTrack(ITrack track)
|
||||||
{
|
{
|
||||||
track.AddAdjustment(AdjustableProperty.Volume, mainVolumeAdjust);
|
track.AddAdjustment(AdjustableProperty.Volume, mainVolumeAdjust);
|
||||||
@ -89,7 +96,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
currentCombo = scoreProcessor.Combo.GetBoundCopy();
|
currentCombo = scoreProcessor.Combo.GetBoundCopy();
|
||||||
currentCombo.BindValueChanged(combo =>
|
currentCombo.BindValueChanged(combo =>
|
||||||
{
|
{
|
||||||
double dimFactor = Math.Min(1, (double)combo.NewValue / MuteComboCount.Value);
|
double dimFactor = MuteComboCount.Value == 0 ? 1 : (double)combo.NewValue / MuteComboCount.Value;
|
||||||
|
|
||||||
if (InverseMuting.Value)
|
if (InverseMuting.Value)
|
||||||
dimFactor = 1 - dimFactor;
|
dimFactor = 1 - dimFactor;
|
||||||
@ -101,4 +108,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MuteComboSlider : OsuSliderBar<int>
|
||||||
|
{
|
||||||
|
public override LocalisableString TooltipText => Current.Value == 0 ? "always muted" : base.TooltipText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
if (buttonsTopLevel.Any(b => e.Key == b.TriggerKey))
|
if (buttonsTopLevel.Any(b => e.Key == b.TriggerKey))
|
||||||
{
|
{
|
||||||
logo?.Click();
|
logo?.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
return goBack();
|
return goBack();
|
||||||
|
|
||||||
case GlobalAction.Select:
|
case GlobalAction.Select:
|
||||||
logo?.Click();
|
logo?.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -248,7 +248,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ButtonSystemState.Play:
|
case ButtonSystemState.Play:
|
||||||
backButton.Click();
|
backButton.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -268,11 +268,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ButtonSystemState.TopLevel:
|
case ButtonSystemState.TopLevel:
|
||||||
buttonsTopLevel.First().Click();
|
buttonsTopLevel.First().TriggerClick();
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case ButtonSystemState.Play:
|
case ButtonSystemState.Play:
|
||||||
buttonsPlay.First().Click();
|
buttonsPlay.First().TriggerClick();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,28 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Components
|
namespace osu.Game.Screens.OnlinePlay.Components
|
||||||
{
|
{
|
||||||
public class DrawableGameType : CircularContainer, IHasTooltip
|
public class DrawableGameType : CircularContainer, IHasTooltip
|
||||||
{
|
{
|
||||||
private readonly GameType type;
|
private readonly MatchType type;
|
||||||
|
|
||||||
public LocalisableString TooltipText => type.Name;
|
public LocalisableString TooltipText => type.GetLocalisableDescription();
|
||||||
|
|
||||||
public DrawableGameType(GameType type)
|
public DrawableGameType(MatchType type)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -34,10 +38,138 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load()
|
||||||
{
|
{
|
||||||
Add(type.GetIcon(colours, Height / 2));
|
Add(getIconFor(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getIconFor(MatchType matchType)
|
||||||
|
{
|
||||||
|
float size = Height / 2;
|
||||||
|
|
||||||
|
switch (matchType)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case MatchType.Playlists:
|
||||||
|
return new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(size),
|
||||||
|
Icon = FontAwesome.Regular.Clock,
|
||||||
|
Colour = colours.Blue,
|
||||||
|
Shadow = false
|
||||||
|
};
|
||||||
|
|
||||||
|
case MatchType.HeadToHead:
|
||||||
|
return new VersusRow(colours.Blue, colours.Blue, size * 0.6f)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
};
|
||||||
|
|
||||||
|
case MatchType.TeamVersus:
|
||||||
|
return new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(2f),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
||||||
|
new VersusRow(colours.Blue, colours.Pink, size * 0.5f),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// case MatchType.TagCoop:
|
||||||
|
// return new SpriteIcon
|
||||||
|
// {
|
||||||
|
// Anchor = Anchor.Centre,
|
||||||
|
// Origin = Anchor.Centre,
|
||||||
|
// Size = new Vector2(size),
|
||||||
|
// Icon = FontAwesome.Solid.Sync,
|
||||||
|
// Colour = colours.Blue,
|
||||||
|
//
|
||||||
|
// Shadow = false
|
||||||
|
// };
|
||||||
|
|
||||||
|
// case MatchType.TagTeamCoop:
|
||||||
|
// return new FillFlowContainer
|
||||||
|
// {
|
||||||
|
// Anchor = Anchor.Centre,
|
||||||
|
// Origin = Anchor.Centre,
|
||||||
|
// AutoSizeAxes = Axes.Both,
|
||||||
|
// Direction = FillDirection.Horizontal,
|
||||||
|
// Spacing = new Vector2(2f),
|
||||||
|
// Children = new[]
|
||||||
|
// {
|
||||||
|
// new SpriteIcon
|
||||||
|
// {
|
||||||
|
// Icon = FontAwesome.Solid.Sync,
|
||||||
|
// Size = new Vector2(size * 0.75f),
|
||||||
|
// Colour = colours.Blue,
|
||||||
|
// Shadow = false,
|
||||||
|
// },
|
||||||
|
// new SpriteIcon
|
||||||
|
// {
|
||||||
|
// Icon = FontAwesome.Solid.Sync,
|
||||||
|
// Size = new Vector2(size * 0.75f),
|
||||||
|
// Colour = colours.Pink,
|
||||||
|
// Shadow = false,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VersusRow : FillFlowContainer
|
||||||
|
{
|
||||||
|
public VersusRow(Color4 first, Color4 second, float size)
|
||||||
|
{
|
||||||
|
var triangleSize = new Vector2(size);
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Spacing = new Vector2(2f, 0f);
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Size = triangleSize,
|
||||||
|
Colour = first,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new EquilateralTriangle
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Rotation = 90,
|
||||||
|
EdgeSmoothness = new Vector2(1f),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Size = triangleSize,
|
||||||
|
Colour = second,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new EquilateralTriangle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Rotation = -90,
|
||||||
|
EdgeSmoothness = new Vector2(1f),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case GlobalAction.Select:
|
case GlobalAction.Select:
|
||||||
Click();
|
TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,31 +9,29 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Online.Rooms.GameTypes;
|
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||||
{
|
{
|
||||||
public class GameTypePicker : DisableableTabControl<GameType>
|
public class MatchTypePicker : DisableableTabControl<MatchType>
|
||||||
{
|
{
|
||||||
private const float height = 40;
|
private const float height = 40;
|
||||||
private const float selection_width = 3;
|
private const float selection_width = 3;
|
||||||
|
|
||||||
protected override TabItem<GameType> CreateTabItem(GameType value) => new GameTypePickerItem(value);
|
protected override TabItem<MatchType> CreateTabItem(MatchType value) => new GameTypePickerItem(value);
|
||||||
|
|
||||||
protected override Dropdown<GameType> CreateDropdown() => null;
|
protected override Dropdown<MatchType> CreateDropdown() => null;
|
||||||
|
|
||||||
public GameTypePicker()
|
public MatchTypePicker()
|
||||||
{
|
{
|
||||||
Height = height + selection_width * 2;
|
Height = height + selection_width * 2;
|
||||||
TabContainer.Spacing = new Vector2(10 - selection_width * 2);
|
TabContainer.Spacing = new Vector2(10 - selection_width * 2);
|
||||||
|
|
||||||
AddItem(new GameTypeTag());
|
AddItem(MatchType.HeadToHead);
|
||||||
AddItem(new GameTypeVersus());
|
AddItem(MatchType.TeamVersus);
|
||||||
AddItem(new GameTypeTagTeam());
|
// TODO: remove after osu-web is updated to set the correct default type.
|
||||||
AddItem(new GameTypeTeamVersus());
|
AddItem(MatchType.Playlists);
|
||||||
AddItem(new GameTypePlaylists());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GameTypePickerItem : DisableableTabItem
|
private class GameTypePickerItem : DisableableTabItem
|
||||||
@ -42,7 +40,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|||||||
|
|
||||||
private readonly CircularContainer hover, selection;
|
private readonly CircularContainer hover, selection;
|
||||||
|
|
||||||
public GameTypePickerItem(GameType value)
|
public GameTypePickerItem(MatchType value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Extensions.ExceptionExtensions;
|
using osu.Framework.Extensions.ExceptionExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -43,7 +44,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
|
|
||||||
public OsuTextBox NameField, MaxParticipantsField;
|
public OsuTextBox NameField, MaxParticipantsField;
|
||||||
public RoomAvailabilityPicker AvailabilityPicker;
|
public RoomAvailabilityPicker AvailabilityPicker;
|
||||||
public GameTypePicker TypePicker;
|
public MatchTypePicker TypePicker;
|
||||||
public OsuTextBox PasswordTextBox;
|
public OsuTextBox PasswordTextBox;
|
||||||
public TriangleButton ApplyButton;
|
public TriangleButton ApplyButton;
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
Spacing = new Vector2(7),
|
Spacing = new Vector2(7),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TypePicker = new GameTypePicker
|
TypePicker = new MatchTypePicker
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Enabled = { Value = false }
|
Enabled = { Value = false }
|
||||||
@ -265,7 +266,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
loadingLayer = new LoadingLayer(true)
|
loadingLayer = new LoadingLayer(true)
|
||||||
};
|
};
|
||||||
|
|
||||||
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
|
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
|
||||||
RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
|
RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
|
||||||
Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
|
Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
|
||||||
Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
|
Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
|
||||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enableButton = Client.Room?.State == MultiplayerRoomState.Open && !operationInProgress.Value;
|
bool enableButton = Room?.State == MultiplayerRoomState.Open && !operationInProgress.Value;
|
||||||
|
|
||||||
// When the local user is the host and spectating the match, the "start match" state should be enabled if any users are ready.
|
// When the local user is the host and spectating the match, the "start match" state should be enabled if any users are ready.
|
||||||
if (localUser?.State == MultiplayerUserState.Spectating)
|
if (localUser?.State == MultiplayerUserState.Spectating)
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
protected Bindable<RoomStatus> Status { get; private set; }
|
protected Bindable<RoomStatus> Status { get; private set; }
|
||||||
|
|
||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<GameType> Type { get; private set; }
|
protected Bindable<MatchType> Type { get; private set; }
|
||||||
|
|
||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
||||||
|
@ -42,12 +42,12 @@ namespace osu.Game.Screens.Play
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
|
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual Action BackAction => () => InternalButtons.Children.LastOrDefault()?.Click();
|
protected virtual Action BackAction => () => InternalButtons.Children.LastOrDefault()?.TriggerClick();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Action that is invoked when <see cref="GlobalAction.Select"/> is triggered.
|
/// Action that is invoked when <see cref="GlobalAction.Select"/> is triggered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual Action SelectAction => () => InternalButtons.Selected?.Click();
|
protected virtual Action SelectAction => () => InternalButtons.Selected?.TriggerClick();
|
||||||
|
|
||||||
public abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private SkinnableSound pauseLoop;
|
private SkinnableSound pauseLoop;
|
||||||
|
|
||||||
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
protected override Action BackAction => () => InternalButtons.Children.First().TriggerClick();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!button.Enabled.Value)
|
if (!button.Enabled.Value)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
button.Click();
|
button.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
if (action == Hotkey)
|
if (action == Hotkey)
|
||||||
{
|
{
|
||||||
Click();
|
TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Click();
|
TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Screens.Select.Options
|
|||||||
|
|
||||||
if (found != null)
|
if (found != null)
|
||||||
{
|
{
|
||||||
found.Click();
|
found.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,6 +192,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task SendMatchRequest(MatchUserRequest request) => Task.CompletedTask;
|
||||||
|
|
||||||
public override Task StartMatch()
|
public override Task StartMatch()
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
Debug.Assert(Room != null);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="10.3.0" />
|
<PackageReference Include="Realm" Version="10.3.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.804.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.8.3" />
|
<PackageReference Include="Sentry" Version="3.8.3" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.804.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.804.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user