AuthenticationValues should only be set when selfhosting/onprem. userid is ignored by photon cloud.
This commit is contained in:
@@ -145,33 +145,33 @@ namespace undead_universal_patch_il2cpp.Patches
|
||||
PhotonConfig.ServerPort.Value,
|
||||
PhotonConfig.AppID.Value,
|
||||
]);
|
||||
}
|
||||
|
||||
Type authValuesType = AccessTools.TypeByName("AuthenticationValues");
|
||||
if (authValuesType != null)
|
||||
{
|
||||
PropertyInfo networkingPeerProperty = photonNetworkType.GetRuntimeProperty("networkingPeer");
|
||||
if (networkingPeerProperty == null)
|
||||
Type authValuesType = AccessTools.TypeByName("AuthenticationValues");
|
||||
if (authValuesType != null)
|
||||
{
|
||||
UniversalPatchPlugin.Log.LogError("Cannot patch Photon: networkingPeerProperty was null. Is this build supported?");
|
||||
return;
|
||||
PropertyInfo networkingPeerProperty = photonNetworkType.GetRuntimeProperty("networkingPeer");
|
||||
if (networkingPeerProperty == null)
|
||||
{
|
||||
UniversalPatchPlugin.Log.LogError("Cannot patch Photon: networkingPeerProperty was null. Is this build supported?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (networkingPeerProperty.GetValue(null) == null)
|
||||
{
|
||||
UniversalPatchPlugin.Log.LogError("Cannot patch Photon: networkingPeerInstance was null. Is this build supported?");
|
||||
return;
|
||||
}
|
||||
|
||||
string id = Util.LocalInstanceGuid;
|
||||
Util.ConditionalDebug($"Instance GUID is {id}");
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues
|
||||
{
|
||||
UserId = id
|
||||
};
|
||||
|
||||
Util.ConditionalDebug($"Set the authValues userId to {id}");
|
||||
}
|
||||
|
||||
if (networkingPeerProperty.GetValue(null) == null)
|
||||
{
|
||||
UniversalPatchPlugin.Log.LogError("Cannot patch Photon: networkingPeerInstance was null. Is this build supported?");
|
||||
return;
|
||||
}
|
||||
|
||||
string id = Core.Util.LocalInstanceGuid;
|
||||
Util.ConditionalDebug($"Instance GUID is {id}");
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues
|
||||
{
|
||||
UserId = id
|
||||
};
|
||||
|
||||
Util.ConditionalDebug($"Set the authValues userId to {id}");
|
||||
}
|
||||
|
||||
UniversalPatchPlugin.Log.LogInfo($"Photon patch ({(PhotonConfig.SelfHosted.Value ? "self-hosted" : "cloud")}) succeeded.");
|
||||
|
||||
Reference in New Issue
Block a user