From 32900f563c0b2b0ff5c8efc394e6f1c116a3a862 Mon Sep 17 00:00:00 2001 From: marvin Date: Mon, 17 Nov 2025 07:30:15 +0100 Subject: [PATCH] Roll dice on click --- .../MatchmakingSelectPanel.CardContentRandom.cs | 13 +++++++++++++ .../BeatmapSelect/MatchmakingSelectPanelRandom.cs | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanel.CardContentRandom.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanel.CardContentRandom.cs index 156d213806..ad7293b811 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanel.CardContentRandom.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanel.CardContentRandom.cs @@ -65,6 +65,19 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect Dice.Spin(10_000, RotationDirection.Clockwise); } + public void RollDice() + { + var icon = randomDiceIcon(); + + while (icon.Equals(Dice.Icon)) + icon = randomDiceIcon(); + + Dice.ScaleTo(0.65f, 60, Easing.Out) + .Then() + .Schedule(() => Dice.Icon = icon) + .ScaleTo(1f, 400, Easing.OutElasticHalf); + } + private static IconUsage[] diceIcons => new[] { FontAwesome.Solid.DiceOne, diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanelRandom.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanelRandom.cs index 0c818df06b..4c50f4184c 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanelRandom.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanelRandom.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Mods; @@ -56,5 +57,13 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect users.Remove(user); content.SelectionOverlay.RemoveUser(user.Id); } + + protected override bool OnClick(ClickEvent e) + { + if (AllowSelection && content is CardContentRandom randomContent) + randomContent.RollDice(); + + return base.OnClick(e); + } } }