Skip to content
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
11 changes: 8 additions & 3 deletions Assets/Scripts/Gameplay/GameState/ClientMainMenuState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected override void Configure(IContainerBuilder builder)
builder.RegisterComponent(m_IPUIMediator);
}

private async void TrySignIn()
async void TrySignIn()
{
try
{
Expand All @@ -88,16 +88,21 @@ private async void TrySignIn()
}
}

private void OnAuthSignIn()
void OnAuthSignIn()
{
m_SessionButton.interactable = true;
m_UGSSetupTooltipDetector.enabled = false;
m_SignInSpinner.SetActive(false);

Debug.Log($"Signed in. Unity Player ID {AuthenticationService.Instance.PlayerId}");

m_LocalUser.ID = AuthenticationService.Instance.PlayerId;

// The local SessionUser object will be hooked into UI before the LocalSession is populated during session join, so the LocalSession must know about it already when that happens.
m_LocalSession.AddUser(m_LocalUser);
}

private void OnSignInFailed()
void OnSignInFailed()
{
if (m_SessionButton)
{
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/UnityServices/Sessions/LocalSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,10 @@ public void ApplyRemoteData(ISession session)
CopyDataFrom(info, localSessionUsers);
}

public void Reset()
public void Reset(LocalSessionUser localUser)
{
CopyDataFrom(new SessionData(), new Dictionary<string, LocalSessionUser>());
AddUser(localUser);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void ResetSession()
{
CurrentUnitySession = null;
m_LocalUser?.ResetState();
m_LocalSession?.Reset();
m_LocalSession?.Reset(m_LocalUser);

// no need to disconnect Netcode, it should already be handled by Netcode's callback to disconnect
}
Expand Down