mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 18:12:56 +08:00
Merge branch 'master' into beatmap-serialization
This commit is contained in:
commit
4d40004e97
@ -9,5 +9,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
public class OsuEditPlayfield : OsuPlayfield
|
public class OsuEditPlayfield : OsuPlayfield
|
||||||
{
|
{
|
||||||
protected override CursorContainer CreateCursor() => null;
|
protected override CursorContainer CreateCursor() => null;
|
||||||
|
|
||||||
|
protected override bool ProxyApproachCircles => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,10 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
public override bool ProvidingUserCursor => true;
|
public override bool ProvidingUserCursor => true;
|
||||||
|
|
||||||
|
// Todo: This should not be a thing, but is currently required for the editor
|
||||||
|
// https://github.com/ppy/osu-framework/issues/1283
|
||||||
|
protected virtual bool ProxyApproachCircles => true;
|
||||||
|
|
||||||
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
||||||
|
|
||||||
public override Vector2 Size
|
public override Vector2 Size
|
||||||
@ -80,7 +84,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
h.Depth = (float)h.HitObject.StartTime;
|
h.Depth = (float)h.HitObject.StartTime;
|
||||||
|
|
||||||
var c = h as IDrawableHitObjectWithProxiedApproach;
|
var c = h as IDrawableHitObjectWithProxiedApproach;
|
||||||
if (c != null)
|
if (c != null && ProxyApproachCircles)
|
||||||
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
||||||
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
|
123
osu.Game.Tests/Visual/TestCaseRankGraph.cs
Normal file
123
osu.Game.Tests/Visual/TestCaseRankGraph.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
public class TestCaseRankGraph : OsuTestCase
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(RankGraph),
|
||||||
|
typeof(LineGraph)
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestCaseRankGraph()
|
||||||
|
{
|
||||||
|
RankGraph graph;
|
||||||
|
|
||||||
|
var data = new int[89];
|
||||||
|
var dataWithZeros = new int[89];
|
||||||
|
var smallData = new int[89];
|
||||||
|
|
||||||
|
for (int i = 0; i < 89; i++)
|
||||||
|
data[i] = dataWithZeros[i] = (i + 1) * 1000;
|
||||||
|
|
||||||
|
for (int i = 20; i < 60; i++)
|
||||||
|
dataWithZeros[i] = 0;
|
||||||
|
|
||||||
|
for (int i = 79; i < 89; i++)
|
||||||
|
smallData[i] = 100000 - i * 1000;
|
||||||
|
|
||||||
|
Add(new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(300, 150),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.Gray(0.2f)
|
||||||
|
},
|
||||||
|
graph = new RankGraph
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("null user", () => graph.User.Value = null);
|
||||||
|
AddStep("rank only", () =>
|
||||||
|
{
|
||||||
|
graph.User.Value = new User
|
||||||
|
{
|
||||||
|
Statistics = new UserStatistics
|
||||||
|
{
|
||||||
|
Rank = 123456,
|
||||||
|
PP = 12345,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("with rank history", () =>
|
||||||
|
{
|
||||||
|
graph.User.Value = new User
|
||||||
|
{
|
||||||
|
Statistics = new UserStatistics
|
||||||
|
{
|
||||||
|
Rank = 89000,
|
||||||
|
PP = 12345,
|
||||||
|
},
|
||||||
|
RankHistory = new User.RankHistoryData
|
||||||
|
{
|
||||||
|
Data = data,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("with zero values", () =>
|
||||||
|
{
|
||||||
|
graph.User.Value = new User
|
||||||
|
{
|
||||||
|
Statistics = new UserStatistics
|
||||||
|
{
|
||||||
|
Rank = 89000,
|
||||||
|
PP = 12345,
|
||||||
|
},
|
||||||
|
RankHistory = new User.RankHistoryData
|
||||||
|
{
|
||||||
|
Data = dataWithZeros,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("small amount of data", () =>
|
||||||
|
{
|
||||||
|
graph.User.Value = new User
|
||||||
|
{
|
||||||
|
Statistics = new UserStatistics
|
||||||
|
{
|
||||||
|
Rank = 12000,
|
||||||
|
PP = 12345,
|
||||||
|
},
|
||||||
|
RankHistory = new User.RankHistoryData
|
||||||
|
{
|
||||||
|
Data = smallData,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,14 +2,25 @@
|
|||||||
// 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 System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Profile;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
public class TestCaseUserProfile : OsuTestCase
|
public class TestCaseUserProfile : OsuTestCase
|
||||||
{
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(ProfileHeader),
|
||||||
|
typeof(UserProfileOverlay),
|
||||||
|
typeof(RankGraph),
|
||||||
|
typeof(LineGraph),
|
||||||
|
};
|
||||||
|
|
||||||
public TestCaseUserProfile()
|
public TestCaseUserProfile()
|
||||||
{
|
{
|
||||||
var profile = new UserProfileOverlay();
|
var profile = new UserProfileOverlay();
|
||||||
|
@ -134,6 +134,7 @@
|
|||||||
<Compile Include="Visual\TestCaseOsuGame.cs" />
|
<Compile Include="Visual\TestCaseOsuGame.cs" />
|
||||||
<Compile Include="Visual\TestCasePlaybackControl.cs" />
|
<Compile Include="Visual\TestCasePlaybackControl.cs" />
|
||||||
<Compile Include="Visual\TestCasePlaySongSelect.cs" />
|
<Compile Include="Visual\TestCasePlaySongSelect.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseRankGraph.cs" />
|
||||||
<Compile Include="Visual\TestCaseReplay.cs" />
|
<Compile Include="Visual\TestCaseReplay.cs" />
|
||||||
<Compile Include="Visual\TestCaseReplaySettingsOverlay.cs" />
|
<Compile Include="Visual\TestCaseReplaySettingsOverlay.cs" />
|
||||||
<Compile Include="Visual\TestCaseResults.cs" />
|
<Compile Include="Visual\TestCaseResults.cs" />
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Caching;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -47,7 +48,16 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
values = value.ToArray();
|
values = value.ToArray();
|
||||||
applyPath();
|
|
||||||
|
float max = values.Max(), min = values.Min();
|
||||||
|
if (MaxValue > max) max = MaxValue.Value;
|
||||||
|
if (MinValue < min) min = MinValue.Value;
|
||||||
|
|
||||||
|
ActualMaxValue = max;
|
||||||
|
ActualMinValue = min;
|
||||||
|
|
||||||
|
pathCached.Invalidate();
|
||||||
|
|
||||||
maskingContainer.Width = 0;
|
maskingContainer.Width = 0;
|
||||||
maskingContainer.ResizeWidthTo(1, transform_duration, Easing.OutQuint);
|
maskingContainer.ResizeWidthTo(1, transform_duration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -63,13 +73,28 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool pending;
|
||||||
|
|
||||||
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
||||||
{
|
{
|
||||||
if ((invalidation & Invalidation.DrawSize) != 0)
|
if ((invalidation & Invalidation.DrawSize) > 0)
|
||||||
applyPath();
|
pathCached.Invalidate();
|
||||||
|
|
||||||
return base.Invalidate(invalidation, source, shallPropagate);
|
return base.Invalidate(invalidation, source, shallPropagate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Cached pathCached = new Cached();
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
if (!pathCached.IsValid)
|
||||||
|
{
|
||||||
|
applyPath();
|
||||||
|
pathCached.Validate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void applyPath()
|
private void applyPath()
|
||||||
{
|
{
|
||||||
path.ClearVertices();
|
path.ClearVertices();
|
||||||
@ -77,13 +102,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
int count = Math.Max(values.Length, DefaultValueCount);
|
int count = Math.Max(values.Length, DefaultValueCount);
|
||||||
|
|
||||||
float max = values.Max(), min = values.Min();
|
|
||||||
if (MaxValue > max) max = MaxValue.Value;
|
|
||||||
if (MinValue < min) min = MinValue.Value;
|
|
||||||
|
|
||||||
ActualMaxValue = max;
|
|
||||||
ActualMinValue = min;
|
|
||||||
|
|
||||||
for (int i = 0; i < values.Length; i++)
|
for (int i = 0; i < values.Length; i++)
|
||||||
{
|
{
|
||||||
float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1;
|
float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1;
|
||||||
|
@ -27,8 +27,9 @@ namespace osu.Game.Overlays.Profile
|
|||||||
private readonly OsuTextFlowContainer infoTextLeft;
|
private readonly OsuTextFlowContainer infoTextLeft;
|
||||||
private readonly LinkFlowContainer infoTextRight;
|
private readonly LinkFlowContainer infoTextRight;
|
||||||
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
|
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
|
||||||
|
private readonly RankGraph rankGraph;
|
||||||
|
|
||||||
private readonly Container coverContainer, chartContainer, supporterTag;
|
private readonly Container coverContainer, supporterTag;
|
||||||
private readonly Sprite levelBadge;
|
private readonly Sprite levelBadge;
|
||||||
private readonly SpriteText levelText;
|
private readonly SpriteText levelText;
|
||||||
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
|
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
|
||||||
@ -273,7 +274,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chartContainer = new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
@ -285,6 +286,10 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
Colour = Color4.Black.Opacity(0.25f),
|
Colour = Color4.Black.Opacity(0.25f),
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
|
rankGraph = new RankGraph
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,11 +308,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
public User User
|
public User User
|
||||||
{
|
{
|
||||||
get
|
get { return user; }
|
||||||
{
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
user = value;
|
user = value;
|
||||||
@ -420,7 +421,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
gradeSPlus.DisplayCount = 0;
|
gradeSPlus.DisplayCount = 0;
|
||||||
gradeSSPlus.DisplayCount = 0;
|
gradeSSPlus.DisplayCount = 0;
|
||||||
|
|
||||||
chartContainer.Add(new RankChart(user) { RelativeSizeAxes = Axes.Both });
|
rankGraph.User.Value = user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,30 +14,39 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
public class RankChart : Container
|
public class RankGraph : Container
|
||||||
{
|
{
|
||||||
|
private const float primary_textsize = 25;
|
||||||
|
private const float secondary_textsize = 13;
|
||||||
|
private const float padding = 10;
|
||||||
|
private const float fade_duration = 150;
|
||||||
|
private const int ranked_days = 88;
|
||||||
|
|
||||||
private readonly SpriteText rankText, performanceText, relativeText;
|
private readonly SpriteText rankText, performanceText, relativeText;
|
||||||
private readonly RankChartLineGraph graph;
|
private readonly RankChartLineGraph graph;
|
||||||
|
private readonly OsuSpriteText placeholder;
|
||||||
|
|
||||||
private readonly int[] ranks;
|
private KeyValuePair<int, int>[] ranks;
|
||||||
|
public Bindable<User> User = new Bindable<User>();
|
||||||
|
|
||||||
private const float primary_textsize = 25, secondary_textsize = 13, padding = 10;
|
public RankGraph()
|
||||||
|
|
||||||
private readonly User user;
|
|
||||||
|
|
||||||
public RankChart(User user)
|
|
||||||
{
|
{
|
||||||
this.user = user;
|
|
||||||
|
|
||||||
int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank };
|
|
||||||
ranks = userRanks.SkipWhile(x => x == 0).ToArray();
|
|
||||||
|
|
||||||
Padding = new MarginPadding { Vertical = padding };
|
Padding = new MarginPadding { Vertical = padding };
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
placeholder = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Text = "No recent plays",
|
||||||
|
TextSize = 14,
|
||||||
|
Font = @"Exo2.0-RegularItalic",
|
||||||
|
},
|
||||||
rankText = new OsuSpriteText
|
rankText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -60,89 +69,103 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Font = @"Exo2.0-RegularItalic",
|
Font = @"Exo2.0-RegularItalic",
|
||||||
TextSize = secondary_textsize
|
TextSize = secondary_textsize
|
||||||
},
|
},
|
||||||
};
|
graph = new RankChartLineGraph
|
||||||
|
|
||||||
if (ranks.Length > 0)
|
|
||||||
{
|
|
||||||
Add(graph = new RankChartLineGraph
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 75,
|
||||||
Y = -secondary_textsize,
|
Y = -secondary_textsize,
|
||||||
DefaultValueCount = ranks.Length,
|
Alpha = 0,
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
graph.OnBallMove += showHistoryRankTexts;
|
graph.OnBallMove += showHistoryRankTexts;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateRankTexts()
|
User.ValueChanged += userChanged;
|
||||||
{
|
|
||||||
rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank";
|
|
||||||
performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty;
|
|
||||||
relativeText.Text = user.CountryRank > 0 ? $"{user.Country?.FullName} #{user.CountryRank:#,0}" : $"{user.Country?.FullName}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showHistoryRankTexts(int dayIndex)
|
|
||||||
{
|
|
||||||
rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank";
|
|
||||||
dayIndex++;
|
|
||||||
relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago";
|
|
||||||
//plural should be handled in a general way
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
|
||||||
if (graph != null)
|
|
||||||
{
|
{
|
||||||
graph.Colour = colours.Yellow;
|
graph.Colour = colours.Yellow;
|
||||||
// use logarithmic coordinates
|
}
|
||||||
graph.Values = ranks.Select(x => x == 0 ? float.MinValue : -(float)Math.Log(x));
|
|
||||||
|
private void userChanged(User user)
|
||||||
|
{
|
||||||
|
placeholder.FadeIn(fade_duration, Easing.Out);
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
rankText.Text = string.Empty;
|
||||||
|
performanceText.Text = string.Empty;
|
||||||
|
relativeText.Text = string.Empty;
|
||||||
|
graph.FadeOut(fade_duration, Easing.Out);
|
||||||
|
ranks = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank };
|
||||||
|
ranks = userRanks.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray();
|
||||||
|
|
||||||
|
if (ranks.Length > 1)
|
||||||
|
{
|
||||||
|
placeholder.FadeOut(fade_duration, Easing.Out);
|
||||||
|
|
||||||
|
graph.DefaultValueCount = ranks.Length;
|
||||||
|
graph.Values = ranks.Select(x => -(float)Math.Log(x.Value));
|
||||||
graph.SetStaticBallPosition();
|
graph.SetStaticBallPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
graph.FadeTo(ranks.Length > 1 ? 1 : 0, fade_duration, Easing.Out);
|
||||||
|
|
||||||
updateRankTexts();
|
updateRankTexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
private void updateRankTexts()
|
||||||
{
|
{
|
||||||
if ((invalidation & Invalidation.DrawSize) != 0)
|
rankText.Text = User.Value.Statistics.Rank > 0 ? $"#{User.Value.Statistics.Rank:#,0}" : "no rank";
|
||||||
{
|
performanceText.Text = User.Value.Statistics.PP != null ? $"{User.Value.Statistics.PP:#,0}pp" : string.Empty;
|
||||||
graph.Height = DrawHeight - padding * 2 - primary_textsize - secondary_textsize * 2;
|
relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.CountryRank:#,0}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.Invalidate(invalidation, source, shallPropagate);
|
private void showHistoryRankTexts(int dayIndex)
|
||||||
|
{
|
||||||
|
rankText.Text = $"#{ranks[dayIndex].Value:#,0}";
|
||||||
|
relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
graph?.UpdateBallPosition(state.Mouse.Position.X);
|
if (ranks?.Length > 1)
|
||||||
graph?.ShowBall();
|
{
|
||||||
|
graph.UpdateBallPosition(state.Mouse.Position.X);
|
||||||
|
graph.ShowBall();
|
||||||
|
}
|
||||||
return base.OnHover(state);
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(InputState state)
|
protected override bool OnMouseMove(InputState state)
|
||||||
{
|
{
|
||||||
graph?.UpdateBallPosition(state.Mouse.Position.X);
|
if (ranks?.Length > 1)
|
||||||
|
graph.UpdateBallPosition(state.Mouse.Position.X);
|
||||||
|
|
||||||
return base.OnMouseMove(state);
|
return base.OnMouseMove(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
if (graph != null)
|
if (ranks?.Length > 1)
|
||||||
{
|
{
|
||||||
graph.HideBall();
|
graph.HideBall();
|
||||||
updateRankTexts();
|
updateRankTexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RankChartLineGraph : LineGraph
|
private class RankChartLineGraph : LineGraph
|
||||||
{
|
{
|
||||||
private const double fade_duration = 200;
|
|
||||||
|
|
||||||
private readonly CircularContainer staticBall;
|
private readonly CircularContainer staticBall;
|
||||||
private readonly CircularContainer movingBall;
|
private readonly CircularContainer movingBall;
|
||||||
|
|
@ -503,7 +503,7 @@
|
|||||||
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableProfileScore.cs" />
|
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableProfileScore.cs" />
|
||||||
<Compile Include="Overlays\Profile\ProfileHeader.cs" />
|
<Compile Include="Overlays\Profile\ProfileHeader.cs" />
|
||||||
<Compile Include="Overlays\Profile\ProfileSection.cs" />
|
<Compile Include="Overlays\Profile\ProfileSection.cs" />
|
||||||
<Compile Include="Overlays\Profile\RankChart.cs" />
|
<Compile Include="Overlays\Profile\RankGraph.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\AboutSection.cs" />
|
<Compile Include="Overlays\Profile\Sections\AboutSection.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\BeatmapsSection.cs" />
|
<Compile Include="Overlays\Profile\Sections\BeatmapsSection.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\HistoricalSection.cs" />
|
<Compile Include="Overlays\Profile\Sections\HistoricalSection.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user