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 @@
using System;
using UnityEngine;
using static JSONManager;
using JsonSubTypes;
using Newtonsoft.Json;
......@@ -43,21 +44,16 @@ public class Scroll : LightScroll
public string label;
public string description;
public List<ScrollFact> requiredFacts;
public List<ScrollFact> acquiredFacts;
public static List<Scroll> FromJSON(string json)
{
List<Scroll> scrolls = JsonConvert.DeserializeObject<List<Scroll>>(json, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
List<Scroll> scrolls = JsonConvert.DeserializeObject<List<Scroll>>(json);
return scrolls;
}
public static string ToJSON(FilledScroll scroll)
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(scroll, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
string json = Newtonsoft.Json.JsonConvert.SerializeObject(scroll);
return json;
}
......@@ -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 string uri;
public string kind;
public UriReference @ref;
public string label;
}
public class UriReference
{
public string uri;
}
/**
* Class used for deserializing incoming symbol-declarations from mmt
*/
......@@ -164,6 +167,11 @@ public class ScrollValueFact : ScrollFact
}
public class LightScroll
{
public ScrollTheoryReference @ref;
}
public class ScrollTheoryReference
{
public string problemTheory;
public string solutionTheory;
......
......@@ -316,8 +316,8 @@ public bool isAngle()
private string pushout(string view)
{
string path = "localhost:8081/pushout?";
path = path + "problem=" + this.scroll.problemTheory + "&";
path = path + "solution=" + this.scroll.solutionTheory + "&";
path = path + "problem=" + this.scroll.@ref.problemTheory + "&";
path = path + "solution=" + this.scroll.@ref.solutionTheory + "&";
path = path + "view=" + view;
UnityWebRequest www = UnityWebRequest.Get(path);
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