From 039f4a65dc5b83c2f437b00ecec3a14e263ebd4b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 00:04:07 +0900 Subject: [PATCH] Combine user models. --- osu.Game/Online/API/APIAccess.cs | 1 + .../Online/API/Requests/GetUserRequest.cs | 2 ++ osu.Game/Online/Chat/Drawables/ChatLine.cs | 2 +- osu.Game/Online/Chat/Message.cs | 1 + osu.Game/Online/User.cs | 19 ------------------- osu.Game/Users/User.cs | 12 +++++++++++- osu.Game/osu.Game.csproj | 3 +-- 7 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 osu.Game/Online/User.cs diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 087bae3071..c4b679fc92 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -12,6 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Online.API.Requests; +using osu.Game.Users; namespace osu.Game.Online.API { diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index e396c56b53..2fd1ee5efc 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Users; + namespace osu.Game.Online.API.Requests { public class GetUserRequest : APIRequest diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index 9f78be92d1..bfbcf3d707 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -91,7 +91,7 @@ namespace osu.Game.Online.Chat.Drawables new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.User.Name}:", + Text = $@"{Message.User.Username}:", Colour = getUsernameColour(Message), TextSize = text_size, Origin = Anchor.TopRight, diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 3081653c34..b267cf63ac 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -3,6 +3,7 @@ using System; using Newtonsoft.Json; +using osu.Game.Users; namespace osu.Game.Online.Chat { diff --git a/osu.Game/Online/User.cs b/osu.Game/Online/User.cs deleted file mode 100644 index 0059f940a5..0000000000 --- a/osu.Game/Online/User.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using Newtonsoft.Json; - -namespace osu.Game.Online -{ - public class User - { - [JsonProperty(@"username")] - public string Name; - - [JsonProperty(@"id")] - public int Id; - - [JsonProperty(@"colour")] - public string Colour; - } -} diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 2763b3100f..6e1de7e3ac 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -1,13 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; + namespace osu.Game.Users { public class User { - public int Id; + [JsonProperty(@"id")] + public long Id = 1; + + [JsonProperty(@"username")] public string Username; + public Country Country; + public Team Team; + + [JsonProperty(@"colour")] + public string Colour; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 32dd814fdc..7cb55aaa89 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -247,7 +247,6 @@ - @@ -396,4 +395,4 @@ --> - + \ No newline at end of file