Skip to content

Commit a766a60

Browse files
committed
为ban图添加图标
1 parent 2cb04a3 commit a766a60

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

osu.Game.Tournament/Components/TournamentBeatmapPanel.cs

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public partial class TournamentBeatmapPanel : CompositeDrawable
3232
private readonly Bindable<TournamentMatch?> currentMatch = new Bindable<TournamentMatch?>();
3333

3434
private Box flash = null!;
35-
private PadLock padLock = null!;
35+
private MapStatusIcon padLock = null!;
36+
private MapStatusIcon banIcon = null!;
3637
private readonly bool isMappool;
3738

3839
public TournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "", bool isMappool = false)
@@ -113,7 +114,13 @@ private void load(LadderInfo ladder)
113114
}
114115
},
115116
},
116-
padLock = new PadLock
117+
padLock = new MapStatusIcon(FontAwesome.Solid.ShieldAlt)
118+
{
119+
Origin = Anchor.Centre,
120+
Anchor = Anchor.Centre,
121+
Alpha = 0f,
122+
},
123+
banIcon = new MapStatusIcon(FontAwesome.Solid.Ban)
117124
{
118125
Origin = Anchor.Centre,
119126
Anchor = Anchor.Centre,
@@ -203,6 +210,13 @@ private void updateState()
203210
case ChoiceType.Ban:
204211
Colour = Color4.Gray;
205212
Alpha = 0.5f;
213+
214+
if (isMappool)
215+
{
216+
banIcon.Team = lastFound.Team;
217+
banIcon.Show();
218+
}
219+
206220
break;
207221

208222
case ChoiceType.Protected:
@@ -216,6 +230,11 @@ private void updateState()
216230
Colour = Color4.White;
217231
BorderThickness = 0;
218232
Alpha = 1;
233+
234+
if (isMappool)
235+
{
236+
banIcon.Hide();
237+
}
219238
}
220239

221240
choice = lastFound;
@@ -231,18 +250,25 @@ protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> cr
231250
=> new DelayedLoadWrapper(createContentFunc(), timeBeforeLoad);
232251
}
233252

234-
private partial class PadLock : Container
253+
private partial class MapStatusIcon : Container
235254
{
255+
private readonly IconUsage icon;
256+
236257
[Resolved]
237258
private OsuColour osuColour { get; set; } = null!;
238259

239260
public TeamColour Team
240261
{
241-
set => lockIcon.Colour = value == TeamColour.Red ? osuColour.TeamColourRed : osuColour.TeamColourBlue;
262+
set => spriteIcon.Colour = value == TeamColour.Red ? osuColour.TeamColourRed : osuColour.TeamColourBlue;
242263
}
243264

244265
private Sprite background = null!;
245-
private SpriteIcon lockIcon = null!;
266+
private SpriteIcon spriteIcon = null!;
267+
268+
public MapStatusIcon(IconUsage icon)
269+
{
270+
this.icon = icon;
271+
}
246272

247273
[BackgroundDependencyLoader]
248274
private void load(TextureStore textures)
@@ -259,12 +285,12 @@ private void load(TextureStore textures)
259285
Anchor = Anchor.Centre,
260286
Origin = Anchor.Centre,
261287
},
262-
lockIcon = new SpriteIcon
288+
spriteIcon = new SpriteIcon
263289
{
264290
Origin = Anchor.Centre,
265291
Anchor = Anchor.Centre,
266292
Size = new Vector2(22),
267-
Icon = FontAwesome.Solid.ShieldAlt,
293+
Icon = icon,
268294
Shadow = true,
269295
}
270296
};

0 commit comments

Comments
 (0)