Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UFrameIT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FrameIT
UFrameIT
Commits
10f9e5bc
Commit
10f9e5bc
authored
4 years ago
by
John Schihada
Browse files
Options
Downloads
Patches
Plain Diff
Correctly adjusted Coroutine-workflow for newAssignments- and magicButton-Events
parent
4c7e5cf4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/InventoryStuff/ScrollDetails.cs
+29
-42
29 additions, 42 deletions
Assets/Scripts/InventoryStuff/ScrollDetails.cs
with
29 additions
and
42 deletions
Assets/Scripts/InventoryStuff/ScrollDetails.cs
+
29
−
42
View file @
10f9e5bc
...
@@ -19,6 +19,8 @@ public class ScrollDetails : MonoBehaviour
...
@@ -19,6 +19,8 @@ public class ScrollDetails : MonoBehaviour
public
static
List
<
GameObject
>
ParameterDisplays
;
public
static
List
<
GameObject
>
ParameterDisplays
;
private
static
List
<
Scroll
.
ScrollAssignment
>
LatestCompletions
;
private
static
List
<
Scroll
.
ScrollAssignment
>
LatestCompletions
;
public
string
currentMmtAnswer
;
public
Vector3
GetPosition
(
int
i
)
public
Vector3
GetPosition
(
int
i
)
{
{
return
new
Vector3
(
x_Start
,
y_Start
+
i
*
(-
y_Paece_Between_Items
),
0f
);
return
new
Vector3
(
x_Start
,
y_Start
+
i
*
(-
y_Paece_Between_Items
),
0f
);
...
@@ -68,28 +70,19 @@ public void magicButtonTrigger() {
...
@@ -68,28 +70,19 @@ public void magicButtonTrigger() {
IEnumerator
magicButton
()
IEnumerator
magicButton
()
{
{
bool
workDone
=
false
;
//Non blocking wait till sendView() is finished
yield
return
sendView
(
"/scroll/apply"
);
while
(!
workDone
)
if
(
currentMmtAnswer
==
null
)
{
{
// Let the engine run for a frame for not letting the game freeze
Debug
.
Log
(
"DAS HAT NICHT GEKLAPPT"
);
yield
return
null
;
//TODO: hier ne Art PopUp, wo drin steht, dass das nicht geklappt hat
PushoutFactFailEvent
.
Invoke
(
null
);
string
answer
=
sendView
(
"/scroll/apply"
);
}
else
if
(
answer
==
null
)
{
{
Scroll
.
ScrollApplicationInfo
pushout
=
JsonConvert
.
DeserializeObject
<
Scroll
.
ScrollApplicationInfo
>(
currentMmtAnswer
);
Debug
.
Log
(
"DAS HAT NICHT GEKLAPPT"
);
readPushout
(
pushout
.
acquiredFacts
);
//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
;
}
}
}
}
...
@@ -99,30 +92,21 @@ public void newAssignmentTrigger() {
...
@@ -99,30 +92,21 @@ public void newAssignmentTrigger() {
IEnumerator
newAssignment
()
IEnumerator
newAssignment
()
{
{
bool
workDone
=
false
;
//Non blocking wait till sendView() is finished
yield
return
sendView
(
"/scroll/dynamic"
);
while
(!
workDone
)
if
(
currentMmtAnswer
==
null
)
{
{
// Let the engine run for a frame for not letting the game freeze
Debug
.
Log
(
"DAS HAT NICHT GEKLAPPT"
);
yield
return
null
;
}
else
string
answer
=
sendView
(
"/scroll/dynamic"
);
{
Scroll
.
ScrollDynamicInfo
scrollDynamicInfo
=
JsonConvert
.
DeserializeObject
<
Scroll
.
ScrollDynamicInfo
>(
currentMmtAnswer
);
if
(
answer
==
null
)
processScrollDynamicInfo
(
scrollDynamicInfo
);
{
Debug
.
Log
(
"DAS HAT NICHT GEKLAPPT"
);
}
else
{
Scroll
.
ScrollDynamicInfo
scrollDynamicInfo
=
JsonConvert
.
DeserializeObject
<
Scroll
.
ScrollDynamicInfo
>(
answer
);
processScrollDynamicInfo
(
scrollDynamicInfo
);
}
workDone
=
true
;
}
}
}
}
private
string
sendView
(
string
endpoint
)
IEnumerator
sendView
(
string
endpoint
)
{
{
string
body
=
prepareScrollAssignments
();
string
body
=
prepareScrollAssignments
();
...
@@ -130,18 +114,21 @@ private string sendView(string endpoint)
...
@@ -130,18 +114,21 @@ private string sendView(string endpoint)
www
.
method
=
UnityWebRequest
.
kHttpVerbPOST
;
www
.
method
=
UnityWebRequest
.
kHttpVerbPOST
;
www
.
SetRequestHeader
(
"Content-Type"
,
"application/json"
);
www
.
SetRequestHeader
(
"Content-Type"
,
"application/json"
);
var
async
=
www
.
Send
();
var
async
=
www
.
Send
();
while
(!
async
.
isDone
)
{
}
while
(!
async
.
isDone
)
{
//Non blocking wait for one frame, for letting the game do other things
yield
return
null
;
}
if
(
www
.
isNetworkError
||
www
.
isHttpError
)
if
(
www
.
isNetworkError
||
www
.
isHttpError
)
{
{
Debug
.
Log
(
www
.
error
);
Debug
.
Log
(
www
.
error
);
return
null
;
currentMmtAnswer
=
null
;
}
}
else
else
{
{
string
answer
=
www
.
downloadHandler
.
text
;
string
answer
=
www
.
downloadHandler
.
text
;
Debug
.
Log
(
answer
);
Debug
.
Log
(
answer
);
return
answer
;
currentMmtAnswer
=
answer
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment