From 528fb656d64bbb88fff2da8da48ed905bdbe58ff Mon Sep 17 00:00:00 2001 From: Richard Marcus <richard.marcus@fau.de> Date: Thu, 3 Sep 2020 22:37:38 +0200 Subject: [PATCH] some tests --- Assets/RenderedScrollFact.cs | 24 ++ Assets/RenderedScrollFact.cs.meta | 11 + .../Prefabs/ScrollParameterDisplay.prefab | 2 +- Assets/Scenes/TreeWorld_02.unity | 2 +- Assets/Scripts/InventoryStuff/DropHandling.cs | 4 +- .../Scripts/InventoryStuff/ScrollDetails.cs | 3 +- Assets/scrolls.json | 248 ++++++++++++++++++ Assets/scrolls.json.meta | 7 + 8 files changed, 296 insertions(+), 5 deletions(-) create mode 100644 Assets/RenderedScrollFact.cs create mode 100644 Assets/RenderedScrollFact.cs.meta create mode 100644 Assets/scrolls.json create mode 100644 Assets/scrolls.json.meta diff --git a/Assets/RenderedScrollFact.cs b/Assets/RenderedScrollFact.cs new file mode 100644 index 00000000..016386a0 --- /dev/null +++ b/Assets/RenderedScrollFact.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; + +public class RenderedScrollFact : MonoBehaviour +{ + + public int ID; + public TextMeshProUGUI LabelMesh; + private string _label; + + public string Label + { + get { return _label; } + set + { + if (_label == value) return; + _label = value; + LabelMesh.text = value; + } + } + +} diff --git a/Assets/RenderedScrollFact.cs.meta b/Assets/RenderedScrollFact.cs.meta new file mode 100644 index 00000000..ab23f7d4 --- /dev/null +++ b/Assets/RenderedScrollFact.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93aede1a33263ef44a354960618fe997 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab b/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab index e7656111..2d5b7830 100644 --- a/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab +++ b/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab @@ -9,7 +9,7 @@ MonoBehaviour: m_GameObject: {fileID: 1288409225757860898} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f459496b7a023cb4c849ddddad2c3fc0, type: 3} + m_Script: {fileID: 11500000, guid: 93aede1a33263ef44a354960618fe997, type: 3} m_Name: m_EditorClassIdentifier: ID: 0 diff --git a/Assets/Scenes/TreeWorld_02.unity b/Assets/Scenes/TreeWorld_02.unity index d0c1c548..9c12ecad 100644 --- a/Assets/Scenes/TreeWorld_02.unity +++ b/Assets/Scenes/TreeWorld_02.unity @@ -41107,7 +41107,7 @@ PrefabInstance: - target: {fileID: 2089306640899292912, guid: 4d99275c6663c25469ad3b65efcd4f5f, type: 3} propertyPath: m_AnchoredPosition.y - value: -0.000005722046 + value: -0.0004994295 objectReference: {fileID: 0} - target: {fileID: 2524590709578595355, guid: 4d99275c6663c25469ad3b65efcd4f5f, type: 3} diff --git a/Assets/Scripts/InventoryStuff/DropHandling.cs b/Assets/Scripts/InventoryStuff/DropHandling.cs index cea2c811..a6a396f0 100644 --- a/Assets/Scripts/InventoryStuff/DropHandling.cs +++ b/Assets/Scripts/InventoryStuff/DropHandling.cs @@ -9,7 +9,7 @@ public class DropHandling : MonoBehaviour, IDropHandler public Fact currentFact; public void OnDrop(PointerEventData eventData){ - var scrollFact = gameObject.GetComponent<ScrollFact>(); + var scrollFact = gameObject.GetComponent<RenderedScrollFact>(); Debug.Log(eventData.pointerDrag.GetComponent<FactWrapper>().fact.Label+ " was dropped on " + gameObject.name+ " " +scrollFact.ID + "/" + ScrollDetails.ParameterDisplays.Count+" label: "+scrollFact.Label); @@ -37,7 +37,7 @@ public void OnDrop(PointerEventData eventData){ // and also in facts else { - var affectedFact = ScrollDetails.ParameterDisplays[id.Key].GetComponentInChildren<ScrollFact>(); + var affectedFact = ScrollDetails.ParameterDisplays[id.Key].GetComponentInChildren<RenderedScrollFact>(); string label = affectedFact.Label; label = label.Remove(id.Value, 1); label = label.Insert(id.Value, scrollFact.Label); diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs index ac384d11..686c963c 100644 --- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs +++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs @@ -63,7 +63,8 @@ public void setScroll(Scroll s) { var obj = Instantiate(parameterDisplayPrefab, Vector3.zero, Quaternion.identity, transform); - var scrollFact = obj.transform.GetChild(0).GetComponent<ScrollFact>(); + var scrollFact = obj.transform.GetChild(0).GetComponent<RenderedScrollFact>(); + scrollFact.ID = i; //obj.GetComponent<RectTransform>().localPosition = GetPosition(i); scrollFact.Label = Scroll.ParseString(i,s.requiredFacts[i].label,s.requiredFacts); diff --git a/Assets/scrolls.json b/Assets/scrolls.json new file mode 100644 index 00000000..adfe310e --- /dev/null +++ b/Assets/scrolls.json @@ -0,0 +1,248 @@ +[ + { + "problemTheory": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem", + "solutionTheory": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Solution", + "label": "OppositeLen", + "description": "Given a triangle $0$1$2 right angled at $2, the distance $0$1 can be computed from the angle at $1 and the distance $1$2", + "requiredFacts": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pA", + "label": "a", + "tp": { + "original": { + "uri": "http://mathhub.info/MitM/core/geometry?3DGeometry?point", + "kind": "OMS" + }, + "simplified": { + "uri": "http://mathhub.info/MitM/core/geometry?3DGeometry?point", + "kind": "OMS" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "label": "b", + "tp": { + "original": { + "uri": "http://mathhub.info/MitM/core/geometry?3DGeometry?point", + "kind": "OMS" + }, + "simplified": { + "uri": "http://mathhub.info/MitM/core/geometry?3DGeometry?point", + "kind": "OMS" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "label": "c", + "tp": { + "original": { + "uri": "http://mathhub.info/MitM/core/geometry?3DGeometry?point", + "kind": "OMS" + }, + "simplified": { + "uri": "http://mathhub.info/MitM/core/geometry?3DGeometry?point", + "kind": "OMS" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pdistBC_v", + "label": "pdist$1$2_v", + "tp": { + "original": { + "uri": "http://mathhub.info/MitM/Foundation?RealLiterals?real_lit", + "kind": "OMS" + }, + "simplified": { + "uri": "http://mathhub.info/MitM/Foundation?RealLiterals?real_lit", + "kind": "OMS" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pdistBC", + "label": "pdistt$1$2", + "tp": { + "original": { + "applicant": { + "uri": "http://mathhub.info/FrameIT/frameworld?DistanceFact?distanceFact", + "kind": "OMS" + }, + "arguments": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pdistBC_v", + "kind": "OMS" + } + ], + "kind": "OMA" + }, + "simplified": { + "applicant": { + "uri": "http://mathhub.info/FrameIT/frameworld?DistanceFact?distanceFact", + "kind": "OMS" + }, + "arguments": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pdistBC_v", + "kind": "OMS" + } + ], + "kind": "OMA" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pangleABC_v", + "label": "pangleAt$0$1$2_v", + "tp": { + "original": { + "uri": "http://mathhub.info/MitM/Foundation?RealLiterals?real_lit", + "kind": "OMS" + }, + "simplified": { + "uri": "http://mathhub.info/MitM/Foundation?RealLiterals?real_lit", + "kind": "OMS" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pangleABC", + "label": "pangle$0$1$2", + "tp": { + "original": { + "applicant": { + "uri": "http://mathhub.info/FrameIT/frameworld?AngleFact?angleFact", + "kind": "OMS" + }, + "arguments": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pA", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pangleABC_v", + "kind": "OMS" + } + ], + "kind": "OMA" + }, + "simplified": { + "applicant": { + "uri": "http://mathhub.info/FrameIT/frameworld?AngleFact?angleFact", + "kind": "OMS" + }, + "arguments": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pA", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pangleABC_v", + "kind": "OMS" + } + ], + "kind": "OMA" + } + }, + "df": null + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pangleBCA", + "label": "pangle$1$2$0", + "tp": { + "original": { + "applicant": { + "uri": "http://mathhub.info/FrameIT/frameworld?AngleFact?angleFact", + "kind": "OMS" + }, + "arguments": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pA", + "kind": "OMS" + }, + { + "float": 90.0, + "kind": "OMF" + } + ], + "kind": "OMA" + }, + "simplified": { + "applicant": { + "uri": "http://mathhub.info/FrameIT/frameworld?AngleFact?angleFact", + "kind": "OMS" + }, + "arguments": [ + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pB", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pC", + "kind": "OMS" + }, + { + "uri": "http://mathhub.info/FrameIT/frameworld?OppositeLen_Problem?pA", + "kind": "OMS" + }, + { + "float": 90.0, + "kind": "OMF" + } + ], + "kind": "OMA" + } + }, + "df": null + } + ] + } +] \ No newline at end of file diff --git a/Assets/scrolls.json.meta b/Assets/scrolls.json.meta new file mode 100644 index 00000000..076ba2dd --- /dev/null +++ b/Assets/scrolls.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4069fe7e4a7672e47834935275b3aa8c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: -- GitLab