1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 00:30:19 +08:00

Roll dice on click

This commit is contained in:
marvin
2025-11-17 07:30:15 +01:00
Unverified
parent e349a597ba
commit 32900f563c
2 changed files with 22 additions and 0 deletions
@@ -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,
@@ -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);
}
}
}