1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Merge branch 'master' into fix-ef-issues

This commit is contained in:
Dan Balasescu 2017-11-23 21:18:20 +09:00 committed by GitHub
commit dd78479a1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
66 changed files with 326 additions and 210 deletions

@ -1 +1 @@
Subproject commit c6fd2914926f2a6df23eda536c0310f072581b1b
Subproject commit d87dab204b3df50f62e6070b1970c135ea647d78

View File

@ -26,8 +26,6 @@ namespace osu.Game.Rulesets.Mania.Tests
private const double start_time = 500;
private const double duration = 500;
public override string Description => @"Mania playfield";
protected override double TimePerAction => 200;
private RulesetInfo maniaRuleset;

View File

@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
private const double default_duration = 1000;
private const float scroll_time = 1000;
public override string Description => "Taiko playfield";
protected override double TimePerAction => default_duration * 2;
private readonly Random rng = new Random(1337);

View File

@ -5,6 +5,5 @@ namespace osu.Game.Tests.Visual
{
public class TestCaseAllPlayers : TestCasePlayer
{
public override string Description => @"Showing everything to play the game.";
}
}

View File

@ -19,8 +19,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseBeatSyncedContainer : OsuTestCase
{
public override string Description => @"Tests beat synced containers.";
private readonly MusicController mc;
public TestCaseBeatSyncedContainer()

View File

@ -9,10 +9,9 @@ using OpenTK;
namespace osu.Game.Tests.Visual
{
[TestFixture]
[System.ComponentModel.Description("PlaySongSelect leaderboard/details area")]
internal class TestCaseBeatmapDetailArea : OsuTestCase
{
public override string Description => @"Beatmap details in song select";
public TestCaseBeatmapDetailArea()
{
Add(new BeatmapDetailArea
@ -23,4 +22,4 @@ namespace osu.Game.Tests.Visual
});
}
}
}
}

View File

