Пример #1
0
 public void AcceptGame(Game game)
 {
     ServerResponse response = this.GetData(String.Format(GAME_URL, this.Id, game.Id));
     if (response.Message != null)
     {
         Console.WriteLine("Server Error: Message={0}, Code={1}", response.Message, response.Code);
     }
     else
     {
         JsonObject gameData = response.RawObject;
         game.ReloadGame(gameData);
     }
 }
Пример #2
0
        public Game CreateGame(string username = null)
        {
            var data = new Dictionary<object, object>
                {
                    { "language", "en" },
                };

            if (username != null)
                data.Add("opponent", new Dictionary<object, object> { { "username", username } });

            ServerResponse response = this.GetData(String.Format(NEW_GAME_URL, this.Id), data);
            if (response.Message != null)
            {
                Console.WriteLine("Server Error: Message={0}, Code={1}", response.Message, response.Code);
            }
            else
            {
                JsonValue jsonValue = response.RawObject;
                if (jsonValue != null)
                {
                    Game game = new Game(jsonValue, this);
                    this.Games.Add(game);
                    return game;
                }
            }

            return null;
        }
Пример #3
0
        public Spin(JsonValue jsonValue, Game game)
        {
            this.Game = game;

            this.QuestionType = (string)jsonValue["type"];
            this.Questions = new List<FullQuestion>();

            JsonArray questionJsonArray = (JsonArray)jsonValue["questions"];
            foreach (JsonValue questionJsonValue in questionJsonArray)
                this.Questions.Add(new FullQuestion(questionJsonValue, this));
        }