Skip to content
Snippets Groups Projects
Commit d38e73bc authored by Benjamin Bösl's avatar Benjamin Bösl
Browse files

started glueing it together

parent 55ad66d0
No related branches found
No related tags found
No related merge requests found
Showing with 1480 additions and 207 deletions
......@@ -4,6 +4,7 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.Networking;
public class DisplayScrolls : MonoBehaviour
{
......@@ -47,32 +48,52 @@ public Vector3 GetPosition(int i)
[System.Serializable]
class ScrollArrayWrapper{
public Scroll[] scrolls;
public Scroll[] Scrolls;
};
// Start is called before the first frame update
void Start()
{
//get Scrolls from Backend;
//TODO REST-Call instead of Json-File
string path = "Mock-Scrolls.json";
string jsonString = File.ReadAllText(path);
//string path = "Mock-Scrolls.json";
//string jsonString = File.ReadAllText(path);
//buildScrollSelection(jsonString);
StartCoroutine(getScrollsfromServer());
}
IEnumerator getScrollsfromServer() {
UnityWebRequest request = UnityWebRequest.Get("localhost:8081/scroll/list");
yield return request.Send();
if (request.isNetworkError || request.isHttpError)
{
Debug.LogError(request.error);
}
else
{
string jsonString = request.downloadHandler.text;
buildScrollSelection(jsonString);
}
}
void buildScrollSelection(string jsonString) {
jsonString = jsonString.Replace(System.Environment.NewLine, "");
jsonString = jsonString.Replace("\t", "");
jsonString = jsonString.Replace("\t", "");
ScrollArrayWrapper scrollsRead = new ScrollArrayWrapper();
scrollsRead = (ScrollArrayWrapper)JsonUtility.FromJson(jsonString, scrollsRead.GetType());
this.scrolls = scrollsRead.scrolls;
this.scrolls = scrollsRead.Scrolls;
//Build Selection-GUI of Scrolls
for (int i = 0; i < this.scrolls.Length; i++) {
for (int i = 0; i < this.scrolls.Length; i++)
{
var obj = Instantiate(ScrollPrefab, Vector3.zero, Quaternion.identity, transform);
obj.GetComponent<RectTransform>().localPosition = GetPosition(i);
obj.GetComponent<ScrollClickedScript>().scroll = this.scrolls[i];
obj.GetComponent<ScrollClickedScript>().DetailScreen = this.DetailScreen;
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = this.scrolls[i].label;
}
}
}
......@@ -6,15 +6,17 @@
public class DropHandling : MonoBehaviour, IDropHandler
{
GameObject current;
public Fact currentFact;
public void OnDrop(PointerEventData eventData){
Debug.Log(eventData.pointerDrag + "was dropped on "+ gameObject.name);
Destroy(current);
current = Instantiate(eventData.pointerDrag,Vector3.zero, Quaternion.identity);
current.transform.SetParent(gameObject.transform, false);
GameObject scrollShow = gameObject.transform.parent.gameObject;
PythagorasScript pythagorasScript = scrollShow.GetComponent<PythagorasScript>();
//PythagorasScript pythagorasScript = scrollShow.GetComponent<PythagorasScript>();
var fact = ((FactWrapper)current.GetComponent<FactWrapper>()).fact;
pythagorasScript.putFact(gameObject.name, fact);
currentFact = fact;
//pythagorasScript.putFact(gameObject.name, fact);
}
}
fileFormatVersion: 2
guid: b543d9677cbde534ab69c0a229bfdb06
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 546b5a29afa8bd446ba254c04097d626
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: df10919d3230595438beac5071d21387
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -7,8 +7,10 @@
public class Declaration
{
public string name;
public string type;
public string isProof;
public string value;
public string identifier;
public string description;
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class ScrollDetails : MonoBehaviour
{
public GameObject ParameterDisplayPrefab;
public Scroll scroll;
public int x_Start;
public int y_Start;
public int y_Paece_Between_Items;
public GameObject[] ParameterDisplays;
public Vector3 GetPosition(int i)
{
return new Vector3(x_Start, y_Start + i * (-y_Paece_Between_Items ), 0f);
}
// Start is called before the first frame update
void Start()
{
......@@ -19,7 +32,21 @@ void Update()
}
public void setScroll(Scroll s) {
Transform scrollView = gameObject.transform.GetChild(2);
Transform viewport = scrollView.GetChild(0);
this.scroll = s;
Debug.Log(s);
//wipe out old Displays
for (int i = 0; i < this.ParameterDisplays.Length; i++) {
Destroy(ParameterDisplays[i]);
}
this.ParameterDisplays = new GameObject[s.declarations.Length];
for (int i = 0; i < s.declarations.Length; i++) {
var obj = Instantiate(ParameterDisplayPrefab, Vector3.zero, Quaternion.identity, transform);
obj.GetComponent<RectTransform>().localPosition = GetPosition(i);
obj.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = s.declarations[i].description;
obj.transform.SetParent(viewport);
this.ParameterDisplays[i] = obj;
}
gameObject.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = s.description;
}
}
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8260792079148133554
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7249550241351237421}
- component: {fileID: 3905790850577996765}
- component: {fileID: 1086451024575209643}
- component: {fileID: 5677314046188869628}
m_Layer: 5
m_Name: ScollFactContainer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7249550241351237421
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8260792079148133554}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 69.99997, y: -550.69995}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3905790850577996765
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8260792079148133554}
m_CullTransparentMesh: 0
--- !u!114 &1086451024575209643
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8260792079148133554}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.15233111, b: 0.9245283, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &5677314046188869628
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8260792079148133554}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 714c3b3ded45aea408421f43873d5e17, type: 3}
m_Name:
m_EditorClassIdentifier:
fileFormatVersion: 2
guid: 1a3d2b3a09e7aa64ab57b0867d3b2307
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2471407562246470327
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1849754688620646696}
- component: {fileID: 285901310428644593}
- component: {fileID: 7220552148984218067}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1849754688620646696
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2471407562246470327}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8358525157842135573}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.00001, y: 0.000011444}
m_SizeDelta: {x: 430, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &285901310428644593
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2471407562246470327}
m_CullTransparentMesh: 0
--- !u!114 &7220552148984218067
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2471407562246470327}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Parameter Description
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 1
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 24
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_VertexBufferAutoSizeReduction: 1
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 2.959988, w: 0}
m_textInfo:
textComponent: {fileID: 7220552148984218067}
characterCount: 21
spriteCount: 0
spaceCount: 1
wordCount: 2
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &8358525157842135574
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8358525157842135573}
- component: {fileID: 8358525157842135579}
- component: {fileID: 8358525157842135572}
m_Layer: 5
m_Name: ScrollParameterDisplay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8358525157842135573
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8358525157842135574}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 567154989861468093}
- {fileID: 1849754688620646696}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -70}
m_SizeDelta: {x: 540, y: 120}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8358525157842135579
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8358525157842135574}
m_CullTransparentMesh: 0
--- !u!114 &8358525157842135572
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8358525157842135574}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9056604, g: 0.8992144, b: 0.004271993, a: 0.21568628}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!1001 &7153233524418283664
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 8358525157842135573}
m_Modifications:
- target: {fileID: 8260792079148133554, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_Name
value: ScollFactContainer
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 60
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -60
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_SizeDelta.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_SizeDelta.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3}
--- !u!224 &567154989861468093 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307,
type: 3}
m_PrefabInstance: {fileID: 7153233524418283664}
m_PrefabAsset: {fileID: 0}
fileFormatVersion: 2
guid: 0651df442e07acf439dd439c86c20e93
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
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