Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loading client state. #24

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Assets/Scripts/ClientState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ClientState
public MouseInputData mouse;
public Dictionary<string, string> connection_params_dict;
public int? recentServerKeyframeId = null;
public bool isLoading;
}

[Serializable]
Expand Down
6 changes: 6 additions & 0 deletions Assets/Scripts/InputTrackerKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ public InputTrackerKeyboard()

public void Update()
{
// Don't update if loading.
if (LoadProgressTracker.Instance.IsLoading)
{
return;
}

// Record all keys that were pressed or released since the last OnEndFrame() call.
// Note that multiple Unity frames may occur during that time.
for (int i = 0; i < KEY_COUNT; i++)
Expand Down
6 changes: 6 additions & 0 deletions Assets/Scripts/InputTrackerMouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public InputTrackerMouse(Camera camera)

public void Update()
{
// Don't update if loading.
if (LoadProgressTracker.Instance.IsLoading)
{
return;
}

// Record all mouse actions that occurred OnEndFrame() call.
// Note that multiple Unity frames may occur during that time.
int mouseIndex = 0;
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ void ProcessReceivedKeyframes(string message)

void UpdateClientState()
{
_clientState.isLoading = LoadProgressTracker.Instance.IsLoading;

if (_clientStateProducers == null)
{
return;
Expand Down