mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
Added saving support for Ice Cubed. (#15)
Saving support now exists for Ice Cubed and any other games using the system.
This commit is contained in:
parent
757392d4d5
commit
6a9f2722e1
@ -2134,6 +2134,34 @@ public class ContentController : Controller {
|
|||||||
return Ok(random.Next(1, 15));
|
return Ok(random.Next(1, 15));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
//[Produces("application/xml")]
|
||||||
|
[Route("ContentWebService.asmx/GetGameProgress")] // used by Math Blaster (Ice Cubed)
|
||||||
|
[VikingSession]
|
||||||
|
public string GetGameProgress(Viking viking, [FromForm] int gameId) {
|
||||||
|
string? ret = Util.SavedData.Get(
|
||||||
|
viking,
|
||||||
|
(uint)gameId
|
||||||
|
);
|
||||||
|
if (ret is null)
|
||||||
|
return XmlUtil.SerializeXml<GameProgress>(null);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Produces("application/xml")]
|
||||||
|
[Route("ContentWebService.asmx/SetGameProgress")] // used by Math Blaster (Ice Cubed)
|
||||||
|
[VikingSession]
|
||||||
|
public IActionResult SetGameProgress(Viking viking, [FromForm] int gameId, [FromForm] string xmlDocumentData) {
|
||||||
|
Util.SavedData.Set(
|
||||||
|
viking,
|
||||||
|
(uint)gameId,
|
||||||
|
xmlDocumentData
|
||||||
|
);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
|
||||||
private static RaisedPetData GetRaisedPetDataFromDragon (Dragon dragon, int? selectedDragonId = null) {
|
private static RaisedPetData GetRaisedPetDataFromDragon (Dragon dragon, int? selectedDragonId = null) {
|
||||||
if (selectedDragonId is null)
|
if (selectedDragonId is null)
|
||||||
selectedDragonId = dragon.Viking.SelectedDragonId;
|
selectedDragonId = dragon.Viking.SelectedDragonId;
|
||||||
|
20
src/Schema/GameProgress.cs
Normal file
20
src/Schema/GameProgress.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace sodoff.Schema;
|
||||||
|
|
||||||
|
[XmlRoot(ElementName = "progress", Namespace = "")]
|
||||||
|
[Serializable]
|
||||||
|
public class GameProgress {
|
||||||
|
[XmlElement(ElementName = "name")]
|
||||||
|
public string Name;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "version")]
|
||||||
|
public string Version;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "chapter")]
|
||||||
|
public string[] Chapter;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "custom")]
|
||||||
|
public string? Custom;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user