mirror of
https://github.com/ppy/osu.git
synced 2026-05-18 07:09:53 +08:00
0988552567
I don't really have much to say here. Instead, I'll give a brief history rundown that lists many pages of documentation you can read, if interested. - Started off as BTMC + Happy24 (Vivi)'s ["The Vision"](https://docs.google.com/document/d/1p1IpPmd2RICp8G4OqkCSs7u8Ug8FbFv8qqP0mfSrHf0/edit?tab=t.0#heading=h.fol093d9f9xi) - Initial [designs](https://www.figma.com/design/f5qqC57t9jFlgpzhRqUNVX/The-Vision?node-id=0-1&p=f) were led by Vivi. - Designs [morphed](https://www.figma.com/design/vtFmLrXKvWNyYiRjTezFTM/Untitled--Copy-?node-id=0-1&p=f) during development into what's currently present, led by @minetoblend. - There is some more ongoing work creating a [game design document](https://docs.google.com/document/d/1iffJFCsIBfYF0D4ogItSBEj6YBmbp-rdCpItAeaJiTA/edit?tab=t.0). **tl;dr:** Create something with the mechanics of a trading card game within osu!. The name of this is "ranked play". --- To be frank, a lot of stuff is missing here. Some of it I don't want to mention, because the point of this exercise is to get the system into the hands of players, gather feedback especially around mechanics, and discuss any further direction with the team. I am expecting a blanket approval on all of the new code, with particular attention to changes in existing components that I'll point out in a self review. There is also some [ongoing work](https://github.com/smoogipoo/osu/pulls) that may arrive in this branch prior to being merged. --------- Co-authored-by: maarvin <minetoblend@gmail.com> Co-authored-by: Marvin <m.schuerz@hautzy.com> Co-authored-by: Jamie Taylor <me@nekodex.net> Co-authored-by: ArijanJ <arijanj@proton.me> Co-authored-by: Dean Herbert <pe@ppy.sh> Co-authored-by: Tim Oliver <git@tim.dev> Co-authored-by: Joseph Madamba <madamba.joehu@outlook.com> Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com> Co-authored-by: nil <25884226+voidstar0@users.noreply.github.com> Co-authored-by: Ботников Максим <mr.botnikoff@ya.ru> Co-authored-by: Denis Titovets <den232titovets@yandex.ru> Co-authored-by: Michael Middlezong <119022671+mmiddlezong@users.noreply.github.com> Co-authored-by: SupDos <6813986+SupDos@users.noreply.github.com> Co-authored-by: failaip12 <86018517+failaip12@users.noreply.github.com>
162 lines
6.7 KiB
C#
162 lines
6.7 KiB
C#
// 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 Humanizer;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
|
|
using osu.Game.Overlays;
|
|
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
|
|
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Hand;
|
|
using osuTK.Input;
|
|
|
|
namespace osu.Game.Tests.Visual.RankedPlay
|
|
{
|
|
public partial class TestScenePlayerCardHand : OsuManualInputManagerTestScene
|
|
{
|
|
[Cached]
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
|
|
|
private PlayerHandOfCards handOfCards = null!;
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
Child = handOfCards = new PlayerHandOfCards
|
|
{
|
|
Anchor = Anchor.BottomCentre,
|
|
Origin = Anchor.BottomCentre,
|
|
RelativeSizeAxes = Axes.Both,
|
|
Height = 0.5f,
|
|
};
|
|
}
|
|
|
|
[Test]
|
|
public void TestSingleSelectionMode()
|
|
{
|
|
AddStep("add cards", () =>
|
|
{
|
|
handOfCards.Clear();
|
|
for (int i = 0; i < 5; i++)
|
|
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
|
|
});
|
|
AddStep("single selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Single);
|
|
|
|
AddStep("click first card", () => handOfCards.Cards.First().TriggerClick());
|
|
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.First().Item]));
|
|
|
|
AddStep("click second card", () => handOfCards.Cards.ElementAt(1).TriggerClick());
|
|
AddAssert("second card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(1).Item]));
|
|
|
|
AddStep("click second card again", () => handOfCards.Cards.ElementAt(1).TriggerClick());
|
|
AddAssert("second card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(1).Item]));
|
|
}
|
|
|
|
[Test]
|
|
public void TestMultiSelectionMode()
|
|
{
|
|
AddStep("add cards", () =>
|
|
{
|
|
handOfCards.Clear();
|
|
for (int i = 0; i < 5; i++)
|
|
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
|
|
});
|
|
AddStep("multi selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Multiple);
|
|
|
|
AddStep("click first card", () => handOfCards.Cards.First().TriggerClick());
|
|
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.First().Item]));
|
|
|
|
AddStep("click second card", () => handOfCards.Cards.ElementAt(1).TriggerClick());
|
|
AddAssert("both cards selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item, handOfCards.Cards.ElementAt(1).Item]));
|
|
|
|
AddStep("click second card again", () => handOfCards.Cards.ElementAt(1).TriggerClick());
|
|
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item]));
|
|
}
|
|
|
|
[Test]
|
|
public void TestCardCount()
|
|
{
|
|
for (int i = 1; i <= 8; i++)
|
|
{
|
|
int numCards = i;
|
|
|
|
AddStep($"{i} {"cards".Pluralize(i == 1)}", () =>
|
|
{
|
|
handOfCards.Clear();
|
|
|
|
for (int j = 0; j < numCards; j++)
|
|
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
|
|
});
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void TestKeyboardSelectionSingleSelection()
|
|
{
|
|
bool playActionTriggered = false;
|
|
|
|
AddStep("add cards", () =>
|
|
{
|
|
playActionTriggered = false;
|
|
handOfCards.PlayCardAction = () => playActionTriggered = true;
|
|
|
|
handOfCards.Clear();
|
|
for (int i = 0; i < 5; i++)
|
|
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
|
|
});
|
|
AddStep("single selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Single);
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
int i1 = i;
|
|
Key key = Key.Number1 + i;
|
|
|
|
AddStep($"key {i + 1}", () => InputManager.Key(key));
|
|
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(i1).Item]));
|
|
}
|
|
|
|
AddStep("right arrow", () => InputManager.Key(Key.Right));
|
|
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item]));
|
|
|
|
AddStep("right arrow", () => InputManager.Key(Key.Right));
|
|
AddAssert("second card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(1).Item]));
|
|
|
|
AddStep("left arrow", () => InputManager.Key(Key.Left));
|
|
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item]));
|
|
|
|
AddStep("left arrow", () => InputManager.Key(Key.Left));
|
|
AddAssert("last card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(^1).Item]));
|
|
|
|
AddStep("space", () => InputManager.Key(Key.Space));
|
|
AddAssert("play action triggered", () => playActionTriggered);
|
|
}
|
|
|
|
[Test]
|
|
public void TestKeyboardSelectionMultiSelection()
|
|
{
|
|
AddStep("add cards", () =>
|
|
{
|
|
handOfCards.Clear();
|
|
for (int i = 0; i < 5; i++)
|
|
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
|
|
});
|
|
AddStep("multi selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Multiple);
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
int i1 = i;
|
|
Key key = Key.Number1 + i;
|
|
|
|
AddStep($"key {i + 1}", () => InputManager.Key(key));
|
|
AddAssert("card hovered", () => handOfCards.Cards.ElementAt(i1).CardHovered);
|
|
|
|
AddAssert("card not selected", () => !handOfCards.Selection.Contains(handOfCards.Cards.ElementAt(i1).Card.Item));
|
|
AddStep("space", () => InputManager.Key(Key.Space));
|
|
AddAssert("card selected", () => handOfCards.Selection.Contains(handOfCards.Cards.ElementAt(i1).Card.Item));
|
|
}
|
|
}
|
|
}
|
|
}
|