using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using api.Data; namespace api.Controllers { [Route("api/[controller]")] [ApiController] public class ProgressController : ControllerBase { private Dictionary progression; public ProgressController() { this.init(); } void init() { progression = new Dictionary(); List startingProgress = new List(); startingProgress.Add(new ProgressElement() {Name = "init", Unlocks = new List() {}}); startingProgress.Add(new ProgressElement() {Name = "repair", Unlocks = new List() {"inventory"}}); startingProgress.Add(new ProgressElement() {Name = "repairfail", Unlocks = new List() {"crafting"}}); startingProgress.Add(new ProgressElement() {Name = "craft", Unlocks = new List() {}}); startingProgress.Add(new ProgressElement() {Name = "repair2", Unlocks = new List() {"navigation"}}); startingProgress.Add(new ProgressElement() {Name = "navigatefail", Unlocks = new List() {}}); startingProgress.Add(new ProgressElement() {Name = "craft2", Unlocks = new List() {}}); startingProgress.Add(new ProgressElement() {Name = "done", Unlocks = new List() {}}); this.progression.Add("starting", startingProgress); } [HttpGet] public ActionResult> Get() { return this.progression; } // GET api/progress/5 [HttpGet("{id}")] public ActionResult GetPlayerProgress(int id) { return new { starting = "init" }; } // GET api/progress/advance/chain/id [HttpGet("advance/{chain}/{id}")] public ActionResult AdvancePlayer(string chain, int id) { return new List() { "next" }; } } }