public async Task Handle(Message message) { //if (message.Chat.Type == Telegram.Bot.Types.Enums.ChatType.Private) //{ // await userInteractionService.SendMessage(message.Chat.Id, "You should add bot to a group"); // return; //} await gamesManager.Play(message.Chat.Id); }
private GridExtented Play(string sessionId, List <Tuple <int, int> > allPositions) { HackJsonp(); try { // 1-Check valid session var session = sessionManager.GetSession(sessionId, true); var positions = new List <Pawn>(); foreach (var item in allPositions) { positions.Add(new Pawn() { Coord = new Coord() { x = item.Item1, y = item.Item2 }, Name = "?", Player = session.PlayerInBattle.Player }); } Move move = new Move() { PlayerNumber = session.PlayerInBattle.PlayerNumber, Positions = positions }; var newState = gameManager.Play(session.PlayerInBattle, move); // 2-Return result return(new GridExtented() { SessionId = session.Id, State = newState }); } catch (Exception) { throw; } }