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:
+13
@@ -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,
|
||||
|
||||
+9
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user