Files
ft/CodexOutput/upserver/KVGameplayLoopTests/diff-UserService.cs.txt

73 lines
2.6 KiB
Plaintext

--- Client/Assets/Scripts/Services/UserService.cs (reviewed baseline)
+++ Client/Assets/Scripts/Services/UserService.cs
@@ -155,6 +155,9 @@
GContext.OnEvent<EvtAPISvrUnauthorized>().Subscribe(evt =>
{
if (evt.SessionVersion != customServerMgr.SessionVersion) return;
+#if UNITY_EDITOR && !SERVICE_HOST
+ if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) { game.PlayerDataStorage.PlayerKVGameplayLoop.Fault("API unauthorized; restart required."); return; }
+#endif
InternalId = 0;
if (PlayFabClientAPI.IsClientLoggedIn()) _ = LoginApiServer();
});
@@ -185,6 +188,9 @@
private async Task<ELoginStep> LoginCore(Action<int> progress, int generation)
{
+#if UNITY_EDITOR && !SERVICE_HOST
+ if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) return await LoginKVGameplayLoopAsync(progress,generation);
+#endif
if (IsLogin)
{
progress?.Invoke(2);
@@ -344,7 +350,11 @@
var info_request_parameters = new GetPlayerCombinedInfoRequestParams
{
GetUserAccountInfo = true,
+#if UNITY_EDITOR && !SERVICE_HOST
+ GetUserData = !game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled,
+#else
GetUserData = true,
+#endif
GetPlayerProfile = true,
ProfileConstraints = new PlayerProfileViewConstraints()
{
@@ -507,6 +517,9 @@
//InitData should invoke after local time adjusted.
//save login time to local storage.
+#if UNITY_EDITOR && !SERVICE_HOST
+ if(!game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled)
+#endif
InitData(playfabUserData, UserId);
return true;
@@ -546,6 +559,9 @@
return false;
}
customServerMgr.UseAccountSession(session);
+#if UNITY_EDITOR && !SERVICE_HOST
+ if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) return true; // Identity is published only after all KV modules load.
+#endif
InternalId = session.InternalId;
GContext.Publish(new EvtAPISvrLoginSuccess
{
@@ -655,6 +671,9 @@
public virtual void Logout()
{
+#if UNITY_EDITOR && !SERVICE_HOST
+ if(game.PlayerDataStorage.PlayerKVGameplayLoop.Enabled) { _=StopKVGameplayLoopAsync(); return; }
+#endif
if(kvControlledInstance)
{
logoutGeneration++; InternalId=0; UserId=null; DisplayName=null; AvatarUrl=null;