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:
m_Modification:
m_TransformParent: {fileID: 0}
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,
type: 3}
propertyPath: m_AnchorMax.x
......@@ -50,6 +50,7 @@ void Update()
}
/*
//Todo before capturing: Make directories "UFrameIT-Screenshots/Unity_ScreenCapture" in project folder
else if (Input.GetKeyDown(ScreenshotKey)) {
ScreenCapture.CaptureScreenshot("UFrameIT-Screenshots\\Unity_ScreenCapture\\Capture.png");
}
......
......@@ -3,7 +3,6 @@
using UnityEngine;
using UnityEngine.Networking;
using static JSONManager;
using static FactManager;
public class ParsingDictionary {
......
using System.Collections.Generic;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.Networking;
......@@ -30,7 +31,7 @@ void Start()
parameterDisplayHint.AddListener(animateScrollParameter);
CompletionsHintEvent.AddListener(animateCompletionsHint);
NewAssignmentEvent.AddListener(newAssignment);
NewAssignmentEvent.AddListener(newAssignmentTrigger);
}
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");
if (answer == null)
bool workDone = false;
while (!workDone)
{
Debug.Log("DAS HAT NICHT GEKLAPPT");
//TODO: hier ne Art PopUp, wo drin steht, dass das nicht geklappt hat
PushoutFactFailEvent.Invoke(null);
return;
// Let the engine run for a frame for not letting the game freeze
yield return null;
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);
readPushout(pushout.acquiredFacts);
public void newAssignmentTrigger() {
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");
return;
// Let the engine run for a frame for not letting the game freeze
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)
......
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