mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 06:02:56 +08:00
Move Placeholder classes to own files
This commit is contained in:
parent
26bb3715fe
commit
bdda1570d1
@ -19,11 +19,8 @@ using osu.Game.Online.API;
|
|||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Framework.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
{
|
{
|
||||||
@ -157,9 +154,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
}
|
}
|
||||||
|
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
|
|
||||||
private BeatmapInfo beatmap;
|
private BeatmapInfo beatmap;
|
||||||
|
|
||||||
private OsuGame osuGame;
|
private OsuGame osuGame;
|
||||||
|
|
||||||
private ScheduledDelegate pendingBeatmapSwitch;
|
private ScheduledDelegate pendingBeatmapSwitch;
|
||||||
@ -316,107 +311,6 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class Placeholder : FillFlowContainer, IEquatable<Placeholder>
|
|
||||||
{
|
|
||||||
protected Placeholder()
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre;
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool Equals(Placeholder other) => GetType() == other?.GetType();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MessagePlaceholder : Placeholder
|
|
||||||
{
|
|
||||||
private readonly string message;
|
|
||||||
|
|
||||||
public MessagePlaceholder(string message)
|
|
||||||
{
|
|
||||||
Direction = FillDirection.Horizontal;
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.fa_exclamation_circle,
|
|
||||||
Size = new Vector2(26),
|
|
||||||
Margin = new MarginPadding { Right = 10 },
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = this.message = message,
|
|
||||||
TextSize = 22,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(Placeholder other) => (other as MessagePlaceholder)?.message == message;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RetrievalFailurePlaceholder : Placeholder
|
|
||||||
{
|
|
||||||
public Action OnRetry;
|
|
||||||
|
|
||||||
public RetrievalFailurePlaceholder()
|
|
||||||
{
|
|
||||||
Direction = FillDirection.Horizontal;
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new RetryButton
|
|
||||||
{
|
|
||||||
Action = () => OnRetry?.Invoke(),
|
|
||||||
Margin = new MarginPadding { Right = 10 },
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Text = @"Couldn't retrieve scores!",
|
|
||||||
TextSize = 22,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RetryButton : OsuHoverContainer
|
|
||||||
{
|
|
||||||
private readonly SpriteIcon icon;
|
|
||||||
|
|
||||||
public Action Action;
|
|
||||||
|
|
||||||
public RetryButton()
|
|
||||||
{
|
|
||||||
Height = 26;
|
|
||||||
Width = 26;
|
|
||||||
Child = new OsuClickableContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Action = () => Action?.Invoke(),
|
|
||||||
Child = icon = new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.fa_refresh,
|
|
||||||
Size = new Vector2(26),
|
|
||||||
Shadow = true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
|
||||||
{
|
|
||||||
icon.ScaleTo(0.8f, 4000, Easing.OutQuint);
|
|
||||||
return base.OnMouseDown(state, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
|
||||||
{
|
|
||||||
icon.ScaleTo(1, 1000, Easing.OutElastic);
|
|
||||||
return base.OnMouseUp(state, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LeaderboardScope
|
public enum LeaderboardScope
|
||||||
|
38
osu.Game/Screens/Select/Leaderboards/MessagePlaceholder.cs
Normal file
38
osu.Game/Screens/Select/Leaderboards/MessagePlaceholder.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
|
{
|
||||||
|
public class MessagePlaceholder : Placeholder
|
||||||
|
{
|
||||||
|
private readonly string message;
|
||||||
|
|
||||||
|
public MessagePlaceholder(string message)
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Horizontal;
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.fa_exclamation_circle,
|
||||||
|
Size = new Vector2(26),
|
||||||
|
Margin = new MarginPadding { Right = 10 },
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = this.message = message,
|
||||||
|
TextSize = 22,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(Placeholder other) => (other as MessagePlaceholder)?.message == message;
|
||||||
|
}
|
||||||
|
}
|
20
osu.Game/Screens/Select/Leaderboards/Placeholder.cs
Normal file
20
osu.Game/Screens/Select/Leaderboards/Placeholder.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
|
{
|
||||||
|
public abstract class Placeholder : FillFlowContainer, IEquatable<Placeholder>
|
||||||
|
{
|
||||||
|
protected Placeholder()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool Equals(Placeholder other) => GetType() == other?.GetType();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
|
{
|
||||||
|
public class RetrievalFailurePlaceholder : Placeholder
|
||||||
|
{
|
||||||
|
public Action OnRetry;
|
||||||
|
|
||||||
|
public RetrievalFailurePlaceholder()
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Horizontal;
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new RetryButton
|
||||||
|
{
|
||||||
|
Action = () => OnRetry?.Invoke(),
|
||||||
|
Margin = new MarginPadding { Right = 10 },
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Text = @"Couldn't retrieve scores!",
|
||||||
|
TextSize = 22,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RetryButton : OsuHoverContainer
|
||||||
|
{
|
||||||
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
|
public Action Action;
|
||||||
|
|
||||||
|
public RetryButton()
|
||||||
|
{
|
||||||
|
Height = 26;
|
||||||
|
Width = 26;
|
||||||
|
Child = new OsuClickableContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Action = () => Action?.Invoke(),
|
||||||
|
Child = icon = new SpriteIcon
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.fa_refresh,
|
||||||
|
Size = new Vector2(26),
|
||||||
|
Shadow = true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
{
|
||||||
|
icon.ScaleTo(0.8f, 4000, Easing.OutQuint);
|
||||||
|
return base.OnMouseDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||||
|
{
|
||||||
|
icon.ScaleTo(1, 1000, Easing.OutElastic);
|
||||||
|
return base.OnMouseUp(state, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -781,6 +781,9 @@
|
|||||||
<Compile Include="Screens\Select\Leaderboards\DrawableRank.cs" />
|
<Compile Include="Screens\Select\Leaderboards\DrawableRank.cs" />
|
||||||
<Compile Include="Screens\Select\Leaderboards\Leaderboard.cs" />
|
<Compile Include="Screens\Select\Leaderboards\Leaderboard.cs" />
|
||||||
<Compile Include="Screens\Select\Leaderboards\LeaderboardScore.cs" />
|
<Compile Include="Screens\Select\Leaderboards\LeaderboardScore.cs" />
|
||||||
|
<Compile Include="Screens\Select\Leaderboards\MessagePlaceholder.cs" />
|
||||||
|
<Compile Include="Screens\Select\Leaderboards\Placeholder.cs" />
|
||||||
|
<Compile Include="Screens\Select\Leaderboards\RetrievalFailurePlaceholder.cs" />
|
||||||
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsButton.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsButton.cs" />
|
||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user