1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Merge remote-tracking branch 'origin/master' into settingsitem-getboundcopy

This commit is contained in:
smoogipoo 2017-11-06 12:39:35 +09:00
commit d24cd00a01
33 changed files with 330 additions and 263 deletions

@ -1 +1 @@
Subproject commit 5986f2126832451a5a7ec832a483e1dcec1b38b8 Subproject commit 3c074a0981844fbaa9f2ecbf879c542f07e2b94d

@ -1 +1 @@
Subproject commit a4418111f8ed2350a6fd46fe69258884f0757745 Subproject commit 1750ab8f6761ab35592fd46da71fbe0c141bfd93

View File

@ -390,7 +390,7 @@ namespace osu.Desktop.Deploy
public static void AuthenticatedBlockingPerform(this WebRequest r) public static void AuthenticatedBlockingPerform(this WebRequest r)
{ {
r.Headers.Add("Authorization", $"token {GitHubAccessToken}"); r.AddHeader("Authorization", $"token {GitHubAccessToken}");
r.Perform(); r.Perform();
} }
} }

View File

@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual
} }
}); });
AddStep("Show cookiezi", () => ranks.User = new User { Id = 124493 }); AddStep("Show cookiezi", () => ranks.User.Value = new User { Id = 124493 });
} }
} }
} }

View File

