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" } } } }); }
/// <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 }); }
/// <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); }
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); } }
public KgsCreateChallengeBundle(KgsRoom room) { _room = room; }