ProgressController.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Mvc;
  6. using api.Data;
  7. namespace api.Controllers
  8. {
  9. [Route("api/[controller]")]
  10. [ApiController]
  11. public class ProgressController : ControllerBase
  12. {
  13. private Dictionary<string, object> progression;
  14. public ProgressController() {
  15. this.init();
  16. }
  17. void init() {
  18. progression = new Dictionary<string, object>();
  19. List<ProgressElement> startingProgress = new List<ProgressElement>();
  20. startingProgress.Add(new ProgressElement() {Name = "init", Unlocks = new List<string>() {}});
  21. startingProgress.Add(new ProgressElement() {Name = "repair", Unlocks = new List<string>() {"inventory"}});
  22. startingProgress.Add(new ProgressElement() {Name = "repairfail", Unlocks = new List<string>() {"crafting"}});
  23. startingProgress.Add(new ProgressElement() {Name = "craft", Unlocks = new List<string>() {}});
  24. startingProgress.Add(new ProgressElement() {Name = "repair2", Unlocks = new List<string>() {"navigation"}});
  25. startingProgress.Add(new ProgressElement() {Name = "navigatefail", Unlocks = new List<string>() {}});
  26. startingProgress.Add(new ProgressElement() {Name = "craft2", Unlocks = new List<string>() {}});
  27. startingProgress.Add(new ProgressElement() {Name = "done", Unlocks = new List<string>() {}});
  28. this.progression.Add("starting", startingProgress);
  29. }
  30. [HttpGet]
  31. public ActionResult<Dictionary<string, object>> Get()
  32. {
  33. return this.progression;
  34. }
  35. // GET api/progress/5
  36. [HttpGet("{id}")]
  37. public ActionResult<object> GetPlayerProgress(int id)
  38. {
  39. return new { starting = "init" };
  40. }
  41. // GET api/progress/advance/chain/id
  42. [HttpGet("advance/{chain}/{id}")]
  43. public ActionResult<object> AdvancePlayer(string chain, int id)
  44. {
  45. return new List<string>() { "next" };
  46. }
  47. }
  48. }