This commit is contained in:
JohnCorby 2022-01-14 22:25:23 -08:00
parent 2efdbe310f
commit 51bb10eedc
12 changed files with 20 additions and 20 deletions

View File

@ -18,7 +18,7 @@ namespace QSB.Anglerfish.WorldObjects
{
if (QSBCore.IsHost)
{
Object.Instantiate(QSBNetworkManager.Instance.AnglerPrefab).SpawnWithServerAuthority();
Object.Instantiate(QSBNetworkManager.singleton.AnglerPrefab).SpawnWithServerAuthority();
}
StartDelayedReady();

View File

@ -17,7 +17,7 @@ namespace QSB.JellyfishSync.WorldObjects
if (QSBCore.IsHost)
{
Object.Instantiate(QSBNetworkManager.Instance.JellyfishPrefab).SpawnWithServerAuthority();
Object.Instantiate(QSBNetworkManager.singleton.JellyfishPrefab).SpawnWithServerAuthority();
}
StartDelayedReady();

View File

@ -43,9 +43,9 @@ namespace QSB.Menus
Instance = this;
MakeTitleMenus();
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
QSBNetworkManager.Instance.OnClientConnected += OnConnected;
QSBNetworkManager.Instance.OnClientDisconnected += OnDisconnected;
QSBNetworkManager.Instance.OnClientErrorThrown += OnClientError;
QSBNetworkManager.singleton.OnClientConnected += OnConnected;
QSBNetworkManager.singleton.OnClientDisconnected += OnDisconnected;
QSBNetworkManager.singleton.OnClientErrorThrown += OnClientError;
}
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isUniverse)
@ -273,7 +273,7 @@ namespace QSB.Menus
private void Disconnect()
{
QSBNetworkManager.Instance.StopHost();
QSBNetworkManager.singleton.StopHost();
SetButtonActive(DisconnectButton.gameObject, false);
Locator.GetSceneMenuManager().pauseMenu._pauseMenu.EnableMenu(false);
@ -286,7 +286,7 @@ namespace QSB.Menus
private void Host()
{
QSBNetworkManager.Instance.StartHost();
QSBNetworkManager.singleton.StartHost();
SetButtonActive(DisconnectButton, true);
SetButtonActive(HostButton, false);
SetButtonActive(QuitButton, false);
@ -313,8 +313,8 @@ namespace QSB.Menus
{
var address = ((PopupInputMenu)IPPopup).GetInputText();
QSBNetworkManager.Instance.networkAddress = address;
QSBNetworkManager.Instance.StartClient();
QSBNetworkManager.singleton.networkAddress = address;
QSBNetworkManager.singleton.StartClient();
if (QSBSceneManager.CurrentScene == OWScene.TitleScreen)
{

View File

@ -14,7 +14,7 @@ namespace QSB.OrbSync.WorldObjects
{
if (QSBCore.IsHost)
{
Object.Instantiate(QSBNetworkManager.Instance.OrbPrefab).SpawnWithServerAuthority();
Object.Instantiate(QSBNetworkManager.singleton.OrbPrefab).SpawnWithServerAuthority();
}
StartDelayedReady();

View File

@ -151,7 +151,7 @@ namespace QSB
{
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
Port = config.GetSettingsValue<int>("port");
if (QSBNetworkManager.Instance != null)
if (QSBNetworkManager.singleton != null)
{
// todo QSBNetworkManager.Instance.networkPort = Port;
}

View File

@ -29,7 +29,7 @@ namespace QSB
{
public class QSBNetworkManager : NetworkManager
{
public static QSBNetworkManager Instance => (QSBNetworkManager)singleton;
public static QSBNetworkManager singleton => (QSBNetworkManager)NetworkManager.singleton;
public event Action OnNetworkManagerReady;
public event Action OnClientConnected;

View File

@ -42,7 +42,7 @@ namespace QSB
if (newScene == OWScene.TitleScreen && QSBCore.IsInMultiplayer)
{
QSBNetworkManager.Instance.StopHost();
QSBNetworkManager.singleton.StopHost();
}
}

View File

@ -30,8 +30,8 @@ namespace QSB.RespawnSync
=> QSBCore.UnityEvents.RunWhen(
() => Locator.GetMarkerManager() != null,
() => Init(newScene, inUniverse));
QSBNetworkManager.Instance.OnClientConnected += OnConnected;
QSBNetworkManager.Instance.OnClientDisconnected += OnDisconnected;
QSBNetworkManager.singleton.OnClientConnected += OnConnected;
QSBNetworkManager.singleton.OnClientDisconnected += OnDisconnected;
}
private void OnConnected()

View File

@ -33,7 +33,7 @@ namespace QSB.SatelliteSync
{
Instance = this;
QSBSceneManager.OnUniverseSceneLoaded += OnSceneLoaded;
QSBNetworkManager.Instance.OnClientConnected += OnConnected;
QSBNetworkManager.singleton.OnClientConnected += OnConnected;
}
public void OnDestroy() => QSBSceneManager.OnUniverseSceneLoaded -= OnSceneLoaded;

View File

@ -88,7 +88,7 @@ namespace QSB.ShipSync
DebugLog.ToConsole($"Error - Tried to spawn ship, but LocalPlayer's TransformSync is null!", MessageType.Error);
}
Instantiate(QSBNetworkManager.Instance.ShipPrefab).SpawnWithServerAuthority();
Instantiate(QSBNetworkManager.singleton.ShipPrefab).SpawnWithServerAuthority();
}
QSBWorldSync.Init<QSBShipComponent, ShipComponent>();

View File

@ -44,7 +44,7 @@ namespace QSB.TornadoSync
private static void SpawnOccasional(OWRigidbody body, OWRigidbody refBody)
{
var transformSync = Instantiate(QSBNetworkManager.Instance.OccasionalPrefab).GetRequiredComponent<OccasionalTransformSync>();
var transformSync = Instantiate(QSBNetworkManager.singleton.OccasionalPrefab).GetRequiredComponent<OccasionalTransformSync>();
transformSync.InitBodyIndexes(body, refBody);
transformSync.gameObject.SpawnWithServerAuthority();
}

View File

@ -60,10 +60,10 @@ namespace QSB.WorldSync
public static void Rebuild(OWScene scene)
{
if (!QSBNetworkManager.Instance.IsReady)
if (!QSBNetworkManager.singleton.IsReady)
{
DebugLog.ToConsole($"Warning - Tried to rebuild WorldObjects when Network Manager not ready! Building when ready...", MessageType.Warning);
QSBCore.UnityEvents.RunWhen(() => QSBNetworkManager.Instance.IsReady, () => Rebuild(scene));
QSBCore.UnityEvents.RunWhen(() => QSBNetworkManager.singleton.IsReady, () => Rebuild(scene));
return;
}