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

Adjustments for fetching scrolls

parent e43aad57
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,8 @@ void Start()
IEnumerator getScrollsfromServer() {
UnityWebRequest request = UnityWebRequest.Get(CommunicationEvents.ServerAdress + "/scroll/list");
//Postman-Echo-Mock
//UnityWebRequest request = UnityWebRequest.Get("https://019a8ea5-843a-498b-8d0c-778669aef987.mock.pstmn.io/get");
request.method = UnityWebRequest.kHttpVerbGET;
yield return request.Send();
if (request.isNetworkError || request.isHttpError)
......
......@@ -3,6 +3,8 @@
using System.Linq;
using System;
using UnityEngine;
using static JSONManager;
using Newtonsoft.Json;
/*
......@@ -44,12 +46,18 @@ public class Scroll : LightScroll
public static List<Scroll> FromJSON(string json)
{
List<Scroll> scrolls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scroll>>(json);
List<Scroll> scrolls = JsonConvert.DeserializeObject<List<Scroll>>(json, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
return scrolls;
}
public static string ToJSON(FilledScroll scroll)
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(scroll);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(scroll, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
return json;
}
......@@ -129,15 +137,28 @@ public FilledScroll(LightScroll scroll, List<ScrollAssignment> assignments)
public class ScrollFact
{
public string uri;
public string kind;
public string label;
public FactBody tp;
public JSONManager.MMTTerm df;
}
public class FactBody
/**
* Class used for deserializing incoming symbol-declarations from mmt
*/
public class ScrollSymbolFact : ScrollFact
{
public MMTTerm tp;
public MMTTerm df;
}
/**
* Class used for deserializing incoming value-declarations from mmt
*/
public class ScrollValueFact : ScrollFact
{
public JSONManager.MMTTerm original;
public JSONManager.MMTTerm simplified;
MMTTerm lhs;
MMTTerm valueTp;
MMTTerm value;
MMTTerm proof;
}
}
......
......@@ -94,7 +94,7 @@ public static string ToJson(MMTDeclaration mmtDecl)
/**
* MMTSymbolDeclaration: Class for facts without values, e.g. Points
**/
*/
public class MMTSymbolDeclaration : MMTDeclaration
{
public string kind = "general";
......@@ -102,6 +102,9 @@ public class MMTSymbolDeclaration : MMTDeclaration
public MMTTerm tp;
public MMTTerm df;
/**
* Constructor used for sending new declarations to mmt
*/
public MMTSymbolDeclaration(string label, MMTTerm tp, MMTTerm df)
{
this.label = label;
......@@ -112,7 +115,7 @@ public MMTSymbolDeclaration(string label, MMTTerm tp, MMTTerm df)
/**
* MMTValueDeclaration: Class for facts with values, e.g. Distances or Angles
**/
*/
public class MMTValueDeclaration : MMTDeclaration
{
public string kind = "veq";
......@@ -121,6 +124,9 @@ public class MMTValueDeclaration : MMTDeclaration
public MMTTerm valueTp;
public MMTTerm value;
/**
* Constructor used for sending new declarations to mmt
*/
public MMTValueDeclaration(string label, MMTTerm lhs, MMTTerm valueTp, MMTTerm value)
{
this.label = label;
......
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