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
8a7a6f94
Commit
8a7a6f94
authored
2 months ago
by
baletiballo
Browse files
Options
Downloads
Patches
Plain Diff
Trying to make scroll loading async. Doesn't quite work yet
parent
4c145a67
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/GlobalBehaviour.cs
+11
-17
11 additions, 17 deletions
Assets/Scripts/GlobalBehaviour.cs
with
11 additions
and
17 deletions
Assets/Scripts/GlobalBehaviour.cs
+
11
−
17
View file @
8a7a6f94
...
...
@@ -55,7 +55,7 @@ public static GlobalBehaviour Instance
/// <summary> Default Setting for all JSONConvert operations </summary>
public
static
JsonSerializerSettings
JsonConvertDefaultSettings
=
new
()
{
MaxDepth
=
256
};
private
void
Awake
()
private
void
Start
()
{
Instance
=
this
;
if
(
Instance
!=
this
)
...
...
@@ -64,8 +64,12 @@ private void Awake()
JsonConvert
.
DefaultSettings
=
()
=>
JsonConvertDefaultSettings
;
DontDestroyOnLoad
(
this
);
GetScrollsfromServer
();
GetContextfromServer
();
InitiateScrolls
=
GetScrollsfromServer
();
StartCoroutine
(
InitiateScrolls
);
InitiateContext
=
GetContextfromServer
();
StartCoroutine
(
InitiateContext
);
}
//TODO: Move where appropiate
...
...
@@ -75,12 +79,8 @@ private void Awake()
public
static
IEnumerator
InitiateScrolls
=
IEnumeratorExtensions
.
yield_break
;
public
static
bool
AttemptScrollList
=
true
;
//false;
private
void
GetScrollsfromServer
()
private
IEnumerator
GetScrollsfromServer
()
{
StartCoroutine
(
InitiateScrolls
=
_GetScrollsfromServer
());
IEnumerator
_GetScrollsfromServer
()
{
//Try /scroll/listall endpoint when scroll/list is not working
//UnityWebRequest request = UnityWebRequest.Get(CommunicationEvents.ServerAdress + "/scroll/listall");
//Postman-Echo-Mock
...
...
@@ -141,7 +141,7 @@ IEnumerator _GetScrollsfromServer()
System
.
DateTime
parseTime
=
System
.
DateTime
.
UtcNow
;
List
<
Scroll
>
_AvailableScrolls
=
JsonConvert
.
DeserializeObject
<
List
<
Scroll
>>(
jsonString
);
System
.
DateTime
processTime
=
System
.
DateTime
.
UtcNow
;
AvailableScrolls
=
new
();
foreach
(
Scroll
scroll
in
_AvailableScrolls
)
...
...
@@ -156,20 +156,15 @@ IEnumerator _GetScrollsfromServer()
$"Processing\t
{(
System
.
DateTime
.
UtcNow
-
processTime
).
TotalMilliseconds
}
ms"
);
yield
break
;
}
}
public
static
FactRecorder
Context
=
new
();
public
static
IEnumerator
InitiateContext
=
IEnumeratorExtensions
.
yield_break
;
public
static
bool
ContextLoaded
=
false
;
public
static
bool
AttemptContextLoad
=
true
;
//false;
private
void
GetContextfromServer
()
private
IEnumerator
GetContextfromServer
()
{
StartCoroutine
(
InitiateContext
=
_GetContextfromServer
());
IEnumerator
_GetContextfromServer
()
{
ContextLoaded
=
false
;
System
.
DateTime
requestTime
=
System
.
DateTime
.
UtcNow
;
...
...
@@ -275,7 +270,6 @@ IEnumerator _GetContextfromServer()
ContextLoaded
=
true
;
yield
break
;
}
}
/// <summary>
...
...
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