diff --git a/Assets/Scripts/GenerateDemoFiles.cs b/Assets/Scripts/GenerateDemoFiles.cs index 84f24afd7ba987ac02a302a617f84bedb7016f30..a8f37b3cd129d9869c89fcceeb29f2c6d6cc0ff1 100644 --- a/Assets/Scripts/GenerateDemoFiles.cs +++ b/Assets/Scripts/GenerateDemoFiles.cs @@ -235,7 +235,7 @@ public static void GenerateCanonBallStage() // Set Solution StageStatic.stage.solution.Add( // for CannonBallScroll - new ListFact(Walls.Select(w => w.Topology.Id).ToArray(), StageStatic.stage.solution), + new ListFact(Walls.Select(w => w.Topology.Id).ToArray(), typeof(LineFact), StageStatic.stage.solution), out bool _, true, null, null ); diff --git a/Assets/Scripts/GlobalBehaviour.cs b/Assets/Scripts/GlobalBehaviour.cs index 34f13735b0f4c31da3824dad884ae5b58615b276..ed37e62e5df5a0ac294392f0a3d6ebb9e34990c2 100644 --- a/Assets/Scripts/GlobalBehaviour.cs +++ b/Assets/Scripts/GlobalBehaviour.cs @@ -63,7 +63,7 @@ private void Start() //TODO: Move where appropiate public int tryScrollListTimes = 2; - static public List<Scroll> AvailableScrolls; + static public List<REST_JSON_API.Scroll> AvailableScrolls; private void PostServerConnection() { @@ -115,7 +115,7 @@ IEnumerator getScrollsfromServer() } System.DateTime startTime = System.DateTime.UtcNow; - AvailableScrolls = JsonConvert.DeserializeObject<List<Scroll>>(jsonString); + AvailableScrolls = JsonConvert.DeserializeObject<List<REST_JSON_API.Scroll>>(jsonString); Debug.Log("Scroll Parsing in: " + (System.DateTime.UtcNow - startTime).TotalMilliseconds + "ms"); } } diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index 94bede147666faa83d7ea399a347b354b92525ad..97ac16e2a03a08b1d2779d357cfb7bb5711f735f 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -1,10 +1,7 @@ using System.Collections.Generic; using System.Diagnostics; -using UnityEngine.Networking; using UnityEngine; using UnityEngine.Events; -using System; -using static Scroll; public static class CommunicationEvents { @@ -15,7 +12,7 @@ public static class CommunicationEvents public static UnityEvent<Fact> AddFactEvent = new(); public static UnityEvent<Fact> RemoveFactEvent = new(); - public static UnityEvent<ScrollApplicationCheckingError[]> ScrollApplicationCheckingErrorEvent = new(); + public static UnityEvent<REST_JSON_API.ScrollApplicationCheckingError[]> ScrollApplicationCheckingErrorEvent = new(); public static UnityEvent PushoutFactFailEvent = new(); public static UnityEvent gameSucceededEvent = new(); diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs index c73c0cebb1251bcbfea70ccf099854b1f43442fa..88daa87d03ba608470ecfa8966169cba76466f39 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs @@ -2,6 +2,7 @@ using TMPro; using UnityEngine; using UnityEngine.EventSystems; +using REST_JSON_API; using static CommunicationEvents; public class RenderedScrollFact : FactObjectUI, IDropHandler diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs index 36764b94f0dd1969b3cc7d745bef0f0a3e9b10da..54abdaf59a6f23b0cdb054d9c597f0895c816a82 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs @@ -5,8 +5,8 @@ using Newtonsoft.Json; using JsonSubTypes; using System.Linq; +using REST_JSON_API; using static SOMDocManager; -using static Scroll; public static class ParsingDictionary { @@ -479,7 +479,7 @@ string _SendAdd(string path, string body)//, Action<string> uriCallback) answer = www.downloadHandler.text; } - UriReference res = JsonUtility.FromJson<UriReference>(answer); + FactReference res = JsonUtility.FromJson<FactReference>(answer); if (CommunicationEvents.VerboseURI) Debug.Log("Server added Fact:\n" + res.uri); @@ -2304,9 +2304,13 @@ public class ListFact : FactWrappedCRTP<ListFact> { public string[] lids; - //public string typeURI; - //[JsonIgnore] - //public Type type => MMT_OMS_URI.OMS_TO_TYPE[typeURI]; + public string typeURI; + [JsonIgnore] + public Type ListType + { + get => MMT_OMS_URI.OMS_TO_TYPE[typeURI]; + private set => typeURI = MMT_OMS_URI.TYPE_TO_OMS[value]; + } public ListFact() : base() @@ -2314,22 +2318,24 @@ public ListFact() : base() lids = new string[0]; } - public ListFact(string[] lids, FactOrganizer organizer) : base(organizer) + public ListFact(string[] lids, Type ListType, FactOrganizer organizer) : base(organizer) { this.lids = lids; + this.ListType = ListType; SendToMMT(); } - public ListFact(string[] lids, string backendURI, FactOrganizer organizer) : base(organizer) + public ListFact(string[] lids, string typeURI, string backendURI, FactOrganizer organizer) : base(organizer) { this.lids = lids; + this.typeURI = typeURI; _URI = backendURI; } protected override bool EquivalentWrapped(ListFact f1, ListFact f2) - => //f1.typeURI == f2.typeURI && - DependentFactsEquivalent(f1, f2); + => f1.typeURI == f2.typeURI + && DependentFactsEquivalent(f1, f2); public override bool HasDependentFacts => true; @@ -2339,20 +2345,27 @@ protected override string[] GetGetDependentFactIds() public override MMTDeclaration MakeMMTDeclaration() { - OMA List = SOMDoc.MakeList(lids, typeof(OMS)); + OMA List = SOMDoc.MakeList(lids, typeURI); return new MMTSymbolDeclaration(Label, List.applicant, List.applicant); } public static new ListFact parseFact(MMTDeclaration fact) - => new(parseFactList(fact).ToArray(), fact.@ref.uri, StageStatic.stage.factState); + => new(parseFactList(fact, out string typeURI).ToArray(), typeURI, fact.@ref.uri, StageStatic.stage.factState); - public static List<string> parseFactList(MMTDeclaration decl) + public static List<string> parseFactList(MMTDeclaration decl, out string typeURI) { - if (decl is not MMTSymbolDeclaration mMTSymbol) + if (decl is not MMTSymbolDeclaration MMTSymbol + || MMTSymbol.type is not OMA listOMA + || listOMA.arguments[0] is not OMS typeOMS) + { + typeURI = null; return null; + } + + typeURI = typeOMS.uri; List<string> ret = new(); - SOMDoc next_element = mMTSymbol.defines; + SOMDoc next_element = MMTSymbol.defines; while (true) { if (next_element is not OMA current_element) diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs index fda444e3f235e258e187577c180cf27182aac892..5653ce4eef2b6b5ea63a9b615864f374e3efe6df 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using UnityEngine; using Newtonsoft.Json; -using static SOMDocManager; using System.Linq.Expressions; using System.Linq; +using static SOMDocManager; public class FunctionCallFact : FactWrappedCRTP<FunctionCallFact> { @@ -220,7 +220,7 @@ public AttachedPositionFunction(string fid, string func_calls_list_id, FactOrgan private void init(string fid, string[] funcids, FactOrganizer organizer) { this.fid = fid; - func_calls_list_id = organizer.Add(new ListFact(funcids, organizer), out bool _, false, null, null); + func_calls_list_id = organizer.Add(new ListFact(funcids, typeof(FunctionCallFact), organizer), out bool _, false, null, null); } private void init(string fid, string func_calls_list_id) diff --git a/Assets/Scripts/InteractionEngine/ShinyThings.cs b/Assets/Scripts/InteractionEngine/ShinyThings.cs index 8701d50dd72bdaa3f852e355199bdf2a1f4e64b2..cf48d1f6545635e6af39586bd17b980a8613997d 100644 --- a/Assets/Scripts/InteractionEngine/ShinyThings.cs +++ b/Assets/Scripts/InteractionEngine/ShinyThings.cs @@ -3,7 +3,6 @@ using System.Linq; using UnityEngine; using static FactWrapper; -using static Scroll; public class ShinyThings : MonoBehaviour { diff --git a/Assets/Scripts/InventoryStuff/DisplayScrolls.cs b/Assets/Scripts/InventoryStuff/DisplayScrolls.cs index 0ed090552492633da98c24c666b47cc6875dbce3..175ba15072ff7c2b0a8d5625ad8ea4cc341662b2 100644 --- a/Assets/Scripts/InventoryStuff/DisplayScrolls.cs +++ b/Assets/Scripts/InventoryStuff/DisplayScrolls.cs @@ -7,7 +7,7 @@ public class DisplayScrolls : MonoBehaviour { public string preferredStartScrollName; - static public List<Scroll> AllowedScrolls; + static public List<REST_JSON_API.Scroll> AllowedScrolls; public GameObject[] ScrollButtons; public GameObject ScrollPrefab; public GameObject DetailScreen; @@ -24,7 +24,7 @@ void BuildScrollGUI() while (GlobalBehaviour.AvailableScrolls == null) ; // active wait for server, should be rare AllowedScrolls = GlobalBehaviour.AvailableScrolls - .Where(s => StageStatic.stage.AllowedScrolls?.Contains(s.@ref) ?? true) + .Where(s => StageStatic.stage.AllowedScrolls?.Contains(s.ScrollReference) ?? true) .ToList(); //Build Selection-GUI of Scrolls @@ -38,7 +38,7 @@ void BuildScrollGUI() ScrollButtons[i] = obj; } - Scroll preferredStartScroll = AllowedScrolls.Find(x => x.label.Equals(preferredStartScrollName)); + REST_JSON_API.Scroll preferredStartScroll = AllowedScrolls.Find(x => x.label.Equals(preferredStartScrollName)); if (preferredStartScroll != null) this.DetailScreen.GetComponent<ScrollDetails>().SetScroll(preferredStartScroll); } diff --git a/Assets/Scripts/InventoryStuff/Scroll.cs b/Assets/Scripts/InventoryStuff/Scroll.cs index f1336a6e295d57fdb30acb5a99a95de40294ab92..b5ff5a9dbf512ea926594e7fae8e04a503c6d400 100644 --- a/Assets/Scripts/InventoryStuff/Scroll.cs +++ b/Assets/Scripts/InventoryStuff/Scroll.cs @@ -2,79 +2,150 @@ using System.Collections.Generic; using static SOMDocManager; - -public class Scroll +/// <summary> +/// Implements REST/JSON API +/// </summary> +/// <seealso href="https://github.com/UniFormal/MMT/tree/devel/src/frameit-mmt#rest-api"/> +namespace REST_JSON_API { - public string @ref; - public string label; - public string description; - public List<MMTDeclaration> requiredFacts; - public List<MMTDeclaration> acquiredFacts; - - public class FilledScroll + public class ScrollApplicationInfo { - public string scroll; - public List<ScrollAssignment> assignments; + /// <remarks>Invariant: <see cref="valid"/> == <c>false</c> => <see cref="errors"/><c>.Length > 0</c></remarks> + [JsonProperty("valid")] + public bool valid; - public FilledScroll(string scroll, List<ScrollAssignment> assignments) - { - this.scroll = scroll; - this.assignments = assignments; - } + [JsonProperty("errors")] + public ScrollApplicationCheckingError[] errors; + + [JsonProperty("acquiredFacts")] + public List<MMTDeclaration> acquiredFacts; } - public class ScrollTheoryReference + /// <summary>Response to "POST /scroll/dynamic" using <see cref="ScrollApplication"/></summary> + public class ScrollDynamicInfo { - public string problemTheory; - public string solutionTheory; + /// <summary>Contains the original scroll.</summary> + [JsonProperty("original")] + public Scroll original; + + /// <summary>All fact and scroll labels, all fact types, and all fact definitions are subject to being dynamically adapted to the (possibly utterly partial) scroll application.</summary> + /// <remarks>Contains <see cref="Scroll.requiredFacts"/> inferred/forward hints (A,B,C => °ABC)</remarks> + [JsonProperty("rendered")] + public Scroll rendered; + + /// <summary> + /// An array of scroll view completion suggestions for the yet missing assignments. + /// For instance, the first element of completions might be a list of some (possibly not all) of the yet missing assignments of the request's scroll view. + /// Analogously for the other elements of completions, if they exist. + /// It might happen that multiple mutually exclusive completions exist, hence the response contains an array of them. + /// </summary> + /// <remarks>Contains backwart hints (°ABC => A,B,C)</remarks> + [JsonProperty("completions")] + public List<List<ScrollAssignment>> backward_completions; + + /// <remarks>Invariant: <see cref="valid"/> == <c>false</c> => <see cref="errors"/><c>.Length > 0</c></remarks> + [JsonProperty("valid")] + public bool valid; + + [JsonProperty("errors")] + public ScrollApplicationCheckingError[] errors; } - public class UriReference + public class FactReference { + /// <summary>MMT URI</summary> + [JsonProperty("uri")] public string uri; - public UriReference(string uri) + public FactReference(string uri) { this.uri = uri; } } + public class Scroll + { + /// <summary>MMT URI to theory declaring the scroll</summary> + [JsonProperty("ref")] + public string ScrollReference; + + /// <summary>"some label"</summary> + [JsonProperty("label")] + public string label; + + /// <summary>"some description"</summary> + [JsonProperty("description")] + public string description; + + /// <summary>array of facts; facts that the scroll required you to give for scroll application</summary> + [JsonProperty("requiredFacts")] + public List<MMTDeclaration> requiredFacts; + + /// <summary>array of facts; facts that the scroll gives you upon successful scroll application</summary> + [JsonProperty("acquiredFacts")] + public List<MMTDeclaration> acquiredFacts; + } + public class ScrollAssignment { - public UriReference fact; - public OMS assignment; + [JsonProperty("fact")] + public FactReference fact; // Key + + [JsonProperty("assignment")] + public SOMDoc assignment; // Value [JsonConstructor] private ScrollAssignment() { } public ScrollAssignment(string fact_id, string assignment_id) { - this.fact = new UriReference(fact_id); + this.fact = new FactReference(fact_id); this.assignment = new OMS(assignment_id); } - } - public class ScrollApplicationInfo - { - public bool valid; - public ScrollApplicationCheckingError[] errors; - public List<MMTDeclaration> acquiredFacts; + public ScrollAssignment(string fact_id, SOMDoc assignment) + { + this.fact = new FactReference(fact_id); + this.assignment = assignment; + } } - public class ScrollDynamicInfo + public class ScrollApplication { - public Scroll original; - public Scroll rendered; - public List<List<ScrollAssignment>> completions; - public bool valid; - public ScrollApplicationCheckingError[] errors; + /// <summary>MMT URI to theory declaring the scroll</summary> + [JsonProperty("scroll")] + public string ScrollReference; + + [JsonProperty("assignments")] + public List<ScrollAssignment> assignments; + + public ScrollApplication(string scroll, List<ScrollAssignment> assignments) + { + this.ScrollReference = scroll; + this.assignments = assignments; + } } public class ScrollApplicationCheckingError { + /// <summary>"invalidAssignment" | "unknown"</summary> + /// <remarks>above list maybe incomplete</remarks> + [JsonProperty("kind")] public string kind; + + /// <summary>some human-readable message</summary> + [JsonProperty("msg")] public string msg; - public SOMDoc fact; + + /// <summary>a fact reference to the fact whose assignment was erroneous</summary> + [JsonProperty("fact")] + public FactReference fact; } + //TODO: Ist das Kunst oder kann das weg? + public class ScrollTheoryReference + { + public string problemTheory; + public string solutionTheory; + } } \ No newline at end of file diff --git a/Assets/Scripts/InventoryStuff/ScrollClickedScript.cs b/Assets/Scripts/InventoryStuff/ScrollClickedScript.cs index cec5e886ad35da6fe3571e41ea7374c4b679ba3b..50ee8f5cc4580e4a7731308fa8ddafee21525f2b 100644 --- a/Assets/Scripts/InventoryStuff/ScrollClickedScript.cs +++ b/Assets/Scripts/InventoryStuff/ScrollClickedScript.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using REST_JSON_API; +using UnityEngine; using UnityEngine.EventSystems; public class ScrollClickedScript : MonoBehaviour, IPointerDownHandler diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs index eda160c8dc6e3e4658786d609d739f4823392cc5..9edb464164f614e0be4c9de49dfd72166ac7cbea 100644 --- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs +++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs @@ -5,10 +5,9 @@ using UnityEngine.Networking; using Newtonsoft.Json; using System.Linq; +using REST_JSON_API; using static CommunicationEvents; using static SOMDocManager; -using System; -using static Scroll; public class ScrollDetails : MonoBehaviour { @@ -32,7 +31,7 @@ public static ScrollDetails Instance private PopupBehavior Popup; public static List<RenderedScrollFact> ParameterDisplays; - private static List<ScrollAssignment> LatestCompletions; + private static List<ScrollAssignment> LatestBackwartsCompletions; private static List<Fact> LatestRenderedHints; public string currentMmtAnswer; @@ -137,7 +136,7 @@ public bool SetNextEmptyTo(FactObjectUI activator) /// <returns><c>Array</c> containing indicis of <see cref="Scroll.requiredFacts"/> to be hidden.</returns> private int[] PrePopulateActiveScroll() { - switch (ActiveScroll.@ref) + switch (ActiveScroll.ScrollReference) { case MMT_OMS_URI.ScrollCannonBall: string lid_override = StageStatic.stage.solution.MyFactSpace.Values.FirstOrDefault(sol => sol is ListFact)?.Id; @@ -196,7 +195,7 @@ public void NewAssignmentTrigger() IEnumerator _NewAssignment() { - if(DynamicScrollInQue) + if (DynamicScrollInQue) yield break; // only need next in que to finish DynamicScrollInQue = true; @@ -278,7 +277,7 @@ string prepareScrollAssignments() assignmentList.Add(new ScrollAssignment(ActiveScroll.requiredFacts[i].@ref.uri, tempFact.Id)); } - return JsonConvert.SerializeObject(new FilledScroll(ActiveScroll.@ref, assignmentList)); + return JsonConvert.SerializeObject(new ScrollApplication(ActiveScroll.ScrollReference, assignmentList)); } } @@ -305,11 +304,11 @@ private void ReadPushout(List<MMTDeclaration> pushoutFacts) private void processScrollDynamicInfo(ScrollDynamicInfo scrollDynamicInfo) { - LatestCompletions = scrollDynamicInfo.completions.Count > 0 - ? scrollDynamicInfo.completions[0] + LatestBackwartsCompletions = scrollDynamicInfo.backward_completions.Count > 0 + ? scrollDynamicInfo.backward_completions[0] : new List<ScrollAssignment>(); - List<string> hintUris = LatestCompletions + List<string> hintUris = LatestBackwartsCompletions .Select(completion => completion.fact.uri) .ToList(); @@ -350,7 +349,7 @@ void _processRenderedScroll(Scroll rendered, List<string> hintUris) //If the fact could not be parsed -> Therefore not all dependent Facts exist -> No Hint if (HintFact != null) { - hintUris.Add(HintFact.Id); + hintUris.Add(HintFact.Id); // == rendered.requiredFacts[i].@ref.uri LatestRenderedHints.Add(HintFact); } } @@ -368,17 +367,17 @@ public void animateHint(string scrollParameterUri) FactWrapper.FactMaterials.Hint ); - Fact hintFact = LatestRenderedHints.Find(x => x.Id == scrollParameterUri); + Fact hintFact = LatestRenderedHints.Find(x => x.Id == scrollParameterUri); // "Dictionary" ScrollAssignment suitableCompletion = - LatestCompletions.Find(x => x.fact.uri == scrollParameterUri); + LatestBackwartsCompletions.Find((ScrollAssignment x) => x.fact.uri == scrollParameterUri); // "Dictionary" - if (suitableCompletion != null) + if (suitableCompletion != null && suitableCompletion.assignment is OMS assignment) { - if (FactOrganizer.AllFacts.ContainsKey(suitableCompletion.assignment.uri)) + if (FactOrganizer.AllFacts.ContainsKey(assignment.uri)) { AnimateExistingFactEvent.Invoke( - suitableCompletion.assignment.uri, + assignment.uri, FactWrapper.FactMaterials.Hint ); } diff --git a/Assets/Scripts/SOMDocManager.cs b/Assets/Scripts/SOMDocManager.cs index 117fb6611e2af0124fe18113b6efeafcf88b8e7e..a95fb543339bd041b8a2e8505fa3965458617971 100644 --- a/Assets/Scripts/SOMDocManager.cs +++ b/Assets/Scripts/SOMDocManager.cs @@ -6,8 +6,7 @@ using System.Linq; using MoreLinq; using UnityEngine; -using static Scroll; -using UnityEngine.Purchasing; +using REST_JSON_API; public static class SOMDocManager { @@ -53,14 +52,16 @@ public static class MMT_OMS_URI public static readonly string ParallelCircles = "http://mathhub.info/FrameIT/frameworld?FrameITCone?parallelCircles"; public static readonly string RightAngle = "http://mathhub.info/FrameIT/frameworld?FrameITBasics?rightAngle"; + public static readonly string AttachedPositionFunction = "0SET_IN_SOMDocManager!"; + public static readonly string FunctionCallFact = "1SET_IN_SOMDocManager!"; + public static readonly string FunctionFact = "2SET_IN_SOMDocManager!"; + public static readonly string TestType = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?xcircleType3D"; public static readonly string ListType = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?ListType"; public static readonly string ListLiteral = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?cons"; public static readonly string ListEnd = "http://gl.mathhub.info/MMT/LFX/Datatypes?ListSymbols?nil_constant"; - public static readonly string FactRef = "SET_IN_SOMDocManager!"; - public static readonly string Sin = "Sin"; public static readonly string Cos = "Cos"; public static readonly string Add = "Add"; @@ -131,9 +132,13 @@ public static class MMT_OMS_URI typeof(EqualCirclesFact) }, { UnEqualityCircles, typeof(UnEqualCirclesFact) }, + { FunctionFact, + typeof(FunctionFact) }, + { FunctionCallFact, + typeof(FunctionCallFact) }, + { AttachedPositionFunction, + typeof(AttachedPositionFunction) }, - { FactRef, - typeof(OMS) }, { RealLit, typeof(float) }, { Tuple, @@ -453,7 +458,6 @@ private static LambdaExpression Identity0(LambdaExpression[] lambda_applicant, L [JsonSubtypes.KnownSubType(typeof(OMC<Vector3>), "OMC<UnityEngine.Vector3>")] [JsonSubtypes.KnownSubType(typeof(OMC<float>), "OMC<System.Single>")] [JsonSubtypes.KnownSubType(typeof(OMC<double>), "OMC<System.Double>")] - [JsonSubtypes.FallBackSubType(typeof(OMS))] // dirty fix for wrong formated ScrollApplicationCheckingError.fact abstract public class SOMDoc { public string kind; @@ -863,7 +867,7 @@ public abstract class MMTDeclaration { public string kind; public string label; - public UriReference @ref; + public FactReference @ref; public static MMTDeclaration FromJson(string json) { diff --git a/Assets/Scripts/UI/InGame/PopupBehavior.cs b/Assets/Scripts/UI/InGame/PopupBehavior.cs index bf528da2bd147f840710446bc1a63c49a24a659e..1b0f699a3cfae1e42ba3142b29d4e00ba0f1661b 100644 --- a/Assets/Scripts/UI/InGame/PopupBehavior.cs +++ b/Assets/Scripts/UI/InGame/PopupBehavior.cs @@ -3,9 +3,8 @@ using UnityEngine; using TMPro; using UnityEngine.UI; -using System.Linq; +using REST_JSON_API; using static SOMDocManager; -using static Scroll; public class PopupBehavior : MonoBehaviour { @@ -148,6 +147,6 @@ private MMTDeclaration parseFactFromError(ScrollApplicationCheckingError error) //find the required fact in the active scroll thats invalidly assigned return ActiveScroll?.requiredFacts - .Find(decl => decl.@ref.uri == (error.fact as OMS).uri); + .Find(decl => decl.@ref.uri == error.fact.uri); } }