OnLogout, Steam platform auth in account creation. Not configurable to ensure server uses ticket to validate.
This commit is contained in:
46
Core/SteamPlatform.cs
Normal file
46
Core/SteamPlatform.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Il2CppInterop.Runtime;
|
||||
using Steamworks;
|
||||
using System;
|
||||
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Core;
|
||||
|
||||
public class SteamPlatform : MonoBehaviour
|
||||
{
|
||||
public static string AuthTicket { get; set; } = null;
|
||||
|
||||
void GetAuthTicket() {
|
||||
SteamPlatformManager manager = PlatformManager.Instance.GetComponentInChildren<SteamPlatformManager>();
|
||||
manager.GetAuthSessionTicket().Then(
|
||||
DelegateSupport.ConvertDelegate<Il2CppSystem.Action<SteamPlatformManager.AuthSessionTicket>>((SteamPlatformManager.AuthSessionTicket ticket) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ticket.Error)) UniversalPatchPlugin.Log.LogError($"Could not get Steam auth ticket!: {ticket.Error}");
|
||||
else
|
||||
{
|
||||
AuthTicket = BitConverter.ToString(ticket.Ticket).Replace("-", "").ToUpperInvariant().TrimEnd('0');
|
||||
Util.ConditionalDebug($"Got new Steam auth ticket");
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
RecNetInteractions.onLogout.Add(GetAuthTicket);
|
||||
RecNetInteractions.onPlatformInitialize.Add(GetAuthTicket);
|
||||
|
||||
/*
|
||||
Every time the user logs out of matchmaking
|
||||
or when PlatformManager initializes, fetch a new ticket.
|
||||
The user might be logging out to the account selection screen
|
||||
where they might create a new one; a Steam auth ticket is added to
|
||||
the auth params in the create request and it must be valid.
|
||||
|
||||
It *is* possible (though very unlikely) that the user creates a new account
|
||||
before the first ticket is fetched, since the method that gets a ticket is
|
||||
an IPromise.
|
||||
|
||||
If this way of doing things isn't the best, fix it and I'll merge
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user