public Task HandleAsync(ISession session, IClientPacket clientPacket) { int x = clientPacket.ReadInt(); int y = clientPacket.ReadInt(); IList <Position> walkingPath = PathFinder.FindPath( session.CurrentRoom.RoomGrid, session.Entity.Position, new Position(x, y, 0)); walkingPath.RemoveAt(walkingPath.Count - 1); session.Entity.PathToWalk = walkingPath; return(Task.CompletedTask); }
public async Task HandleAsync(ISession session, IClientPacket clientPacket) { int roomId = clientPacket.ReadInt(); string password = clientPacket.ReadString(); IRoom room = await _roomController.GetRoomByIdAndPassword(roomId, password); if (room != null) { await session.WriteAndFlushAsync(new OpenConnectionComposer()); await session.WriteAndFlushAsync(new RoomReadyComposer(room.RoomData.ModelName, room.RoomData.Id)); await session.WriteAndFlushAsync(new RoomRatingComposer(room.RoomData.Score)); if (!room.CycleActive) { room.SetupRoomCycle(); } session.CurrentRoom = room; } else { await session.WriteAndFlushAsync(new CloseConnectionComposer()); } }