1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Some CI fixes.

This commit is contained in:
Huo Yaoyuan 2017-06-15 07:58:20 +08:00
parent 1d85578bf5
commit b37c3f8ce1
4 changed files with 35 additions and 33 deletions

View File

@ -1,15 +1,9 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Users;
namespace osu.Desktop.VisualTests.Tests

View File

@ -19,7 +19,7 @@ namespace osu.Game.Users.Profile
{
public class ProfileHeader : Container
{
private readonly User user;
//private readonly User user;
private readonly OsuTextFlowContainer infoText;
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
@ -31,7 +31,7 @@ namespace osu.Game.Users.Profile
private const float cover_height = 350, info_height = 150, avatar_size = 110, avatar_bottom_position = -20, level_position = 30, level_height = 60;
public ProfileHeader(User user)
{
this.user = user;
//this.user = user;
RelativeSizeAxes = Axes.X;
Height = cover_height + info_height;
@ -191,7 +191,7 @@ namespace osu.Game.Users.Profile
Origin = Anchor.BottomCentre,
Y = -64,
Spacing = new Vector2(20, 0),
Children = new GradeBadge[]
Children = new[]
{
gradeSSPlus = new GradeBadge("SSPlus") { Count = 12 },
gradeSS = new GradeBadge("SS") { Count = 34 },
@ -205,7 +205,7 @@ namespace osu.Game.Users.Profile
Origin = Anchor.BottomCentre,
Y = -18,
Spacing = new Vector2(20, 0),
Children = new GradeBadge[]
Children = new[]
{
gradeSPlus = new GradeBadge("SPlus") { Count = 567 },
gradeS = new GradeBadge("S") { Count = 890 },
@ -236,13 +236,19 @@ namespace osu.Game.Users.Profile
}
}
};
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
levelBadge.Texture = textures.Get(@"Profile/levelbadge");
Action<SpriteText> bold = t =>
{
t.Font = @"Exo2.0-Bold";
t.Alpha = 1;
};
// placeholder text
// fill placeholder texts
infoText.AddTextAwesome(FontAwesome.fa_map_marker);
infoText.AddText(" position ");
infoText.AddTextAwesome(FontAwesome.fa_twitter);
@ -282,12 +288,6 @@ namespace osu.Game.Users.Profile
scoreNumberText.Add(createScoreNumberText("23"));
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
levelBadge.Texture = textures.Get(@"Profile/levelbadge");
}
private OsuSpriteText createScoreText(string text) => new OsuSpriteText
{
TextSize = 14,

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using OpenTK;
@ -62,23 +63,27 @@ namespace osu.Game.Users.Profile
RelativeSizeAxes = Axes.X,
Y = -13,
DefaultValueCount = 90,
BallRelease = () =>
{
rankText.Text = $"#{rank:#,#}";
performanceText.Text = $"{performance:#,#}pp";
relativeText.Text = $"{this.user.Country?.FullName} #{countryRank:#,#}";
},
BallMove = index =>
{
rankText.Text = $"#{ranks[index]:#,#}";
performanceText.Text = $"{performances[index]:#,#}pp";
relativeText.Text = index == ranks.Length ? "Now" : $"{ranks.Length - index} days ago";
//plural should be handled in a general way
}
BallRelease = updateRankTexts,
BallMove = showHistoryRankTexts
}
};
}
private void updateRankTexts()
{
rankText.Text = $"#{rank:#,#}";
performanceText.Text = $"{performance:#,#}pp";
relativeText.Text = $"{this.user.Country?.FullName} #{countryRank:#,#}";
}
private void showHistoryRankTexts(int dayIndex)
{
rankText.Text = $"#{ranks[dayIndex]:#,#}";
performanceText.Text = $"{performances[dayIndex]:#,#}pp";
relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago";
//plural should be handled in a general way
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -137,6 +142,8 @@ namespace osu.Game.Users.Profile
public void ResetBall()
{
Trace.Assert(ActualMaxValue.HasValue);
Trace.Assert(ActualMinValue.HasValue);
ball.MoveTo(new Vector2(1, ((ActualMaxValue - Values.Last()) / (ActualMaxValue - ActualMinValue)).Value), ballShown ? transform_duration : 0, EasingTypes.OutQuint);
ball.Show();
BallRelease();
@ -147,7 +154,7 @@ namespace osu.Game.Users.Profile
{
if (ballShown)
{
var values = Values as IList<float>;
var values = (IList<float>)Values;
var position = ToLocalSpace(state.Mouse.NativeState.Position);
int count = Math.Max(values.Count, DefaultValueCount);
int index = (int)Math.Round(position.X / DrawWidth * (count - 1));
@ -155,6 +162,8 @@ namespace osu.Game.Users.Profile
{
int i = index + values.Count - count;
float value = values[i];
Trace.Assert(ActualMaxValue.HasValue);
Trace.Assert(ActualMinValue.HasValue);
float y = ((ActualMaxValue - value) / (ActualMaxValue - ActualMinValue)).Value;
if (Math.Abs(y * DrawHeight - position.Y) <= 8f)
{

View File

@ -20,7 +20,6 @@ namespace osu.Game.Users
{
private readonly User user;
private ProfileSection lastSection;
private readonly ProfileTabControl tabs;
public const float CONTENT_X_MARGIN = 50;
@ -37,7 +36,7 @@ namespace osu.Game.Users
new BeatmapsSection(user),
new KudosuSection(user)
};
tabs = new ProfileTabControl
var tabs = new ProfileTabControl
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopCentre,