Example #1
0
 public async Task CreateChallenge(KgsRoom room, bool ranked, bool global, RulesDescription rules, StoneColor yourColor)
 {
     await kgsConnection.MakeUnattendedRequestAsync("CHALLENGE_CREATE", new
     {
         ChannelId   = room.ChannelId,
         CallbackKey = 0,
         Global      = global,
         Text        = "Game",
         Proposal    = new
         {
             GameType = ranked ? GameType.Ranked : GameType.Free,
             Rules    = rules,
             Nigiri   = yourColor == StoneColor.None,
             Players  = new KgsPlayer []
             {
                 new KgsPlayer()
                 {
                     Name = kgsConnection.Username,
                     Role = yourColor == StoneColor.Black ? "black" : "white"
                 },
                 new  KgsPlayer()
                 {
                     Role = yourColor == StoneColor.Black ? "white" : "black"
                 }
             }
         }
     });
 }
Example #2
0
 /// <summary>
 /// Asks to unjoin the room.
 /// </summary>
 /// <param name="room">The room we wish to exit.</param>
 public async Task UnjoinRoomAsync(KgsRoom room)
 {
     await kgsConnection.MakeUnattendedRequestAsync("UNJOIN_REQUEST", new
     {
         ChannelId = room.ChannelId
     });
 }
Example #3
0
 /// <summary>
 /// Gets the room with the specified ID. If it doesn't exist, it is created.
 /// </summary>
 /// <param name="channelId">The channel identifier.</param>
 private KgsRoom EnsureRoomExists(int channelId)
 {
     if (Channels.ContainsKey(channelId))
     {
     }
     else
     {
         var room = new KgsRoom(channelId);
         Channels[channelId] = room;
         AllRooms.Add(room);
     }
     return(Channels[channelId] as KgsRoom);
 }
Example #4
0
 private async void bCreateSimpleChallenge_Click(object sender, EventArgs e)
 {
     KgsRoom room = (KgsRoom)this.lbRooms.SelectedItem;
     if (room != null)
     {
         await this.kgs.Commands.CreateChallenge(room,true, false, new OmegaGo.Core.Online.Kgs.Datatypes.RulesDescription() {
                     Rules = RulesDescription.RulesChinese,
                     Size = 7,
                     Komi = 6.5f,
                     TimeSystem = "none"
             }, OmegaGo.Core.Game.StoneColor.None);
     }
 }
Example #5
0
 public KgsCreateChallengeBundle(KgsRoom room)
 {
     _room = room;
 }