mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 09:39:56 +00:00
use PlayerData instead of profile manager
This commit is contained in:
parent
080f72cb5b
commit
ba452fad2d
@ -3,7 +3,6 @@ using QSB.Player;
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.SaveSync.Messages;
|
||||
using QSB.Utility;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
@ -235,7 +234,7 @@ namespace QSB.Menus
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
SetButtonActive(ResumeGameButton, QSBCore.ProfileManager.currentProfileGameSave.loopCount > 1);
|
||||
QSBCore.UnityEvents.RunWhen(PlayerData.IsLoaded, () => SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1));
|
||||
SetButtonActive(NewGameButton, true);
|
||||
}
|
||||
else
|
||||
@ -247,7 +246,7 @@ namespace QSB.Menus
|
||||
else
|
||||
{
|
||||
SetButtonActive(ClientButton, true);
|
||||
SetButtonActive(ResumeGameButton, QSBCore.ProfileManager.currentProfileGameSave.loopCount > 1);
|
||||
QSBCore.UnityEvents.RunWhen(PlayerData.IsLoaded, () => SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1));
|
||||
SetButtonActive(NewGameButton, true);
|
||||
}
|
||||
|
||||
@ -383,7 +382,7 @@ namespace QSB.Menus
|
||||
SetButtonActive(ClientButton, true);
|
||||
SetButtonActive(QuitButton, true);
|
||||
SetButtonActive(HostButton, true);
|
||||
SetButtonActive(ResumeGameButton, QSBCore.ProfileManager.currentProfileGameSave.loopCount > 1);
|
||||
SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1);
|
||||
SetButtonActive(NewGameButton, true);
|
||||
}
|
||||
|
||||
@ -404,7 +403,7 @@ namespace QSB.Menus
|
||||
SetButtonActive(DisconnectButton, false);
|
||||
SetButtonActive(ClientButton, true);
|
||||
SetButtonActive(HostButton, true);
|
||||
SetButtonActive(ResumeGameButton, QSBCore.ProfileManager.currentProfileGameSave.loopCount > 1);
|
||||
SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1);
|
||||
SetButtonActive(NewGameButton, true);
|
||||
SetButtonActive(QuitButton, true);
|
||||
break;
|
||||
|
@ -15,7 +15,6 @@ using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using QuantumUNET;
|
||||
using QuantumUNET.Components;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
/*
|
||||
@ -62,7 +61,6 @@ namespace QSB
|
||||
public static string QSBVersion => Helper.Manifest.Version;
|
||||
public static string GameVersion => Application.version;
|
||||
public static GamePlatform Platform { get; private set; }
|
||||
public static IProfileManager ProfileManager { get; private set; }
|
||||
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||
public static IMenuAPI MenuApi { get; private set; }
|
||||
|
||||
@ -97,16 +95,6 @@ namespace QSB
|
||||
return;
|
||||
}
|
||||
|
||||
if (Platform == GamePlatform.Xbox)
|
||||
{
|
||||
ProfileManager = (IProfileManager)typeof(IProfileManager).Assembly.GetType("MSStoreProfileManager")
|
||||
.GetProperty("SharedInstance", BindingFlags.Public | BindingFlags.Static).GetValue(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProfileManager = StandaloneProfileManager.SharedInstance;
|
||||
}
|
||||
|
||||
MenuApi = ModHelper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
|
||||
|
||||
NetworkAssetBundle = Helper.Assets.LoadBundle("AssetBundles/network");
|
||||
|
@ -86,25 +86,12 @@ namespace QSB
|
||||
{
|
||||
try
|
||||
{
|
||||
var profileManager = QSBCore.ProfileManager;
|
||||
// BUG: this doesnt work for xbox
|
||||
var profileManager = StandaloneProfileManager.SharedInstance;
|
||||
profileManager.Initialize();
|
||||
|
||||
if (profileManager.GetType().Name == "MSStoreProfileManager")
|
||||
{
|
||||
return (string)profileManager.GetType()
|
||||
.GetProperty("userDisplayName", BindingFlags.Public | BindingFlags.Instance)
|
||||
.GetValue(profileManager);
|
||||
}
|
||||
|
||||
if (profileManager is StandaloneProfileManager standaloneProfileManager)
|
||||
{
|
||||
var profile = standaloneProfileManager._currentProfile;
|
||||
var profileName = profile.profileName;
|
||||
return profileName;
|
||||
}
|
||||
|
||||
DebugLog.ToConsole($"Cannot get player name (profile manager type = {profileManager.GetType().Name})\nTell a QSB Dev!", MessageType.Error);
|
||||
return "Player";
|
||||
var profile = profileManager._currentProfile;
|
||||
var profileName = profile.profileName;
|
||||
return profileName;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ namespace QSB.SaveSync.Messages
|
||||
public GameStateMessage(uint toId)
|
||||
{
|
||||
To = toId;
|
||||
var gameSave = StandaloneProfileManager.SharedInstance.currentProfileGameSave;
|
||||
var gameSave = PlayerData._currentGameSave;
|
||||
WarpedToTheEye = gameSave.warpedToTheEye;
|
||||
SecondsRemainingOnWarp = gameSave.secondsRemainingOnWarp;
|
||||
LaunchCodesGiven = PlayerData.KnowsLaunchCodes();
|
||||
@ -89,7 +89,7 @@ namespace QSB.SaveSync.Messages
|
||||
|
||||
PlayerData.ResetGame();
|
||||
|
||||
var gameSave = StandaloneProfileManager.SharedInstance.currentProfileGameSave;
|
||||
var gameSave = PlayerData._currentGameSave;
|
||||
gameSave.loopCount = LoopCount;
|
||||
gameSave.knownFrequencies = KnownFrequencies;
|
||||
gameSave.knownSignals = KnownSignals;
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.SaveSync.Messages
|
||||
{
|
||||
new GameStateMessage(From).Send();
|
||||
|
||||
var gameSave = QSBCore.ProfileManager.currentProfileGameSave;
|
||||
var gameSave = PlayerData._currentGameSave;
|
||||
|
||||
var factSaves = gameSave.shipLogFactSaves;
|
||||
foreach (var item in factSaves)
|
||||
|
Loading…
x
Reference in New Issue
Block a user