コード例 #1
0
ファイル: Friend.cs プロジェクト: uvbs/LeagueClient-v2
        JSONValue JSONValuable.ToJSON()
        {
            var json = new JSONObject()
            {
                ["user"] = User,
                ["name"] = Name,
                ["id"]   = ChatUtils.GetSummonerId(User)
            };

            if (IsOnline)
            {
                json["show"]    = Status.Show;
                json["message"] = Status.Message;
                if (Status.GameStatus != null)
                {
                    json["status"] = new JSONObject {
                        ["display"] = Status.GameStatus.Display,
                        ["id"]      = Status.GameStatus.Key
                    }
                }
                ;
            }

            if (IsMobile && Status.LastOnline.HasValue)
            {
                json["lastonline"] = Status.LastOnline.Value;
            }

            if (IsInGame)
            {
                json["game"] = new JSONObject {
                    ["start"] = CurrentGame?.gameStartTime ?? Status.TimeStamp,
                    ["exact"] = CurrentGame != null,
                    ["type"]  = CurrentGame?.gameQueueConfigId ?? -1
                };
            }

            return(json);
        }