public Task RejectUndoAsync(RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; this.igsConnection.MakeUnattendedRequest("noundo " + igsGameInfo.IgsIndex); return(CompletedTask); }
public async Task MakeMove(RemoteGameInfo remoteInfo, Move move) { KgsGameInfo kgsInfo = (KgsGameInfo)remoteInfo; if (move.Kind == MoveKind.Pass) { await kgsConnection.MakeUnattendedRequestAsync("GAME_MOVE", new { ChannelId = kgsInfo.ChannelId, Loc = "PASS" }); } else { await kgsConnection.MakeUnattendedRequestAsync("GAME_MOVE", new { ChannelId = kgsInfo.ChannelId, Loc = new { X = move.Coordinates.X, Y = KgsCoordinates.OurToTheirs(move.Coordinates.Y, kgsInfo.BoardSize) } }); } }
public Task UndoLifeDeath(RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; this.igsConnection.MakeUnattendedRequest("undo " + igsGameInfo.IgsIndex); return(IgsCommands.CompletedTask); }
public InGameForm(RemoteGameInfo info, RemoteGameController onlineGameController, IServerConnection server) { InitializeComponent(); _isOnline = onlineGameController != null; this._onlineGameController = onlineGameController; if (onlineGameController != null) { _gameInfo = info; _server = server; } if (_server is IgsConnection) { var connection = (_server as IgsConnection); bLocalUndo.Visible = false; connection.Events.ErrorMessageReceived += _igs_ErrorMessageReceived; // this._igs.UndoRequestReceived += _igs_UndoRequestReceived; //connection.Events.UndoDeclined += _igs_UndoDeclined; bAddTimeToMyOpponent.Visible = true; bResumeAsBlack.Visible = false; } else if (_server is KgsConnection) { } else { bAddTimeToMyOpponent.Visible = false; bUndoPlease.Visible = false; bUndoYes.Visible = false; bUndoNo.Visible = false; } RefreshBoard(); }
public async Task UnobserveAsync(RemoteGameInfo remoteInfo) { var kgsInfo = remoteInfo as KgsGameInfo; await kgsConnection.MakeUnattendedRequestAsync("UNJOIN_REQUEST", new { ChannelId = kgsInfo.ChannelId }); }
public async Task Resign(RemoteGameInfo remoteInfo) { var kgsInfo = (KgsGameInfo)remoteInfo; await kgsConnection.MakeUnattendedRequestAsync("GAME_RESIGN", new { ChannelId = kgsInfo.ChannelId, }); }
public async Task AllowUndoAsync(RemoteGameInfo remoteInfo) { KgsGameInfo kgsInfo = (KgsGameInfo)remoteInfo; await kgsConnection.MakeUnattendedRequestAsync("GAME_UNDO_ACCEPT", new { ChannelId = kgsInfo.ChannelId }); }
public async Task Resign(RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; var response = await this.igsConnection.MakeRequestAsync("resign " + igsGameInfo.IgsIndex); if (!response.IsError) { this.igsConnection.HandleIncomingResignation(igsGameInfo, this.igsConnection.Username); } }
public async Task UnobserveAsync(RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; var igsGame = igsConnection.GamesBeingObserved.FirstOrDefault(gm => gm.Info.IgsIndex == igsGameInfo.IgsIndex); if (igsGame != null) { await this.EndObserving(igsGame); } }
public async Task LifeDeathDone(RemoteGameInfo remoteInfo) { KgsGameInfo kgsInfo = (KgsGameInfo)remoteInfo; var game = kgsConnection.Data.GetGame(kgsInfo.ChannelId); await kgsConnection.MakeUnattendedRequestAsync("GAME_SCORING_DONE", new { ChannelId = kgsInfo.ChannelId, DoneId = game.Controller.DoneId }); }
public Task AddTime(RemoteGameInfo remoteInfo, TimeSpan additionalTime) { if (additionalTime.Seconds != 0) { throw new ArgumentException("IGS only supports adding whole minutes", nameof(additionalTime)); } var igsGameInfo = (IgsGameInfo)remoteInfo; this.igsConnection.MakeUnattendedRequest("addtime " + igsGameInfo.IgsIndex + " " + additionalTime.Minutes); return(IgsCommands.CompletedTask); }
public async Task LifeDeathMarkLife(Position position, RemoteGameInfo remoteInfo) { KgsGameInfo kgsInfo = (KgsGameInfo)remoteInfo; await kgsConnection.MakeUnattendedRequestAsync("GAME_MARK_LIFE", new { ChannelId = kgsInfo.ChannelId, Alive = true, X = position.X, Y = KgsCoordinates.OurToTheirs(position.Y, kgsInfo.BoardSize) }); }
public async Task AddTime(RemoteGameInfo remoteInfo, TimeSpan additionalTime) { KgsGameInfo kgsInfo = (KgsGameInfo)remoteInfo; string opponentsRole = "black"; if (kgsInfo.Black.Name == kgsConnection.Username) { opponentsRole = "white"; } await kgsConnection.MakeUnattendedRequestAsync("GAME_ADD_TIME", new { ChannelId = kgsInfo.ChannelId, Role = opponentsRole, Time = (float)additionalTime.TotalSeconds }); }
public Task MakeMove(RemoteGameInfo remoteInfo, Move move) { var game = (IgsGameInfo)remoteInfo; switch (move.Kind) { case MoveKind.PlaceStone: this.igsConnection.MakeUnattendedRequest(move.Coordinates.ToIgsCoordinates() + " " + game.IgsIndex); break; case MoveKind.Pass: this.igsConnection.MakeUnattendedRequest("pass " + game.IgsIndex); break; } return(IgsCommands.CompletedTask); }
public async Task LifeDeathMarkDeath(Position position, RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; await this.igsConnection.MakeRequestAsync(position.ToIgsCoordinates() + " " + igsGameInfo.IgsIndex); }
public async Task LifeDeathDone(RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; await this.igsConnection.MakeRequestAsync("done " + igsGameInfo.IgsIndex); }
public Task UndoLifeDeath(RemoteGameInfo remoteInfo) { // Life/death works a little differently in KGS. return(CompletedTask); }
public async Task AllowUndoAsync(RemoteGameInfo remoteInfo) { var igsGameInfo = (IgsGameInfo)remoteInfo; await MakeRequestAsync("undo " + igsGameInfo.IgsIndex); }
public Task RejectUndoAsync(RemoteGameInfo remoteInfo) { // At KGS, to reject an undo, simply ignore it. return(CompletedTask); }
public RemoteLifeAndDeathPhase(RemoteGameController controller) : base(controller) { _serverConnection = controller.Server; _remoteGameInfo = controller.Info; }
/// <summary> /// Creates a remote game controller /// </summary> /// <param name="remoteGameInfo">Info about the remote game</param> /// <param name="ruleset">Ruleset that guides the game</param> /// <param name="players">Players playing the game</param> /// <param name="serverConnection">Server connection</param> protected RemoteGameController(RemoteGameInfo remoteGameInfo, IRuleset ruleset, PlayerPair players, IServerConnection serverConnection) : base(remoteGameInfo, ruleset, players) { Info = remoteGameInfo; Server = serverConnection; }