@ -11,7 +11,7 @@ using osu.Framework.Configuration;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
{ {
internal class ParallaxContainer : Container, IRequireHighFrequencyMousePosition public class ParallaxContainer : Container, IRequireHighFrequencyMousePosition
{ {
public float ParallaxAmount = 0.02f; public float ParallaxAmount = 0.02f;

View File

@ -118,6 +118,7 @@ namespace osu.Game.Online.API
//NotificationOverlay.ShowMessage("Login failed!"); //NotificationOverlay.ShowMessage("Login failed!");
log.Add(@"Login failed!"); log.Add(@"Login failed!");
Password = null; Password = null;
authentication.Clear();
continue; continue;
} }

View File

@ -36,7 +36,7 @@ namespace osu.Game.Online.API
return request; return request;
} }
private void request_Progress(WebRequest request, long current, long total) => API.Scheduler.Add(delegate { Progress?.Invoke(current, total); }); private void request_Progress(long current, long total) => API.Scheduler.Add(delegate { Progress?.Invoke(current, total); });
protected APIDownloadRequest() protected APIDownloadRequest()
{ {
@ -99,8 +99,8 @@ namespace osu.Game.Online.API
throw new TimeoutException(@"API request timeout hit"); throw new TimeoutException(@"API request timeout hit");
WebRequest = CreateWebRequest(); WebRequest = CreateWebRequest();
WebRequest.RetryCount = 0; WebRequest.AllowRetryOnTimeout = false;
WebRequest.Headers[@"Authorization"] = $@"Bearer {api.AccessToken}"; WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}");
if (checkAndProcessFailure()) if (checkAndProcessFailure())
return; return;

View File

@ -27,6 +27,9 @@ namespace osu.Game.Online.API
internal bool AuthenticateWithLogin(string username, string password) internal bool AuthenticateWithLogin(string username, string password)
{ {
if (string.IsNullOrEmpty(username)) return false;
if (string.IsNullOrEmpty(password)) return false;
using (var req = new AccessTokenRequestPassword(username, password) using (var req = new AccessTokenRequestPassword(username, password)
{ {
Url = $@"{endpoint}/oauth/token", Url = $@"{endpoint}/oauth/token",
@ -127,7 +130,8 @@ namespace osu.Game.Online.API
protected override void PrePerform() protected override void PrePerform()
{ {
Parameters[@"refresh_token"] = RefreshToken; AddParameter("refresh_token", RefreshToken);
base.PrePerform(); base.PrePerform();
} }
} }
@ -146,8 +150,9 @@ namespace osu.Game.Online.API
protected override void PrePerform() protected override void PrePerform()
{ {
Parameters[@"username"] = Username; AddParameter("username", Username);
Parameters[@"password"] = Password; AddParameter("password", Password);
base.PrePerform(); base.PrePerform();
} }
} }
@ -161,9 +166,10 @@ namespace osu.Game.Online.API
protected override void PrePerform() protected override void PrePerform()
{ {
Parameters[@"grant_type"] = GrantType; AddParameter("grant_type", GrantType);
Parameters[@"client_id"] = ClientId; AddParameter("client_id", ClientId);
Parameters[@"client_secret"] = ClientSecret; AddParameter("client_secret", ClientSecret);
base.PrePerform(); base.PrePerform();
} }
} }

View File

@ -88,6 +88,8 @@ namespace osu.Game.Overlays.BeatmapSet
}; };
} }
public void StopPreview() => preview.Playing.Value = false;
private class DetailBox : Container private class DetailBox : Container
{ {
private readonly Container content; private readonly Container content;

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly Container coverContainer; private readonly Container coverContainer;
private readonly OsuSpriteText title, artist; private readonly OsuSpriteText title, artist;
private readonly AuthorInfo author; private readonly AuthorInfo author;
private readonly Details details; public Details Details;
private DelayedLoadWrapper cover; private DelayedLoadWrapper cover;
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapSet
if (value == beatmapSet) return; if (value == beatmapSet) return;
beatmapSet = value; beatmapSet = value;
Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet; Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = BeatmapSet;
title.Text = BeatmapSet.Metadata.Title; title.Text = BeatmapSet.Metadata.Title;
artist.Text = BeatmapSet.Metadata.Artist; artist.Text = BeatmapSet.Metadata.Artist;
@ -192,7 +192,7 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
}, },
}, },
details = new Details Details = new Details
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
@ -204,7 +204,7 @@ namespace osu.Game.Overlays.BeatmapSet
Picker.Beatmap.ValueChanged += b => Picker.Beatmap.ValueChanged += b =>
{ {
details.Beatmap = b; Details.Beatmap = b;
if (b.OnlineInfo.HasVideo) if (b.OnlineInfo.HasVideo)
{ {

View File

@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly PlayButton playButton; private readonly PlayButton playButton;
private Track preview => playButton.Preview; private Track preview => playButton.Preview;
private Bindable<bool> playing => playButton.Playing; public Bindable<bool> Playing => playButton.Playing;
public BeatmapSetInfo BeatmapSet public BeatmapSetInfo BeatmapSet
{ {
@ -66,8 +66,8 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
}; };
Action = () => playing.Value = !playing.Value; Action = () => Playing.Value = !Playing.Value;
playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -80,7 +80,7 @@ namespace osu.Game.Overlays.BeatmapSet
{ {
base.Update(); base.Update();
if (playing.Value && preview != null) if (Playing.Value && preview != null)
{ {
progress.Width = (float)(preview.CurrentTime / preview.Length); progress.Width = (float)(preview.CurrentTime / preview.Length);
} }
@ -88,7 +88,7 @@ namespace osu.Game.Overlays.BeatmapSet
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
playing.Value = false; Playing.Value = false;
base.Dispose(isDisposing); base.Dispose(isDisposing);
} }

View File

@ -98,6 +98,7 @@ namespace osu.Game.Overlays
protected override void PopOut() protected override void PopOut()
{ {
base.PopOut(); base.PopOut();
header.Details.StopPreview();
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out); FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
} }

View File

@ -9,6 +9,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Configuration;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
{ {
@ -22,13 +23,7 @@ namespace osu.Game.Overlays.Profile
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
public virtual User User public readonly Bindable<User> User = new Bindable<User>();
{
get { return user; }
set { user = value; }
}
private User user;
protected ProfileSection() protected ProfileSection()
{ {

View File

@ -1,6 +1,9 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Profile.Sections.Ranks;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
public class HistoricalSection : ProfileSection public class HistoricalSection : ProfileSection
@ -8,5 +11,10 @@ namespace osu.Game.Overlays.Profile.Sections
public override string Title => "Historical"; public override string Title => "Historical";
public override string Identifier => "historical"; public override string Identifier => "historical";
public HistoricalSection()
{
Child = new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)");
}
} }
} }

View File

@ -0,0 +1,49 @@
// 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.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawablePerformanceScore : DrawableScore
{
private readonly double? weight;
public DrawablePerformanceScore(Score score, double? weight = null)
: base(score)
{
this.weight = weight;
}
[BackgroundDependencyLoader]
private new void load(OsuColour colour)
{
double pp = Score.PP ?? 0;
Stats.Add(new OsuSpriteText
{
Text = $"{pp:0}pp",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
Font = "Exo2.0-BoldItalic",
});
if (weight.HasValue)
{
Stats.Add(new OsuSpriteText
{
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
TextSize = 11,
Font = "Exo2.0-RegularItalic",
});
}
}
}
}

View File

@ -18,18 +18,16 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Overlays.Profile.Sections.Ranks namespace osu.Game.Overlays.Profile.Sections.Ranks
{ {
public class DrawableScore : Container public abstract class DrawableScore : Container
{ {
private readonly FillFlowContainer<OsuSpriteText> stats; protected readonly FillFlowContainer<OsuSpriteText> Stats;
private readonly FillFlowContainer metadata; private readonly FillFlowContainer metadata;
private readonly ModContainer modContainer; private readonly ModContainer modContainer;
private readonly Score score; protected readonly Score Score;
private readonly double? weight;
public DrawableScore(Score score, double? weight = null) protected DrawableScore(Score score)
{ {
this.score = score; Score = score;
this.weight = weight;
Children = new Drawable[] Children = new Drawable[]
{ {
@ -39,7 +37,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Width = 60, Width = 60,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
}, },
stats = new FillFlowContainer<OsuSpriteText> Stats = new FillFlowContainer<OsuSpriteText>
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -74,40 +72,18 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
}; };
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
{ {
double pp = score.PP ?? 0; Stats.Add(new OsuSpriteText
stats.Add(new OsuSpriteText
{ {
Text = $"{pp:0}pp", Text = $"accuracy: {Score.Accuracy:P2}",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
Font = "Exo2.0-BoldItalic",
});
if (weight.HasValue)
{
stats.Add(new OsuSpriteText
{
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
TextSize = 11,
Font = "Exo2.0-RegularItalic",
});
}
stats.Add(new OsuSpriteText
{
Text = $"accuracy: {score.Accuracy:P2}",
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Colour = colour.GrayA, Colour = colour.GrayA,
TextSize = 11, TextSize = 11,
Font = "Exo2.0-RegularItalic", Font = "Exo2.0-RegularItalic",
Depth = -1,
}); });
metadata.Add(new OsuHoverContainer metadata.Add(new OsuHoverContainer
@ -115,7 +91,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Action = () => Action = () =>
{ {
if (score.Beatmap.OnlineBeatmapSetID.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value); if (Score.Beatmap.OnlineBeatmapSetID.HasValue) beatmapSetOverlay?.ShowBeatmapSet(Score.Beatmap.OnlineBeatmapSetID.Value);
}, },
Child = new FillFlowContainer Child = new FillFlowContainer
{ {
@ -125,15 +101,15 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
new OsuSpriteText new OsuSpriteText
{ {
Current = locale.GetUnicodePreference( Current = locale.GetUnicodePreference(
$"{score.Beatmap.Metadata.TitleUnicode ?? score.Beatmap.Metadata.Title} [{score.Beatmap.Version}] ", $"{Score.Beatmap.Metadata.TitleUnicode ?? Score.Beatmap.Metadata.Title} [{Score.Beatmap.Version}] ",
$"{score.Beatmap.Metadata.Title ?? score.Beatmap.Metadata.TitleUnicode} [{score.Beatmap.Version}] " $"{Score.Beatmap.Metadata.Title ?? Score.Beatmap.Metadata.TitleUnicode} [{Score.Beatmap.Version}] "
), ),
TextSize = 15, TextSize = 15,
Font = "Exo2.0-SemiBoldItalic", Font = "Exo2.0-SemiBoldItalic",
}, },
new OsuSpriteText new OsuSpriteText
{ {
Current = locale.GetUnicodePreference(score.Beatmap.Metadata.ArtistUnicode, score.Beatmap.Metadata.Artist), Current = locale.GetUnicodePreference(Score.Beatmap.Metadata.ArtistUnicode, Score.Beatmap.Metadata.Artist),
TextSize = 12, TextSize = 12,
Padding = new MarginPadding { Top = 3 }, Padding = new MarginPadding { Top = 3 },
Font = "Exo2.0-RegularItalic", Font = "Exo2.0-RegularItalic",
@ -142,7 +118,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
}, },
}); });
foreach (Mod mod in score.Mods) foreach (Mod mod in Score.Mods)
modContainer.Add(new ModIcon(mod) modContainer.Add(new ModIcon(mod)
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,

View File

@ -0,0 +1,31 @@
// 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.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableTotalScore : DrawableScore
{
public DrawableTotalScore(Score score)
: base(score)
{
}
[BackgroundDependencyLoader]
private new void load()
{
Stats.Add(new OsuSpriteText
{
Text = Score.TotalScore.ToString("#,###"),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
Font = "Exo2.0-BoldItalic",
});
}
}
}

View File

@ -0,0 +1,153 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Rulesets;
using osu.Game.Users;
using System;
using System.Linq;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class PaginatedScoreContainer : FillFlowContainer
{
private readonly FillFlowContainer<DrawableScore> scoreContainer;
private readonly OsuSpriteText missing;
private readonly OsuHoverContainer showMoreButton;
private readonly LoadingAnimation showMoreLoading;
private readonly bool includeWeight;
private readonly ScoreType type;
private int visiblePages;
private readonly Bindable<User> user = new Bindable<User>();
private RulesetStore rulesets;
private APIAccess api;
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, bool includeWeight = false)
{
this.type = type;
this.includeWeight = includeWeight;
this.user.BindTo(user);
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Children = new Drawable[]
{
new OsuSpriteText
{
TextSize = 15,
Text = header,
Font = "Exo2.0-RegularItalic",
Margin = new MarginPadding { Top = 10, Bottom = 10 },
},
scoreContainer = new FillFlowContainer<DrawableScore>
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
},
showMoreButton = new OsuHoverContainer
{
Alpha = 0,
Action = showMore,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Child = new OsuSpriteText
{
TextSize = 14,
Text = "show more",
}
},
showMoreLoading = new LoadingAnimation
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(14),
},
missing = new OsuSpriteText
{
TextSize = 14,
Text = type == ScoreType.Recent ? "No performance records. :(" : "No awesome performance records yet. :(",
},
};
}
[BackgroundDependencyLoader]
private void load(APIAccess api, RulesetStore rulesets)
{
this.api = api;
this.rulesets = rulesets;
user.ValueChanged += user_ValueChanged;
user.TriggerChange();
}
private void user_ValueChanged(User newUser)
{
visiblePages = 0;
scoreContainer.Clear();
showMoreButton.Hide();
missing.Show();
if (newUser != null)
showMore();
}
private void showMore()
{
var req = new GetUserScoresRequest(user.Value.Id, type, visiblePages++ * 5);
showMoreLoading.Show();
showMoreButton.Hide();
req.Success += scores =>
{
foreach (var s in scores)
s.ApplyRuleset(rulesets.GetRuleset(s.OnlineRulesetID));
showMoreButton.FadeTo(scores.Count == 5 ? 1 : 0);
showMoreLoading.Hide();
if (!scores.Any()) return;
missing.Hide();
foreach (OnlineScore score in scores)
{
DrawableScore drawableScore;
switch (type)
{
default:
drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null);
break;
case ScoreType.Recent:
drawableScore = new DrawableTotalScore(score);
break;
}
drawableScore.RelativeSizeAxes = Axes.X;
drawableScore.Height = 60;
scoreContainer.Add(drawableScore);
}
};
api.Queue(req);
}
}
}

View File

@ -1,20 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // 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.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Overlays.Profile.Sections.Ranks;
using System;
using System.Linq;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Rulesets;
using osu.Game.Users;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
@ -24,147 +12,13 @@ namespace osu.Game.Overlays.Profile.Sections
public override string Identifier => "top_ranks"; public override string Identifier => "top_ranks";
private readonly ScoreContainer best, first;
public RanksSection() public RanksSection()
{ {
Children = new Drawable[] Children = new[]
{ {
best = new ScoreContainer(ScoreType.Best, "Best Performance", true), new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", true),
first = new ScoreContainer(ScoreType.Firsts, "First Place Ranks"), new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks"),
}; };
} }
public override User User
{
get
{
return base.User;
}
set
{
base.User = value;
best.User = value;
first.User = value;
}
}
private class ScoreContainer : FillFlowContainer
{
private readonly FillFlowContainer<DrawableScore> scoreContainer;
private readonly OsuSpriteText missing;
private readonly OsuHoverContainer showMoreButton;
private readonly LoadingAnimation showMoreLoading;
private readonly ScoreType type;
private int visiblePages;
private User user;
private readonly bool includeWeigth;
private RulesetStore rulesets;
private APIAccess api;
public User User
{
set
{
user = value;
visiblePages = 0;
scoreContainer.Clear();
showMoreButton.Hide();
missing.Show();
showMore();
}
}
public ScoreContainer(ScoreType type, string header, bool includeWeigth = false)
{
this.type = type;
this.includeWeigth = includeWeigth;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Children = new Drawable[]
{
new OsuSpriteText
{
TextSize = 15,
Text = header,
Font = "Exo2.0-RegularItalic",
Margin = new MarginPadding { Top = 10, Bottom = 10 },
},
scoreContainer = new FillFlowContainer<DrawableScore>
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
},
showMoreButton = new OsuHoverContainer
{
Alpha = 0,
Action = showMore,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Child = new OsuSpriteText
{
TextSize = 14,
Text = "show more",
}
},
showMoreLoading = new LoadingAnimation
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(14),
},
missing = new OsuSpriteText
{
TextSize = 14,
Text = "No awesome performance records yet. :(",
},
};
}
[BackgroundDependencyLoader]
private void load(APIAccess api, RulesetStore rulesets)
{
this.api = api;
this.rulesets = rulesets;
}
private void showMore()
{
var req = new GetUserScoresRequest(user.Id, type, visiblePages++ * 5);
showMoreLoading.Show();
showMoreButton.Hide();
req.Success += scores =>
{
foreach (var s in scores)
s.ApplyRuleset(rulesets.GetRuleset(s.OnlineRulesetID));
showMoreButton.FadeTo(scores.Count == 5 ? 1 : 0);
showMoreLoading.Hide();
if (scores.Any())
{
missing.Hide();
foreach (OnlineScore score in scores)
scoreContainer.Add(new DrawableScore(score, includeWeigth ? Math.Pow(0.95, scoreContainer.Count) : (double?)null)
{
RelativeSizeAxes = Axes.X,
Height = 60,
});
}
};
Schedule(() => { api.Queue(req); });
}
}
} }
} }

