Skip to content
Snippets Groups Projects
Commit 5a783cf4 authored by John Schihada's avatar John Schihada
Browse files

Fetching Scrolls works again

parent d13292b8
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using System; using System;
using UnityEngine; using UnityEngine;
using static JSONManager; using static JSONManager;
using JsonSubTypes;
using Newtonsoft.Json; using Newtonsoft.Json;
...@@ -43,21 +44,16 @@ public class Scroll : LightScroll ...@@ -43,21 +44,16 @@ public class Scroll : LightScroll
public string label; public string label;
public string description; public string description;
public List<ScrollFact> requiredFacts; public List<ScrollFact> requiredFacts;
public List<ScrollFact> acquiredFacts;
public static List<Scroll> FromJSON(string json) public static List<Scroll> FromJSON(string json)
{ {
List<Scroll> scrolls = JsonConvert.DeserializeObject<List<Scroll>>(json, new JsonSerializerSettings List<Scroll> scrolls = JsonConvert.DeserializeObject<List<Scroll>>(json);
{
TypeNameHandling = TypeNameHandling.Auto
});
return scrolls; return scrolls;
} }
public static string ToJSON(FilledScroll scroll) public static string ToJSON(FilledScroll scroll)
{ {
string json = Newtonsoft.Json.JsonConvert.SerializeObject(scroll, new JsonSerializerSettings string json = Newtonsoft.Json.JsonConvert.SerializeObject(scroll);
{
TypeNameHandling = TypeNameHandling.Auto
});
return json; return json;
} }
...@@ -133,14 +129,21 @@ public FilledScroll(LightScroll scroll, List<ScrollAssignment> assignments) ...@@ -133,14 +129,21 @@ public FilledScroll(LightScroll scroll, List<ScrollAssignment> assignments)
} }
[JsonConverter(typeof(JsonSubtypes), "kind")]
[JsonSubtypes.KnownSubType(typeof(ScrollSymbolFact), "general")]
[JsonSubtypes.KnownSubType(typeof(ScrollValueFact), "veq")]
public class ScrollFact public class ScrollFact
{ {
public string uri;
public string kind; public string kind;
public UriReference @ref;
public string label; public string label;
} }
public class UriReference
{
public string uri;
}
/** /**
* Class used for deserializing incoming symbol-declarations from mmt * Class used for deserializing incoming symbol-declarations from mmt
*/ */
...@@ -164,6 +167,11 @@ public class ScrollValueFact : ScrollFact ...@@ -164,6 +167,11 @@ public class ScrollValueFact : ScrollFact
} }
public class LightScroll public class LightScroll
{
public ScrollTheoryReference @ref;
}
public class ScrollTheoryReference
{ {
public string problemTheory; public string problemTheory;
public string solutionTheory; public string solutionTheory;
......
...@@ -316,8 +316,8 @@ public bool isAngle() ...@@ -316,8 +316,8 @@ public bool isAngle()
private string pushout(string view) private string pushout(string view)
{ {
string path = "localhost:8081/pushout?"; string path = "localhost:8081/pushout?";
path = path + "problem=" + this.scroll.problemTheory + "&"; path = path + "problem=" + this.scroll.@ref.problemTheory + "&";
path = path + "solution=" + this.scroll.solutionTheory + "&"; path = path + "solution=" + this.scroll.@ref.solutionTheory + "&";
path = path + "view=" + view; path = path + "view=" + view;
UnityWebRequest www = UnityWebRequest.Get(path); UnityWebRequest www = UnityWebRequest.Get(path);
var async = www.Send(); var async = www.Send();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment