Genesis Game Server Project Setup
This commit is contained in:
28
GameServer/Controllers/WeatherForecastController.cs
Normal file
28
GameServer/Controllers/WeatherForecastController.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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}로 데이터 수정 완료!" });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user