View File

@ -95,7 +95,7 @@ namespace osu.Game.Overlays
//new RecentSection(), //new RecentSection(),
new RanksSection(), new RanksSection(),
//new MedalsSection(), //new MedalsSection(),
//new HistoricalSection(), new HistoricalSection(),
//new BeatmapsSection(), //new BeatmapsSection(),
//new KudosuSection() //new KudosuSection()
}; };
@ -175,7 +175,7 @@ namespace osu.Game.Overlays
var sec = sections.FirstOrDefault(s => s.Identifier == id); var sec = sections.FirstOrDefault(s => s.Identifier == id);
if (sec != null) if (sec != null)
{ {
sec.User = user; sec.User.Value = user;
sectionsContainer.Add(sec); sectionsContainer.Add(sec);
tabs.AddItem(sec); tabs.AddItem(sec);

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit
{ {
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
internal override bool ShowOverlays => false; public override bool ShowOverlays => false;
private readonly Box bottomBackground; private readonly Box bottomBackground;
private readonly Container screenContainer; private readonly Container screenContainer;

View File

@ -8,7 +8,7 @@ namespace osu.Game.Screens
{ {
internal class Loader : OsuScreen internal class Loader : OsuScreen
{ {
internal override bool ShowOverlays => false; public override bool ShowOverlays => false;
public Loader() public Loader()
{ {

View File

@ -12,15 +12,15 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Menu namespace osu.Game.Screens.Menu
{ {
internal class Disclaimer : OsuScreen public class Disclaimer : OsuScreen
{ {
private Intro intro; private Intro intro;
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
private Color4 iconColour; private Color4 iconColour;
internal override bool ShowOverlays => false; public override bool ShowOverlays => false;
internal override bool HasLocalCursorDisplayed => true; public override bool HasLocalCursorDisplayed => true;
public Disclaimer() public Disclaimer()
{ {

View File

@ -33,9 +33,9 @@ namespace osu.Game.Screens.Menu
private SampleChannel welcome; private SampleChannel welcome;
private SampleChannel seeya; private SampleChannel seeya;
internal override bool HasLocalCursorDisplayed => true; public override bool HasLocalCursorDisplayed => true;
internal override bool ShowOverlays => false; public override bool ShowOverlays => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty(); protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Menu
{ {
private readonly ButtonSystem buttons; private readonly ButtonSystem buttons;
internal override bool ShowOverlays => buttons.State != MenuState.Initial; public override bool ShowOverlays => buttons.State != MenuState.Initial;
private readonly BackgroundScreenDefault background; private readonly BackgroundScreenDefault background;
private Screen songSelect; private Screen songSelect;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens
{ {
public abstract class OsuScreen : Screen public abstract class OsuScreen : Screen
{ {
internal BackgroundScreen Background { get; private set; } public BackgroundScreen Background { get; private set; }
/// <summary> /// <summary>
/// Override to create a BackgroundMode for the current screen. /// Override to create a BackgroundMode for the current screen.
@ -24,17 +24,17 @@ namespace osu.Game.Screens
/// </summary> /// </summary>
protected virtual BackgroundScreen CreateBackground() => null; protected virtual BackgroundScreen CreateBackground() => null;
internal virtual bool ShowOverlays => true; public virtual bool ShowOverlays => true;
protected new OsuGameBase Game => base.Game as OsuGameBase; protected new OsuGameBase Game => base.Game as OsuGameBase;
internal virtual bool HasLocalCursorDisplayed => false; public virtual bool HasLocalCursorDisplayed => false;
/// <summary> /// <summary>
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game. /// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay. /// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
/// </summary> /// </summary>
internal virtual bool AllowBeatmapRulesetChange => true; public virtual bool AllowBeatmapRulesetChange => true;
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();

View File

@ -34,13 +34,13 @@ namespace osu.Game.Screens.Play
{ {
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
internal override bool ShowOverlays => false; public override bool ShowOverlays => false;
internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor; public override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor;
public Action RestartRequested; public Action RestartRequested;
internal override bool AllowBeatmapRulesetChange => false; public override bool AllowBeatmapRulesetChange => false;
public bool HasFailed { get; private set; } public bool HasFailed { get; private set; }

View File

@ -24,9 +24,9 @@ namespace osu.Game.Screens.Play
private BeatmapMetadataDisplay info; private BeatmapMetadataDisplay info;
private bool showOverlays = true; private bool showOverlays = true;
internal override bool ShowOverlays => showOverlays; public override bool ShowOverlays => showOverlays;
internal override bool AllowBeatmapRulesetChange => false; public override bool AllowBeatmapRulesetChange => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);

View File

@ -31,7 +31,7 @@ namespace osu.Game.Screens.Ranking
private ResultModeTabControl modeChangeButtons; private ResultModeTabControl modeChangeButtons;
internal override bool AllowBeatmapRulesetChange => false; public override bool AllowBeatmapRulesetChange => false;
private Container currentPage; private Container currentPage;

View File

@ -29,7 +29,7 @@ namespace osu.Game.Screens.Tournament
{ {
private const string results_filename = "drawings_results.txt"; private const string results_filename = "drawings_results.txt";
internal override bool ShowOverlays => false; public override bool ShowOverlays => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();

View File

@ -40,7 +40,7 @@ namespace osu.Game.Users
{ {
displayedAvatar?.FadeOut(300); displayedAvatar?.FadeOut(300);
displayedAvatar?.Expire(); displayedAvatar?.Expire();
Add(displayedAvatar = new AsyncLoadWrapper(new Avatar(user) Add(displayedAvatar = new DelayedLoadWrapper(new Avatar(user)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(200), OnLoadComplete = d => d.FadeInFromZero(200),

View File

@ -83,21 +83,6 @@
</Win32Resource> </Win32Resource>
</PropertyGroup> </PropertyGroup>
<PropertyGroup /> <PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VisualTests|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningLevel>0</WarningLevel>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<StartArguments>--tests</StartArguments>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DotNetZip, Version=1.10.1.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL"> <Reference Include="DotNetZip, Version=1.10.1.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath> <HintPath>$(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
@ -294,6 +279,9 @@
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" /> <Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\DrawablePerformanceScore.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\PaginatedScoreContainer.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
<Compile Include="Overlays\Settings\SettingsButton.cs" /> <Compile Include="Overlays\Settings\SettingsButton.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" /> <Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" /> <Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" />

15
osu.sln
View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 15
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 15.0.27004.2006
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game", "osu.Game\osu.Game.csproj", "{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game", "osu.Game\osu.Game.csproj", "{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}"
EndProject EndProject
@ -34,8 +34,8 @@ Global
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.Build.0 = Release|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.Build.0 = Release|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.VisualTests|Any CPU.ActiveCfg = VisualTests|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.VisualTests|Any CPU.Build.0 = VisualTests|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.VisualTests|Any CPU.Build.0 = Debug|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.Build.0 = Debug|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.ActiveCfg = Release|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -85,12 +85,15 @@ Global
{419659FD-72EA-4678-9EB8-B22A746CED70}.Debug|Any CPU.Build.0 = Debug|Any CPU {419659FD-72EA-4678-9EB8-B22A746CED70}.Debug|Any CPU.Build.0 = Debug|Any CPU
{419659FD-72EA-4678-9EB8-B22A746CED70}.Release|Any CPU.ActiveCfg = Release|Any CPU {419659FD-72EA-4678-9EB8-B22A746CED70}.Release|Any CPU.ActiveCfg = Release|Any CPU
{419659FD-72EA-4678-9EB8-B22A746CED70}.Release|Any CPU.Build.0 = Release|Any CPU {419659FD-72EA-4678-9EB8-B22A746CED70}.Release|Any CPU.Build.0 = Release|Any CPU
{419659FD-72EA-4678-9EB8-B22A746CED70}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU {419659FD-72EA-4678-9EB8-B22A746CED70}.VisualTests|Any CPU.ActiveCfg = VisualTests|Any CPU
{419659FD-72EA-4678-9EB8-B22A746CED70}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {419659FD-72EA-4678-9EB8-B22A746CED70}.VisualTests|Any CPU.Build.0 = VisualTests|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {671B0BEC-2403-45B0-9357-2C97CC517668}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1