mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-12 04:14:08 +00:00
move namespaces + wip
This commit is contained in:
parent
a63e2bfb5c
commit
b93e23dc57
@ -1,17 +1,16 @@
|
||||
using Epic.OnlineServices;
|
||||
using Epic.OnlineServices.Ecom;
|
||||
using UnityEngine;
|
||||
using EpicRerouter.QsbSide;
|
||||
using static EntitlementsManager;
|
||||
|
||||
namespace EpicRerouter
|
||||
namespace EpicRerouter.ProcessSide
|
||||
{
|
||||
/// <summary>
|
||||
/// runs on process side
|
||||
/// </summary>
|
||||
public static class EpicEntitlementRetriever
|
||||
{
|
||||
public const string EOS_DLC_OFFER_ID = "379b9688bb1048f3a56d52b13800f4df";
|
||||
public const string EOS_DLC_ITEM_ID = "49a9ac61fe464cbf8c8c73f46b3f1133";
|
||||
private const string _eosDlcItemID = "49a9ac61fe464cbf8c8c73f46b3f1133";
|
||||
|
||||
private static EcomInterface _ecomInterface;
|
||||
private static OwnershipStatus _epicDlcOwnershipStatus;
|
||||
@ -19,12 +18,12 @@ namespace EpicRerouter
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
EpicPlatformManager.onAuthSuccess += EOSQueryOwnership;
|
||||
EpicPlatformManager.OnAuthSuccess += EOSQueryOwnership;
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
EpicPlatformManager.onAuthSuccess -= EOSQueryOwnership;
|
||||
EpicPlatformManager.OnAuthSuccess -= EOSQueryOwnership;
|
||||
}
|
||||
|
||||
public static AsyncOwnershipStatus GetOwnershipStatus()
|
||||
@ -42,14 +41,14 @@ namespace EpicRerouter
|
||||
return AsyncOwnershipStatus.Owned;
|
||||
}
|
||||
|
||||
public static void EOSQueryOwnership()
|
||||
private static void EOSQueryOwnership()
|
||||
{
|
||||
Debug.Log("[EOS] querying DLC ownership");
|
||||
Interop.Log("[EOS] querying DLC ownership");
|
||||
_ecomInterface = EpicPlatformManager.PlatformInterface.GetEcomInterface();
|
||||
var queryOwnershipOptions = new QueryOwnershipOptions
|
||||
{
|
||||
LocalUserId = EpicPlatformManager.LocalUserId,
|
||||
CatalogItemIds = new[] { "49a9ac61fe464cbf8c8c73f46b3f1133" }
|
||||
CatalogItemIds = new[] { _eosDlcItemID }
|
||||
};
|
||||
_ecomInterface.QueryOwnership(queryOwnershipOptions, null, OnEOSQueryOwnershipComplete);
|
||||
}
|
||||
@ -60,7 +59,7 @@ namespace EpicRerouter
|
||||
{
|
||||
_epicDlcOwnershipStatus = data.ItemOwnership[0].OwnershipStatus;
|
||||
_epicResultReceived = true;
|
||||
Debug.Log($"[EOS] Query DLC ownership complete: {_epicDlcOwnershipStatus}");
|
||||
Interop.Log($"[EOS] Query DLC ownership complete: {_epicDlcOwnershipStatus}");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +1,26 @@
|
||||
using Epic.OnlineServices;
|
||||
using Epic.OnlineServices.Auth;
|
||||
using Epic.OnlineServices.Platform;
|
||||
using EpicRerouter.QsbSide;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EpicRerouter
|
||||
namespace EpicRerouter.ProcessSide
|
||||
{
|
||||
/// <summary>
|
||||
/// runs on process side
|
||||
/// </summary>
|
||||
public static class EpicPlatformManager
|
||||
{
|
||||
public const string EOS_PRODUCT_ID = "prod-starfish";
|
||||
public const string EOS_SANDBOX_ID = "starfish";
|
||||
public const string EOS_DEPLOYMENT_ID = "e176ecc84fbc4dd8934664684f44dc71";
|
||||
public const string EOS_CLIENT_ID = "5c553c6accee4111bc8ea3a3ae52229b";
|
||||
public const string EOS_CLIENT_SECRET = "k87Nfp75BzPref4nJFnnbNjYXQQR";
|
||||
private const string _eosProductID = "prod-starfish";
|
||||
private const string _eosSandboxID = "starfish";
|
||||
private const string _eosDeploymentID = "e176ecc84fbc4dd8934664684f44dc71";
|
||||
private const string _eosClientID = "5c553c6accee4111bc8ea3a3ae52229b";
|
||||
private const string _eosClientSecret = "k87Nfp75BzPref4nJFnnbNjYXQQR";
|
||||
|
||||
private const float TICK_INTERVAL = 0.1f;
|
||||
private const bool ENABLE_SDK_DEBUGGING = false;
|
||||
public static PlatformInterface PlatformInterface;
|
||||
public static EpicAccountId LocalUserId;
|
||||
|
||||
public static PlatformInterface PlatformInterface { get; private set; }
|
||||
public static EpicAccountId LocalUserId { get; private set; }
|
||||
private static float _lastTick;
|
||||
|
||||
public static OWEvent onAuthSuccess = new(1);
|
||||
public static OWEvent OnAuthSuccess = new(1);
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
@ -38,7 +34,7 @@ namespace EpicRerouter
|
||||
{
|
||||
if (ex.Result == Result.AlreadyConfigured)
|
||||
{
|
||||
Debug.Log("[EOS] platform already configured!");
|
||||
Console.WriteLine("[EOS] platform already configured!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -47,12 +43,8 @@ namespace EpicRerouter
|
||||
}
|
||||
|
||||
public static void Tick()
|
||||
{
|
||||
if (PlatformInterface != null && _lastTick + 0.1f <= Time.unscaledTime)
|
||||
{
|
||||
PlatformInterface.Tick();
|
||||
_lastTick = Time.unscaledTime;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
@ -66,8 +58,8 @@ namespace EpicRerouter
|
||||
{
|
||||
var result = PlatformInterface.Initialize(new InitializeOptions
|
||||
{
|
||||
ProductName = Application.productName,
|
||||
ProductVersion = Application.version
|
||||
ProductName = Program.ProductName,
|
||||
ProductVersion = Program.Version
|
||||
});
|
||||
if (result != Result.Success)
|
||||
{
|
||||
@ -76,22 +68,22 @@ namespace EpicRerouter
|
||||
|
||||
var options = new Options
|
||||
{
|
||||
ProductId = "prod-starfish",
|
||||
SandboxId = "starfish",
|
||||
ProductId = _eosProductID,
|
||||
SandboxId = _eosSandboxID,
|
||||
ClientCredentials = new ClientCredentials
|
||||
{
|
||||
ClientId = "5c553c6accee4111bc8ea3a3ae52229b",
|
||||
ClientSecret = "k87Nfp75BzPref4nJFnnbNjYXQQR"
|
||||
ClientId = _eosClientID,
|
||||
ClientSecret = _eosClientSecret
|
||||
},
|
||||
DeploymentId = "e176ecc84fbc4dd8934664684f44dc71"
|
||||
DeploymentId = _eosDeploymentID
|
||||
};
|
||||
PlatformInterface = PlatformInterface.Create(options);
|
||||
Debug.Log("[EOS] Platform interface has been created");
|
||||
Interop.Log("[EOS] Platform interface has been created");
|
||||
}
|
||||
|
||||
private static void Auth()
|
||||
{
|
||||
Debug.Log("[EOS] Authenticating...");
|
||||
Interop.Log("[EOS] Authenticating...");
|
||||
var loginOptions = new LoginOptions
|
||||
{
|
||||
Credentials = new Credentials
|
||||
@ -104,7 +96,8 @@ namespace EpicRerouter
|
||||
};
|
||||
if (PlatformInterface == null)
|
||||
{
|
||||
Debug.LogError("[EOS] Platform interface is null!");
|
||||
Interop.Log("[EOS] Platform interface is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
PlatformInterface.GetAuthInterface().Login(loginOptions, null, OnLogin);
|
||||
@ -129,15 +122,15 @@ namespace EpicRerouter
|
||||
if (loginCallbackInfo.ResultCode == Result.Success)
|
||||
{
|
||||
LocalUserId = loginCallbackInfo.LocalUserId;
|
||||
Debug.Log($"[EOS SDK] login success! user ID: {LocalUserId}");
|
||||
onAuthSuccess.Invoke();
|
||||
Interop.Log($"[EOS SDK] login success! user ID: {LocalUserId}");
|
||||
OnAuthSuccess.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogError("[EOS SDK] Login failed");
|
||||
Interop.Log("[EOS SDK] Login failed");
|
||||
}
|
||||
|
||||
public class EOSInitializeException : Exception
|
||||
private class EOSInitializeException : Exception
|
||||
{
|
||||
public readonly Result Result;
|
||||
public EOSInitializeException(string msg, Result initResult) : base(msg) => Result = initResult;
|
48
EpicRerouter/ProcessSide/Program.cs
Normal file
48
EpicRerouter/ProcessSide/Program.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using static EntitlementsManager;
|
||||
|
||||
namespace EpicRerouter.ProcessSide
|
||||
{
|
||||
/// <summary>
|
||||
/// runs on process side
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
public static string ProductName;
|
||||
public static string Version;
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var assemblyLocation in args)
|
||||
{
|
||||
var assembly = Assembly.LoadFile(assemblyLocation);
|
||||
Console.WriteLine($"loaded {assembly}");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
EpicPlatformManager.Init();
|
||||
EpicEntitlementRetriever.Init();
|
||||
|
||||
while (EpicEntitlementRetriever.GetOwnershipStatus() == AsyncOwnershipStatus.NotReady)
|
||||
{
|
||||
EpicPlatformManager.Tick();
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
EpicEntitlementRetriever.Uninit();
|
||||
EpicPlatformManager.Uninit();
|
||||
|
||||
Console.WriteLine("all done");
|
||||
Thread.Sleep(3000);
|
||||
Environment.Exit((int)AsyncOwnershipStatus.Owned);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using static EntitlementsManager;
|
||||
|
||||
namespace EpicRerouter
|
||||
{
|
||||
/// <summary>
|
||||
/// runs on process side
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static void Main(string[] assemblyLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var assemblyLocation in assemblyLocations)
|
||||
{
|
||||
var assembly = Assembly.LoadFile(assemblyLocation);
|
||||
Console.WriteLine($"loaded {assembly}");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("all done");
|
||||
Thread.Sleep(3000);
|
||||
Environment.Exit((int)AsyncOwnershipStatus.Owned);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ using System.Reflection;
|
||||
using static EntitlementsManager;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace EpicRerouter
|
||||
namespace EpicRerouter.QsbSide
|
||||
{
|
||||
/// <summary>
|
||||
/// runs on qsb side
|
@ -1,11 +1,11 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace EpicRerouter
|
||||
namespace EpicRerouter.QsbSide
|
||||
{
|
||||
/// <summary>
|
||||
/// runs on qsb side
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(EpicPlatformManager))]
|
||||
[HarmonyPatch(typeof(ProcessSide.EpicPlatformManager))]
|
||||
internal static class Patches
|
||||
{
|
||||
[HarmonyPrefix]
|
@ -54,7 +54,7 @@ namespace QSB
|
||||
{
|
||||
if (true || typeof(EpicPlatformManager).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever"))
|
||||
{
|
||||
EpicRerouter.Interop.Go();
|
||||
EpicRerouter.QsbSide.Interop.Go();
|
||||
}
|
||||
|
||||
UIHelper.ReplaceUI(UITextType.PleaseUseController,
|
||||
|
Loading…
x
Reference in New Issue
Block a user