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

Making Pushout- and newAssignment-Routines non-blocking

parent 2be92d26
No related branches found
No related tags found
No related merge requests found
...@@ -41258,6 +41258,11 @@ PrefabInstance: ...@@ -41258,6 +41258,11 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 4004370943283418989, guid: c1d50ceff6c06de40b71063574eba754,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: magicButtonTrigger
objectReference: {fileID: 0}
- target: {fileID: 8372521933580734050, guid: c1d50ceff6c06de40b71063574eba754, - target: {fileID: 8372521933580734050, guid: c1d50ceff6c06de40b71063574eba754,
type: 3} type: 3}
propertyPath: m_AnchorMax.x propertyPath: m_AnchorMax.x
...@@ -50,6 +50,7 @@ void Update() ...@@ -50,6 +50,7 @@ void Update()
} }
/* /*
//Todo before capturing: Make directories "UFrameIT-Screenshots/Unity_ScreenCapture" in project folder
else if (Input.GetKeyDown(ScreenshotKey)) { else if (Input.GetKeyDown(ScreenshotKey)) {
ScreenCapture.CaptureScreenshot("UFrameIT-Screenshots\\Unity_ScreenCapture\\Capture.png"); ScreenCapture.CaptureScreenshot("UFrameIT-Screenshots\\Unity_ScreenCapture\\Capture.png");
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
using static JSONManager; using static JSONManager;
using static FactManager;
public class ParsingDictionary { public class ParsingDictionary {
......
using System.Collections.Generic; using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using TMPro; using TMPro;
using UnityEngine.Networking; using UnityEngine.Networking;
...@@ -30,7 +31,7 @@ void Start() ...@@ -30,7 +31,7 @@ void Start()
parameterDisplayHint.AddListener(animateScrollParameter); parameterDisplayHint.AddListener(animateScrollParameter);
CompletionsHintEvent.AddListener(animateCompletionsHint); CompletionsHintEvent.AddListener(animateCompletionsHint);
NewAssignmentEvent.AddListener(newAssignment); NewAssignmentEvent.AddListener(newAssignmentTrigger);
} }
public void setScroll(Scroll s) public void setScroll(Scroll s)
...@@ -61,33 +62,64 @@ public void setScroll(Scroll s) ...@@ -61,33 +62,64 @@ public void setScroll(Scroll s)
} }
} }
public void magicButton() public void magicButtonTrigger() {
StartCoroutine(magicButton());
}
IEnumerator magicButton()
{ {
string answer = sendView("/scroll/apply"); bool workDone = false;
if (answer == null) while (!workDone)
{ {
Debug.Log("DAS HAT NICHT GEKLAPPT"); // Let the engine run for a frame for not letting the game freeze
//TODO: hier ne Art PopUp, wo drin steht, dass das nicht geklappt hat yield return null;
PushoutFactFailEvent.Invoke(null);
return; string answer = sendView("/scroll/apply");
if (answer == null)
{
Debug.Log("DAS HAT NICHT GEKLAPPT");
//TODO: hier ne Art PopUp, wo drin steht, dass das nicht geklappt hat
PushoutFactFailEvent.Invoke(null);
}
else
{
Scroll.ScrollApplicationInfo pushout = JsonConvert.DeserializeObject<Scroll.ScrollApplicationInfo>(answer);
readPushout(pushout.acquiredFacts);
}
workDone = true;
} }
}
Scroll.ScrollApplicationInfo pushout = JsonConvert.DeserializeObject<Scroll.ScrollApplicationInfo>(answer); public void newAssignmentTrigger() {
readPushout(pushout.acquiredFacts); StartCoroutine(newAssignment());
} }
public void newAssignment() IEnumerator newAssignment()
{ {
string answer = sendView("/scroll/dynamic"); bool workDone = false;
if (answer == null) while (!workDone)
{ {
Debug.Log("DAS HAT NICHT GEKLAPPT"); // Let the engine run for a frame for not letting the game freeze
return; yield return null;
string answer = sendView("/scroll/dynamic");
if (answer == null)
{
Debug.Log("DAS HAT NICHT GEKLAPPT");
}
else
{
Scroll.ScrollDynamicInfo scrollDynamicInfo = JsonConvert.DeserializeObject<Scroll.ScrollDynamicInfo>(answer);
processScrollDynamicInfo(scrollDynamicInfo);
}
workDone = true;
} }
Scroll.ScrollDynamicInfo scrollDynamicInfo = JsonConvert.DeserializeObject<Scroll.ScrollDynamicInfo>(answer);
processScrollDynamicInfo(scrollDynamicInfo);
} }
private string sendView(string endpoint) private string sendView(string endpoint)
......
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