Files
Genesis_GameServer/GameServer/Controllers/WeatherForecastController.cs

29 lines
858 B
C#

using Microsoft.AspNetCore.Mvc;
namespace GameServer.Controllers
{
[ApiController]
[Route("myGame")]
public class WeatherForecastController : ControllerBase
{
// 서버 메모리에 임시로 저장할 데이터 (나중에 DB로 바꿀 부분)
private static int _tempData = 100;
// 데이터 로드
[HttpGet("data")]
public IActionResult GetCores()
{
// 유니티에게 JSON 형태로 데이터를 보냄
return Ok(new { data = _tempData, message = "데이터 로드 성공!" });
}
// 데이터 수정
[HttpPost("add-data")]
public IActionResult AddCore([FromBody] int value)
{
_tempData = value;
return Ok(new { data = _tempData, message = $"{value}로 데이터 수정 완료!" });
}
}
}