Merge branch 'master' into dev

This commit is contained in:
Mister_Nebula 2022-01-19 10:13:48 +00:00
commit 94a27d83da
8 changed files with 55 additions and 31 deletions

View File

@ -232,7 +232,7 @@ namespace QSB.Menus
if (QSBCore.IsHost)
{
SetButtonActive(ResumeGameButton, StandaloneProfileManager.SharedInstance.currentProfileGameSave.loopCount > 1);
QSBCore.UnityEvents.RunWhen(PlayerData.IsLoaded, () => SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1));
SetButtonActive(NewGameButton, true);
}
else
@ -244,7 +244,7 @@ namespace QSB.Menus
else
{
SetButtonActive(ClientButton, true);
SetButtonActive(ResumeGameButton, StandaloneProfileManager.SharedInstance.currentProfileGameSave.loopCount > 1);
QSBCore.UnityEvents.RunWhen(PlayerData.IsLoaded, () => SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1));
SetButtonActive(NewGameButton, true);
}
@ -343,7 +343,7 @@ namespace QSB.Menus
{
KickReason.QSBVersionNotMatching => "Server refused connection as QSB version does not match.",
KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.",
KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)",
KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic/Xbox)",
KickReason.DLCNotMatching => "Server refused connection as DLC installation state does not match.",
KickReason.InEye => "Server refused connection as game has progressed too far.",
KickReason.None => "Kicked from server. No reason given.",
@ -370,7 +370,7 @@ namespace QSB.Menus
SetButtonActive(ClientButton, true);
SetButtonActive(QuitButton, true);
SetButtonActive(HostButton, true);
SetButtonActive(ResumeGameButton, StandaloneProfileManager.SharedInstance.currentProfileGameSave.loopCount > 1);
SetButtonActive(ResumeGameButton, PlayerData.LoadLoopCount() > 1);
SetButtonActive(NewGameButton, true);
}
}

View File

@ -3,6 +3,7 @@
public enum GamePlatform
{
Steam,
Epic
Epic,
Xbox
}
}

View File

@ -62,9 +62,7 @@ namespace QSB
public static bool IsInMultiplayer => QSBNetworkManager.singleton.isNetworkActive;
public static string QSBVersion => Helper.Manifest.Version;
public static string GameVersion => Application.version;
public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")
? GamePlatform.Epic
: GamePlatform.Steam;
public static GamePlatform Platform { get; private set; }
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
public static IMenuAPI MenuApi { get; private set; }
@ -82,7 +80,24 @@ namespace QSB
Helper = ModHelper;
DebugLog.ToConsole($"* Start of QSB version {QSBVersion} - authored by {Helper.Manifest.Author}", MessageType.Info);
MenuApi = Helper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
switch (EntitlementsManager.instance._entitlementRetriever.GetType().Name)
{
case "EpicEntitlementRetriever":
Platform = GamePlatform.Epic;
break;
case "SteamEntitlementRetriever":
Platform = GamePlatform.Steam;
break;
case "MSStoreEntitlementRetriever":
Platform = GamePlatform.Xbox;
break;
case var other:
DebugLog.ToConsole($"Cannot get game platform (entitlement retriever name = {other})\nTell a QSB Dev!", MessageType.Error);
enabled = false;
return;
}
MenuApi = ModHelper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
NetworkAssetBundle = Helper.Assets.LoadBundle("AssetBundles/network");
InstrumentAssetBundle = Helper.Assets.LoadBundle("AssetBundles/instruments");

View File

@ -67,7 +67,7 @@ namespace QSB
transport = gameObject.AddComponent<kcp2k.KcpTransport>();
base.Awake();
PlayerName = GetPlayerName();
InitPlayerName();
playerPrefab = QSBCore.NetworkAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/NETWORK_Player_Body.prefab");
playerPrefab.GetRequiredComponent<NetworkIdentity>().SetValue("m_AssetId", 1.ToGuid().ToString("N"));
@ -93,21 +93,29 @@ namespace QSB
ConfigureNetworkManager();
}
private string GetPlayerName()
private void InitPlayerName()
{
try
QSBCore.UnityEvents.RunWhen(PlayerData.IsLoaded, () =>
{
var profileManager = StandaloneProfileManager.SharedInstance;
profileManager.Initialize();
var profile = profileManager._currentProfile;
var profileName = profile.profileName;
return profileName;
}
catch (Exception ex)
{
DebugLog.ToConsole($"Error - Exception when getting player name : {ex}", MessageType.Error);
return "Player";
}
try
{
var titleScreenManager = FindObjectOfType<TitleScreenManager>();
var profileManager = titleScreenManager._profileManager;
if (profileManager.GetType().Name == "MSStoreProfileManager")
{
PlayerName = (string)profileManager.GetType().GetProperty("userDisplayName").GetValue(profileManager);
}
else
{
PlayerName = StandaloneProfileManager.SharedInstance.currentProfile.profileName;
}
}
catch (Exception ex)
{
DebugLog.ToConsole($"Error - Exception when getting player name : {ex}", MessageType.Error);
PlayerName = "Player";
}
});
}
/// create a new network prefab from the network object prefab template.

View File

@ -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;

View File

@ -16,7 +16,7 @@ namespace QSB.SaveSync.Messages
{
new GameStateMessage(From).Send();
var gameSave = StandaloneProfileManager.SharedInstance.currentProfileGameSave;
var gameSave = PlayerData._currentGameSave;
var factSaves = gameSave.shipLogFactSaves;
foreach (var item in factSaves)

View File

@ -1,8 +1,8 @@
{
"debugMode": true,
"drawLines": true,
"showQuantumVisibilityObjects": true,
"showDebugLabels": true,
"debugMode": false,
"drawLines": false,
"showQuantumVisibilityObjects": false,
"showDebugLabels": false,
"avoidTimeSync": false,
"skipTitleScreen": true,
"greySkybox": true

View File

@ -7,7 +7,7 @@
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications.\n- Make sure you have forwarded/opened the correct ports. (See the GitHub readme.)"
},
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
"version": "0.15.0",
"version": "0.15.1",
"owmlVersion": "2.3.1",
"dependencies": [ "_nebula.MenuFramework" ]
}