mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'master' of https://github.com/ppy/osu into better-transforms
# Conflicts: # osu-framework # osu.Game/Graphics/Cursor/OsuTooltipContainer.cs # osu.Game/Overlays/DragBar.cs
This commit is contained in:
@ -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;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
@ -11,17 +12,20 @@ namespace osu.Game.Users
|
||||
[JsonProperty(@"id")]
|
||||
public long Id = 1;
|
||||
|
||||
[JsonProperty(@"join_date")]
|
||||
public DateTimeOffset JoinDate;
|
||||
|
||||
[JsonProperty(@"username")]
|
||||
public string Username;
|
||||
|
||||
[JsonProperty(@"country_code")]
|
||||
public string CountryCode;
|
||||
|
||||
[JsonProperty(@"country")]
|
||||
public Country Country;
|
||||
|
||||
public Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
||||
|
||||
[JsonProperty(@"age")]
|
||||
public int? Age;
|
||||
|
||||
public int GlobalRank;
|
||||
|
||||
public int CountryRank;
|
||||
@ -51,5 +55,101 @@ namespace osu.Game.Users
|
||||
[JsonProperty(@"id")]
|
||||
public int? Id;
|
||||
}
|
||||
|
||||
[JsonProperty(@"isAdmin")]
|
||||
public bool IsAdmin;
|
||||
|
||||
[JsonProperty(@"isSupporter")]
|
||||
public bool IsSupporter;
|
||||
|
||||
[JsonProperty(@"isGMT")]
|
||||
public bool IsGMT;
|
||||
|
||||
[JsonProperty(@"isQAT")]
|
||||
public bool IsQAT;
|
||||
|
||||
[JsonProperty(@"isBNG")]
|
||||
public bool IsBNG;
|
||||
|
||||
[JsonProperty(@"is_active")]
|
||||
public bool Active;
|
||||
|
||||
[JsonProperty(@"interests")]
|
||||
public string Intrerests;
|
||||
|
||||
[JsonProperty(@"occupation")]
|
||||
public string Occupation;
|
||||
|
||||
[JsonProperty(@"title")]
|
||||
public string Title;
|
||||
|
||||
[JsonProperty(@"location")]
|
||||
public string Location;
|
||||
|
||||
[JsonProperty(@"lastvisit")]
|
||||
public DateTimeOffset LastVisit;
|
||||
|
||||
[JsonProperty(@"twitter")]
|
||||
public string Twitter;
|
||||
|
||||
[JsonProperty(@"lastfm")]
|
||||
public string Lastfm;
|
||||
|
||||
[JsonProperty(@"skype")]
|
||||
public string Skype;
|
||||
|
||||
[JsonProperty(@"website")]
|
||||
public string Website;
|
||||
|
||||
[JsonProperty(@"playstyle")]
|
||||
public string[] PlayStyle;
|
||||
|
||||
[JsonProperty(@"playmode")]
|
||||
public string PlayMode;
|
||||
|
||||
[JsonProperty(@"profileOrder")]
|
||||
public string[] ProfileOrder;
|
||||
|
||||
[JsonProperty(@"kudosu")]
|
||||
public KudosuCount Kudosu;
|
||||
|
||||
public class KudosuCount
|
||||
{
|
||||
[JsonProperty(@"total")]
|
||||
public int Total;
|
||||
|
||||
[JsonProperty(@"available")]
|
||||
public int Available;
|
||||
}
|
||||
|
||||
[JsonProperty(@"defaultStatistics")]
|
||||
public UserStatistics Statistics;
|
||||
|
||||
public class RankHistories
|
||||
{
|
||||
[JsonProperty(@"osu")]
|
||||
public RankHistory Osu;
|
||||
|
||||
[JsonProperty(@"taiko")]
|
||||
public RankHistory Taiko;
|
||||
|
||||
[JsonProperty(@"fruits")]
|
||||
public RankHistory Fruits;
|
||||
|
||||
[JsonProperty(@"mania")]
|
||||
public RankHistory Mania;
|
||||
}
|
||||
|
||||
public class RankHistory
|
||||
{
|
||||
[JsonProperty(@"mode")]
|
||||
public string Mode;
|
||||
|
||||
[JsonProperty(@"data")]
|
||||
public int[] Data;
|
||||
}
|
||||
|
||||
[JsonProperty(@"allRankHistories")]
|
||||
public RankHistories AllRankHistories;
|
||||
}
|
||||
}
|
||||
|
26
osu.Game/Users/UserCoverBackground.cs
Normal file
26
osu.Game/Users/UserCoverBackground.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// 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.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Users
|
||||
{
|
||||
public class UserCoverBackground : Sprite
|
||||
{
|
||||
private readonly User user;
|
||||
|
||||
public UserCoverBackground(User user)
|
||||
{
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(user.CoverUrl))
|
||||
Texture = textures.Get(user.CoverUrl);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -9,29 +10,31 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Users
|
||||
{
|
||||
public class UserPanel : Container
|
||||
public class UserPanel : ClickableContainer
|
||||
{
|
||||
private readonly User user;
|
||||
private const float height = 100;
|
||||
private const float content_padding = 10;
|
||||
private const float status_height = 30;
|
||||
|
||||
private OsuColour colours;
|
||||
|
||||
private readonly Container statusBar;
|
||||
private readonly Box statusBg;
|
||||
private readonly OsuSpriteText statusMessage;
|
||||
|
||||
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
||||
|
||||
public new Action Action;
|
||||
|
||||
public UserPanel(User user)
|
||||
{
|
||||
this.user = user;
|
||||
|
||||
Height = height - status_height;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
@ -44,7 +47,7 @@ namespace osu.Game.Users
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new AsyncLoadWrapper(new CoverBackgroundSprite(user)
|
||||
new AsyncLoadWrapper(new UserCoverBackground(user)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
@ -162,11 +165,17 @@ namespace osu.Game.Users
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, UserProfileOverlay profile)
|
||||
{
|
||||
this.colours = colours;
|
||||
Status.ValueChanged += displayStatus;
|
||||
Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, EasingTypes.OutQuint);
|
||||
|
||||
base.Action = () =>
|
||||
{
|
||||
Action?.Invoke();
|
||||
profile?.ShowUser(user);
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -191,26 +200,8 @@ namespace osu.Game.Users
|
||||
statusBar.FadeIn(transition_duration, EasingTypes.OutQuint);
|
||||
this.ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint);
|
||||
|
||||
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint);
|
||||
statusMessage.Text = status.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private class CoverBackgroundSprite : Sprite
|
||||
{
|
||||
private readonly User user;
|
||||
|
||||
public CoverBackgroundSprite(User user)
|
||||
{
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(user.CoverUrl))
|
||||
Texture = textures.Get(user.CoverUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
64
osu.Game/Users/UserStatistics.cs
Normal file
64
osu.Game/Users/UserStatistics.cs
Normal file
@ -0,0 +1,64 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Users
|
||||
{
|
||||
public class UserStatistics
|
||||
{
|
||||
[JsonProperty(@"level")]
|
||||
public LevelInfo Level;
|
||||
|
||||
public struct LevelInfo
|
||||
{
|
||||
[JsonProperty(@"current")]
|
||||
public int Current;
|
||||
|
||||
[JsonProperty(@"progress")]
|
||||
public int Progress;
|
||||
}
|
||||
|
||||
[JsonProperty(@"pp")]
|
||||
public decimal? PP;
|
||||
|
||||
[JsonProperty(@"pp_rank")]
|
||||
public int Rank;
|
||||
|
||||
[JsonProperty(@"ranked_score")]
|
||||
public long RankedScore;
|
||||
|
||||
[JsonProperty(@"hit_accuracy")]
|
||||
public decimal Accuracy;
|
||||
|
||||
[JsonProperty(@"play_count")]
|
||||
public int PlayCount;
|
||||
|
||||
[JsonProperty(@"total_score")]
|
||||
public long TotalScore;
|
||||
|
||||
[JsonProperty(@"total_hits")]
|
||||
public int TotalHits;
|
||||
|
||||
[JsonProperty(@"maximum_combo")]
|
||||
public int MaxCombo;
|
||||
|
||||
[JsonProperty(@"replays_watched_by_others")]
|
||||
public int ReplayWatched;
|
||||
|
||||
[JsonProperty(@"grade_counts")]
|
||||
public Grades GradesCount;
|
||||
|
||||
public struct Grades
|
||||
{
|
||||
[JsonProperty(@"ss")]
|
||||
public int SS;
|
||||
|
||||
[JsonProperty(@"s")]
|
||||
public int S;
|
||||
|
||||
[JsonProperty(@"a")]
|
||||
public int A;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user