@ -1,6 +1,7 @@
// 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.ComponentModel;
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
@ -8,10 +9,9 @@ using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual
{
[Description("PlaySongSelect beatmap details")]
internal class TestCaseBeatmapDetails : OsuTestCase
{
public override string Description => "BeatmapDetails tab of BeatmapDetailArea";
public TestCaseBeatmapDetails()
{
BeatmapDetails details;

View File

@ -1,6 +1,7 @@
// 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.ComponentModel;
using osu.Game.Graphics;
using osu.Game.Screens.Select.Options;
using OpenTK.Graphics;
@ -8,10 +9,9 @@ using OpenTK.Input;
namespace osu.Game.Tests.Visual
{
[Description("bottom beatmap details")]
internal class TestCaseBeatmapOptionsOverlay : OsuTestCase
{
public override string Description => @"Beatmap options in song select";
public TestCaseBeatmapOptionsOverlay()
{
var overlay = new BeatmapOptionsOverlay();

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
@ -14,13 +13,13 @@ using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Users;
using System.Collections.Generic;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Tests.Visual
{
[System.ComponentModel.Description("in BeatmapOverlay")]
public class TestCaseBeatmapScoresContainer : OsuTestCase
{
public override string Description => "BeatmapOverlay scores container";
private readonly IEnumerable<OnlineScore> scores;
private readonly IEnumerable<OnlineScore> anotherScores;
private readonly OnlineScore topScore;

View File

@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseBeatmapSetOverlay : OsuTestCase
{
public override string Description => @"view online beatmap sets";
private readonly BeatmapSetOverlay overlay;
public TestCaseBeatmapSetOverlay()

View File

@ -8,8 +8,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseBreadcrumbs : OsuTestCase
{
public override string Description => @"breadcrumb > control";
public TestCaseBreadcrumbs()
{
BreadcrumbControl<BreadcrumbTab> c;

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseBreakOverlay : OsuTestCase
{
public override string Description => @"Tests breaks behavior";
private readonly BreakOverlay breakOverlay;
public TestCaseBreakOverlay()
@ -88,4 +86,4 @@ namespace osu.Game.Tests.Visual
};
}
}
}
}

View File

@ -1,15 +1,15 @@
// 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.ComponentModel;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual
{
[Description("Testing chat api and overlay")]
internal class TestCaseChatDisplay : OsuTestCase
{
public override string Description => @"Testing chat api and overlay";
public TestCaseChatDisplay()
{
Add(new ChatOverlay

View File

@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseContextMenu : OsuTestCase
{
public override string Description => @"Menu visible on right click";
private const int start_time = 0;
private const int duration = 1000;

View File

@ -9,8 +9,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseDialogOverlay : OsuTestCase
{
public override string Description => @"Display dialogs";
public TestCaseDialogOverlay()
{
DialogOverlay overlay;

View File

@ -11,8 +11,6 @@ namespace osu.Game.Tests.Visual
{
public class TestCaseDirect : OsuTestCase
{
public override string Description => @"osu!direct overlay";
private DirectOverlay direct;
private RulesetStore rulesets;

View File

@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseDrawableRoom : OsuTestCase
{
public override string Description => @"Select your favourite room";
private RulesetStore rulesets;
protected override void LoadComplete()

View File

@ -2,15 +2,15 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.ComponentModel;
using osu.Game.Screens.Tournament;
using osu.Game.Screens.Tournament.Teams;
namespace osu.Game.Tests.Visual
{
[Description("for tournament use")]
internal class TestCaseDrawings : OsuTestCase
{
public override string Description => "Tournament drawings";
public TestCaseDrawings()
{
Add(new Drawings

View File

@ -7,8 +7,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseGamefield : OsuTestCase
{
public override string Description => @"Showing hitobjects and what not.";
protected override void LoadComplete()
{
base.LoadComplete();

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseGraph : OsuTestCase
{
public override string Description => "graph";
public TestCaseGraph()
{
BarGraph graph;
@ -36,4 +34,4 @@ namespace osu.Game.Tests.Visual
AddStep("Right to left", () => graph.Direction = BarDirection.RightToLeft);
}
}
}
}

View File

@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual
{
public class TestCaseIconButton : OsuTestCase
{
public override string Description => "Various display modes of icon buttons";
public TestCaseIconButton()
{
Child = new FillFlowContainer

View File

@ -9,8 +9,6 @@ namespace osu.Game.Tests.Visual
{
private readonly KeyBindingOverlay overlay;
public override string Description => @"Key configuration";
public TestCaseKeyConfiguration()
{
Child = overlay = new KeyBindingOverlay();

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseKeyCounter : OsuTestCase
{
public override string Description => @"Tests key counter";
public TestCaseKeyCounter()
{
KeyCounterCollection kc = new KeyCounterCollection

View File

@ -1,6 +1,7 @@
// 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.ComponentModel;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Select.Leaderboards;
@ -9,10 +10,9 @@ using OpenTK;
namespace osu.Game.Tests.Visual
{
[Description("PlaySongSelect leaderboard")]
internal class TestCaseLeaderboard : OsuTestCase
{
public override string Description => @"From song select";
private readonly Leaderboard leaderboard;
private void newScores()

View File

@ -11,8 +11,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseMedalOverlay : OsuTestCase
{
public override string Description => @"medal get!";
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(MedalOverlay),

View File

@ -1,6 +1,7 @@
// 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.ComponentModel;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens.Menu;
@ -8,10 +9,9 @@ using OpenTK.Graphics;
namespace osu.Game.Tests.Visual
{
[Description("main menu")]
internal class TestCaseMenuButtonSystem : OsuTestCase
{
public override string Description => @"Main menu button system";
public TestCaseMenuButtonSystem()
{
Add(new Box

View File

@ -1,16 +1,16 @@
// 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.ComponentModel;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
[Description("player pause/fail screens")]
internal class TestCaseMenuOverlays : OsuTestCase
{
public override string Description => @"Tests pause and fail overlays";
public TestCaseMenuOverlays()
{
FailOverlay failOverlay;

View File

@ -1,6 +1,7 @@
// 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.ComponentModel;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Overlays.Mods;
@ -10,10 +11,9 @@ using OpenTK;
namespace osu.Game.Tests.Visual
{
[Description("mod select and icon display")]
internal class TestCaseMods : OsuTestCase
{
public override string Description => @"Mod select overlay and in-game display";
private ModSelectOverlay modSelect;
private ModDisplay modDisplay;

View File

@ -13,8 +13,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseMusicController : OsuTestCase
{
public override string Description => @"Tests music controller ui.";
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
public TestCaseMusicController()

View File

@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual
[TestFixture]
internal class TestCaseNotificationOverlay : OsuTestCase
{
public override string Description => @"I handle notifications";
private readonly NotificationOverlay manager;
public TestCaseNotificationOverlay()

View File

@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual
private FrameworkConfigManager config;
private Bindable<FrameSync> frameSyncMode;
public override string Description => @"Make it easier to see setting changes";
protected override void LoadComplete()
{
base.LoadComplete();

View File

@ -22,8 +22,6 @@ namespace osu.Game.Tests.Visual
{
private BeatmapManager manager;
public override string Description => @"with fake data";
private RulesetStore rulesets;
private DependencyContainer dependencies;

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseReplay : TestCasePlayer
{
public override string Description => @"Testing replay playback.";
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
{
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseReplaySettingsOverlay : OsuTestCase
{
public override string Description => @"Settings visible in replay/auto";
public TestCaseReplaySettingsOverlay()
{
ExampleContainer container;

View File

@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual
{
private BeatmapManager beatmaps;
public override string Description => @"Results after playing.";
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps)
{

View File

@ -13,8 +13,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseRoomInspector : OsuTestCase
{
public override string Description => @"from the multiplayer lobby";
private RulesetStore rulesets;
protected override void LoadComplete()

View File

@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseScoreCounter : OsuTestCase
{
public override string Description => @"Tests multiple counters";
public TestCaseScoreCounter()
{
int numerator = 0, denominator = 0;

View File

@ -7,8 +7,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseSettings : OsuTestCase
{
public override string Description => @"Tests the settings overlay";
private readonly SettingsOverlay settings;
public TestCaseSettings()

View File

@ -7,8 +7,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseSkipButton : OsuTestCase
{
public override string Description => @"Skip skip skippediskip";
protected override void LoadComplete()
{
base.LoadComplete();

View File

@ -8,8 +8,6 @@ namespace osu.Game.Tests.Visual
{
public class TestCaseSocial : OsuTestCase
{
public override string Description => @"social browser overlay";
public TestCaseSocial()
{
SocialOverlay s = new SocialOverlay

View File

@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseSongProgress : OsuTestCase
{
public override string Description => @"With fake data";
private readonly SongProgress progress;
private readonly SongProgressGraph graph;

View File

@ -16,8 +16,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseStoryboard : OsuTestCase
{
public override string Description => @"Tests storyboards.";
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
private readonly Container<DrawableStoryboard> storyboardContainer;

View File

@ -1,6 +1,7 @@
// 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.ComponentModel;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
@ -9,10 +10,9 @@ using OpenTK;
namespace osu.Game.Tests.Visual
{
[Description("SongSelect filter control")]
public class TestCaseTabControl : OsuTestCase
{
public override string Description => @"Filter for song select";
public TestCaseTabControl()
{
OsuSpriteText text;

View File

@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseTextAwesome : OsuTestCase
{
public override string Description => @"Tests display of icons";
public TestCaseTextAwesome()
{
FillFlowContainer flow;

View File

@ -1,14 +1,14 @@
// 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.ComponentModel;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Tests.Visual
{
[Description("mostly back button")]
internal class TestCaseTwoLayerButton : OsuTestCase
{
public override string Description => @"Mostly back button";
public TestCaseTwoLayerButton()
{
Add(new BackButton());

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseUserPanel : OsuTestCase
{
public override string Description => @"Panels for displaying a user's status";
public TestCaseUserPanel()
{
UserPanel flyte;

View File

@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseUserProfile : OsuTestCase
{
public override string Description => "Tests user's profile page.";
public TestCaseUserProfile()
{
var profile = new UserProfileOverlay();

View File

@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual
{
internal class TestCaseUserRanks : OsuTestCase
{
public override string Description => "showing your latest achievements";
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableScore), typeof(RanksSection) };
public TestCaseUserRanks()

View File

@ -18,6 +18,7 @@ using osu.Framework.Platform;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.IO;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.IO;
using osu.Game.IPC;
using osu.Game.Online.API;
@ -52,6 +53,11 @@ namespace osu.Game.Beatmaps
/// </summary>
public event Action<BeatmapInfo> BeatmapRestored;
/// <summary>
/// Fired when a beatmap download begins.
/// </summary>
public event Action<DownloadBeatmapSetRequest> BeatmapDownloadBegan;
/// <summary>
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
/// </summary>
@ -221,21 +227,29 @@ namespace osu.Game.Beatmaps
/// Downloads a beatmap.
/// </summary>
/// <param name="beatmapSetInfo">The <see cref="BeatmapSetInfo"/> to be downloaded.</param>
/// <returns>A new <see cref="DownloadBeatmapSetRequest"/>, or an existing one if a download is already in progress.</returns>
public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo)
/// <param name="noVideo">Whether the beatmap should be downloaded without video. Defaults to false.</param>
public void Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false)
{
var existing = GetExistingDownload(beatmapSetInfo);
if (existing != null) return existing;
if (existing != null || api == null) return;
if (api == null) return null;
if (!api.LocalUser.Value.IsSupporter)
{
PostNotification?.Invoke(new SimpleNotification
{
Icon = FontAwesome.fa_superpowers,
Text = "You gotta be a supporter to download for now 'yo"
});
return;
}
ProgressNotification downloadNotification = new ProgressNotification
{
Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}",
};
var request = new DownloadBeatmapSetRequest(beatmapSetInfo);
var request = new DownloadBeatmapSetRequest(beatmapSetInfo, noVideo);
request.DownloadProgressed += progress =>
{
@ -280,8 +294,7 @@ namespace osu.Game.Beatmaps
// don't run in the main api queue as this is a long-running task.
Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning);
return request;
BeatmapDownloadBegan?.Invoke(request);
}
/// <summary>

View File

@ -64,11 +64,7 @@ namespace osu.Game.Beatmaps.Drawables
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
}
)
{
TimeBeforeLoad = 300,
},
}, 300),
new FillFlowContainer
{
Direction = FillDirection.Vertical,

View File

@ -12,13 +12,16 @@ namespace osu.Game.Online.API.Requests
public Action<float> DownloadProgressed;
public DownloadBeatmapSetRequest(BeatmapSetInfo set)
private readonly bool noVideo;
public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo)
{
this.noVideo = noVideo;
BeatmapSet = set;
Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total);
}
protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download";
protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
}
}

View File

@ -29,8 +29,11 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly Container noVideoButtons;
private readonly FillFlowContainer videoButtons;
private readonly AuthorInfo author;
private readonly Container downloadButtonsContainer;
public Details Details;
private BeatmapManager beatmaps;
private DelayedLoadWrapper cover;
public readonly BeatmapPicker Picker;
@ -48,24 +51,22 @@ namespace osu.Game.Overlays.BeatmapSet
title.Text = BeatmapSet.Metadata.Title;
artist.Text = BeatmapSet.Metadata.Artist;
downloadButtonsContainer.FadeIn();
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration);
cover?.FadeOut(400, Easing.Out);
coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
OnLoadComplete = d =>
coverContainer.Add(cover = new DelayedLoadWrapper(
new BeatmapSetCover(BeatmapSet)
{
d.FadeInFromZero(400, Easing.Out);
},
})
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
}, 300)
{
RelativeSizeAxes = Axes.Both,
TimeBeforeLoad = 300
});
}
}
@ -164,7 +165,7 @@ namespace osu.Game.Overlays.BeatmapSet
Children = new Drawable[]
{
new FavouriteButton(),
new Container
downloadButtonsContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = buttons_height + buttons_spacing },
@ -174,7 +175,10 @@ namespace osu.Game.Overlays.BeatmapSet
{
RelativeSizeAxes = Axes.Both,
Alpha = 0f,
Child = new DownloadButton("Download", @""),
Child = new DownloadButton("Download", @"")
{
Action = () => download(false),
},
},
videoButtons = new FillFlowContainer
{
@ -183,8 +187,14 @@ namespace osu.Game.Overlays.BeatmapSet
Alpha = 0f,
Children = new[]
{
new DownloadButton("Download", "with Video"),
new DownloadButton("Download", "without Video"),
new DownloadButton("Download", "with Video")
{
Action = () => download(false),
},
new DownloadButton("Download", "without Video")
{
Action = () => download(true),
},
},
},
},
@ -208,9 +218,39 @@ namespace osu.Game.Overlays.BeatmapSet
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, BeatmapManager beatmaps)
{
tabsBg.Colour = colours.Gray3;
this.beatmaps = beatmaps;
beatmaps.BeatmapSetAdded += handleBeatmapAdd;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (beatmaps != null) beatmaps.BeatmapSetAdded -= handleBeatmapAdd;
}
private void handleBeatmapAdd(BeatmapSetInfo beatmap)
{
if (beatmap.OnlineBeatmapSetID == BeatmapSet.OnlineBeatmapSetID)
downloadButtonsContainer.FadeOut(transition_duration);
}
private void download(bool noVideo)
{
if (beatmaps.GetExistingDownload(BeatmapSet) != null)
{
downloadButtonsContainer.MoveToX(-5, 50, Easing.OutSine).Then()
.MoveToX(5, 100, Easing.InOutSine).Then()
.MoveToX(-5, 100, Easing.InOutSine).Then()
.MoveToX(0, 50, Easing.InSine).Then();
return;
}
beatmaps.Download(BeatmapSet, noVideo);
}
}
}

View File

@ -16,9 +16,7 @@ using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
using osu.Framework.Input;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Framework.Logging;
using osu.Game.Overlays.Notifications;
using osu.Game.Online.API.Requests;
using osu.Framework.Configuration;
using osu.Framework.Audio.Track;
@ -35,10 +33,8 @@ namespace osu.Game.Overlays.Direct
private Container content;
private APIAccess api;
private ProgressBar progressBar;
private BeatmapManager beatmaps;
private NotificationOverlay notifications;
private BeatmapSetOverlay beatmapSetOverlay;
public Track Preview => PlayButton.Preview;
@ -71,11 +67,9 @@ namespace osu.Game.Overlays.Direct
[BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, BeatmapManager beatmaps, OsuColour colours, NotificationOverlay notifications, BeatmapSetOverlay beatmapSetOverlay)
private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay beatmapSetOverlay)
{
this.api = api;
this.beatmaps = beatmaps;
this.notifications = notifications;
this.beatmapSetOverlay = beatmapSetOverlay;
AddInternal(content = new Container
@ -109,6 +103,14 @@ namespace osu.Game.Overlays.Direct
if (downloadRequest != null)
attachDownload(downloadRequest);
beatmaps.BeatmapDownloadBegan += attachDownload;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
beatmaps.BeatmapDownloadBegan -= attachDownload;
}
protected override void Update()
@ -151,16 +153,6 @@ namespace osu.Game.Overlays.Direct
protected void StartDownload()
{
if (!api.LocalUser.Value.IsSupporter)
{
notifications.Post(new SimpleNotification
{
Icon = FontAwesome.fa_superpowers,
Text = "You gotta be a supporter to download for now 'yo"
});
return;
}
if (beatmaps.GetExistingDownload(SetInfo) != null)
{
// we already have an active download running.
@ -172,13 +164,14 @@ namespace osu.Game.Overlays.Direct
return;
}
var request = beatmaps.Download(SetInfo);
attachDownload(request);
beatmaps.Download(SetInfo);
}
private void attachDownload(DownloadBeatmapSetRequest request)
{
if (request.BeatmapSet.OnlineBeatmapSetID != SetInfo.OnlineBeatmapSetID)
return;
progressBar.FadeIn(400, Easing.OutQuint);
progressBar.ResizeHeightTo(4, 400, Easing.OutQuint);
@ -219,21 +212,21 @@ namespace osu.Game.Overlays.Direct
return icons;
}
protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetCover(SetInfo)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
OnLoadComplete = d =>
protected Drawable CreateBackground() => new DelayedLoadWrapper(
new BeatmapSetCover(SetInfo)
{
d.FadeInFromZero(400, Easing.Out);
BlackBackground.Delay(400).FadeOut();
},
})
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
OnLoadComplete = d =>
{
d.FadeInFromZero(400, Easing.Out);
BlackBackground.Delay(400).FadeOut();
},
}, 300)
{
RelativeSizeAxes = Axes.Both,
TimeBeforeLoad = 300
};
public class Statistic : FillFlowContainer

View File

@ -146,18 +146,17 @@ namespace osu.Game.Overlays.Direct
loading = true;
Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3")
{
OnLoadComplete = d =>
LoadComponentAsync(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3"),
d =>
{
// we may have been replaced by another loader
// We may have been replaced by another loader
if (trackLoader != d) return;
Preview = (d as TrackLoader)?.Preview;
Preview = d?.Preview;
Playing.TriggerChange();
loading = false;
},
}));
Add(trackLoader);
});
}
private class TrackLoader : Drawable

View File

@ -316,19 +316,16 @@ namespace osu.Game.Overlays.Profile
private void loadUser()
{
coverContainer.Add(new AsyncLoadWrapper(new UserCoverBackground(user)
LoadComponentAsync(new UserCoverBackground(user)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200)
})
{
Masking = true,
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue
});
OnLoadComplete = d => d.FadeInFromZero(200),
Depth = float.MaxValue,
},
coverContainer.Add);
if (user.IsSupporter) supporterTag.Show();

View File

@ -0,0 +1,134 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Sections.Kudosu
{
public class KudosuInfo : Container
{
private readonly Bindable<User> user = new Bindable<User>();
public KudosuInfo(Bindable<User> user)
{
this.user.BindTo(user);
CountSection total;
CountSection avaliable;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 3;
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Offset = new Vector2(0f, 1f),
Radius = 3f,
Colour = Color4.Black.Opacity(0.2f),
};
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f)
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
total = new CountSection(
"Total Kudosu Earned",
"Based on how much of a contribution the user has made to beatmap moderation. See this link for more information."
),
avaliable = new CountSection(
"Kudosu Avaliable",
"Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet."
),
}
}
};
this.user.ValueChanged += newUser =>
{
total.Count = newUser?.Kudosu.Total ?? 0;
avaliable.Count = newUser?.Kudosu.Available ?? 0;
};
}
protected override bool OnClick(InputState state) => true;
private class CountSection : Container
{
private readonly OsuSpriteText valueText;
public int Count
{
set { valueText.Text = value.ToString(); }
}
public CountSection(string header, string description)
{
RelativeSizeAxes = Axes.X;
Width = 0.5f;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Horizontal = 10, Top = 10, Bottom = 20 };
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5),
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = header + ":",
TextSize = 20,
Font = @"Exo2.0-RegularItalic",
},
valueText = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = "0",
TextSize = 40,
UseFullGlyphHeight = false,
Font = @"Exo2.0-RegularItalic"
}
}
},
new TextFlowContainer(t => { t.TextSize = 19; })
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = description
}
}
};
}
}
}
}

View File

@ -1,6 +1,8 @@
// 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.Game.Overlays.Profile.Sections.Kudosu;
namespace osu.Game.Overlays.Profile.Sections
{
public class KudosuSection : ProfileSection
@ -8,5 +10,13 @@ namespace osu.Game.Overlays.Profile.Sections
public override string Title => "Kudosu!";
public override string Identifier => "kudosu";
public KudosuSection()
{
Children = new[]
{
new KudosuInfo(User),
};
}
}
}

View File

@ -97,7 +97,7 @@ namespace osu.Game.Overlays
//new MedalsSection(),
new HistoricalSection(),
new BeatmapsSection(),
//new KudosuSection()
new KudosuSection()
};
tabs = new ProfileTabControl
{

View File

@ -228,16 +228,16 @@ namespace osu.Game.Screens.Multiplayer
if (value != null)
{
coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
{
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
}) { RelativeSizeAxes = Axes.Both },
};
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
},
coverContainer.Add);
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - ";

View File

@ -329,17 +329,16 @@ namespace osu.Game.Screens.Multiplayer
if (value != null)
{
coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
{
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
}) { RelativeSizeAxes = Axes.Both },
};
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
},
coverContainer.Add);
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - ";

View File

@ -248,7 +248,10 @@ namespace osu.Game.Screens.Play
storyboard = beatmap.Storyboard.CreateDrawable(Beatmap.Value);
storyboard.Masking = true;
storyboardContainer.Add(asyncLoad ? new AsyncLoadWrapper(storyboard) { RelativeSizeAxes = Axes.Both } : (Drawable)storyboard);
if (asyncLoad)
LoadComponentAsync(storyboard, storyboardContainer.Add);
else
storyboardContainer.Add(storyboard);
}
public void Restart()

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select.Leaderboards
private Box background;
private Container content;
private Container avatar;
private Drawable avatar;
private DrawableRank scoreRank;
private OsuSpriteText nameLabel;
private GlowingSpriteText scoreLabel;
@ -97,7 +97,7 @@ namespace osu.Game.Screens.Select.Leaderboards
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(edge_margin),
Children = new Drawable[]
Children = new[]
{
avatar = new DelayedLoadWrapper(
new Avatar(Score.User)
@ -114,7 +114,6 @@ namespace osu.Game.Screens.Select.Leaderboards
},
})
{
TimeBeforeLoad = 500,
RelativeSizeAxes = Axes.None,
Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2),
},
@ -211,7 +210,7 @@ namespace osu.Game.Screens.Select.Leaderboards
public override void Show()
{
foreach (var d in new Drawable[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer })
foreach (var d in new[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer })
d.FadeOut();
Alpha = 0;

View File

@ -23,8 +23,6 @@ namespace osu.Game.Tests.Visual
protected Player Player;
public override string Description => @"Showing everything to play the game.";
/// <summary>
/// Create a TestCase which runs through the Player screen.
/// </summary>

View File

@ -11,7 +11,7 @@ namespace osu.Game.Users
/// </summary>
public class UpdateableAvatar : Container
{
private Container displayedAvatar;
private Drawable displayedAvatar;
private User user;
@ -40,11 +40,13 @@ namespace osu.Game.Users
{
displayedAvatar?.FadeOut(300);
displayedAvatar?.Expire();
Add(displayedAvatar = new DelayedLoadWrapper(new Avatar(user)
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(200),
}));
Add(displayedAvatar = new DelayedLoadWrapper(
new Avatar(user)
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(200),
})
);
}
}
}

View File

@ -58,14 +58,14 @@ namespace osu.Game.Users
Children = new Drawable[]
{
new AsyncLoadWrapper(new UserCoverBackground(user)
new DelayedLoadWrapper(new UserCoverBackground(user)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200),
}) { RelativeSizeAxes = Axes.Both },
}, 0) { RelativeSizeAxes = Axes.Both },
new Box
{
RelativeSizeAxes = Axes.Both,

View File

@ -292,6 +292,7 @@
<Compile Include="Overlays\BeatmapSet\Scores\ScoresContainer.cs" />
<Compile Include="Online\API\Requests\GetUserBeatmapsRequest.cs" />
<Compile Include="Overlays\Profile\Sections\Beatmaps\PaginatedBeatmapContainer.cs" />
<Compile Include="Overlays\Profile\Sections\Kudosu\KudosuInfo.cs" />
<Compile Include="Overlays\Profile\Sections\PaginatedContainer.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\DrawablePerformanceScore.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\PaginatedScoreContainer.cs" />