1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Configuration;
- using gameapi.Library;
- using System.Collections.Generic;
- namespace gameapi.Controllers
- {
- [ApiController]
- [Route("api/room")]
- [Produces("application/json")]
- public class RoomController : ControllerBase
- {
- private readonly ILogger<WorldController> logger;
- private readonly IConfiguration configuration;
- private JsonFileReader jsonFileReader;
- private JsonFileSaver jsonFileSaver;
- public RoomController(IConfiguration config, ILogger<WorldController> log)
- {
- configuration = config;
- logger = log;
- this.jsonFileReader = new JsonFileReader();
- this.jsonFileSaver = new JsonFileSaver();
- }
- [HttpGet("{x},{y}")]
- public IActionResult Get(int x, int y)
- {
- IEnumerable<Player> population = GameState.GetInstance().GetSectorPopulation(new Tuple<int, int>(x, y));
- dynamic response = new { population = population };
- return Ok(response);
- }
- }
- }
|