2020-02-10 23:03:28 +01:00
|
|
|
|
using OWML.Common;
|
|
|
|
|
using OWML.ModHelper;
|
2020-11-06 22:05:43 +00:00
|
|
|
|
using OWML.ModHelper.Events;
|
2020-09-22 21:11:29 +01:00
|
|
|
|
using QSB.ConversationSync;
|
2020-08-12 21:58:29 +02:00
|
|
|
|
using QSB.ElevatorSync;
|
2020-08-13 14:32:58 +01:00
|
|
|
|
using QSB.GeyserSync;
|
2020-09-04 20:54:34 +01:00
|
|
|
|
using QSB.OrbSync;
|
2020-11-03 21:11:10 +00:00
|
|
|
|
using QSB.Patches;
|
2020-11-03 22:29:23 +00:00
|
|
|
|
using QSB.SectorSync;
|
2020-11-26 13:09:34 +00:00
|
|
|
|
using QSB.TimeSync;
|
2020-07-30 22:27:14 +02:00
|
|
|
|
using QSB.Utility;
|
2020-12-11 13:14:58 +00:00
|
|
|
|
using QuantumUNET;
|
2020-12-07 21:19:16 +00:00
|
|
|
|
using QuantumUNET.Components;
|
2020-02-10 23:03:28 +01:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Networking;
|
|
|
|
|
|
2020-02-15 20:48:02 +01:00
|
|
|
|
namespace QSB
|
|
|
|
|
{
|
2020-12-14 16:24:52 +00:00
|
|
|
|
public class QSBCore : ModBehaviour
|
2020-12-02 21:29:53 +00:00
|
|
|
|
{
|
|
|
|
|
public static IModBehaviour ModBehaviour { get; private set; }
|
|
|
|
|
public static IModHelper Helper { get; private set; }
|
|
|
|
|
public static string DefaultServerIP { get; private set; }
|
|
|
|
|
public static int Port { get; private set; }
|
|
|
|
|
public static bool DebugMode { get; private set; }
|
|
|
|
|
public static AssetBundle NetworkAssetBundle { get; private set; }
|
|
|
|
|
public static AssetBundle InstrumentAssetBundle { get; private set; }
|
|
|
|
|
public static bool HasWokenUp { get; set; }
|
2020-12-11 13:14:58 +00:00
|
|
|
|
public static bool IsServer => QSBNetworkServer.active;
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-12-14 21:41:56 +01:00
|
|
|
|
public void Awake()
|
2020-12-02 21:29:53 +00:00
|
|
|
|
{
|
|
|
|
|
Application.runInBackground = true;
|
2020-11-06 22:05:43 +00:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
var instance = TextTranslation.Get().GetValue<TextTranslation.TranslationTable>("m_table");
|
|
|
|
|
instance.theUITable[(int)UITextType.PleaseUseController] =
|
|
|
|
|
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...";
|
2020-11-11 08:31:20 +00:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
ModBehaviour = this;
|
2020-12-02 08:29:32 +00:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
LogFilter.currentLogLevel = LogFilter.Debug;
|
|
|
|
|
}
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-12-14 21:41:56 +01:00
|
|
|
|
public void Start()
|
2020-12-02 21:29:53 +00:00
|
|
|
|
{
|
|
|
|
|
Helper = ModHelper;
|
|
|
|
|
DebugLog.ToConsole($"* Start of QSB version {Helper.Manifest.Version} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
2020-08-20 19:31:10 +01:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network");
|
|
|
|
|
InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments");
|
2020-08-23 15:51:45 +02:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
QSBPatchManager.Init();
|
2020-11-03 21:11:10 +00:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
QSBPatchManager.DoPatchType(QSBPatchTypes.OnModStart);
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
gameObject.AddComponent<QSBNetworkManager>();
|
|
|
|
|
gameObject.AddComponent<QSBNetworkManagerHUD>();
|
|
|
|
|
gameObject.AddComponent<DebugActions>();
|
|
|
|
|
gameObject.AddComponent<ElevatorManager>();
|
|
|
|
|
gameObject.AddComponent<GeyserManager>();
|
|
|
|
|
gameObject.AddComponent<OrbManager>();
|
|
|
|
|
gameObject.AddComponent<QSBSectorManager>();
|
|
|
|
|
gameObject.AddComponent<ConversationManager>();
|
|
|
|
|
gameObject.AddComponent<QSBInputManager>();
|
|
|
|
|
gameObject.AddComponent<TimeSyncUI>();
|
2020-10-23 19:06:11 +01:00
|
|
|
|
|
2020-12-02 21:29:53 +00:00
|
|
|
|
// Stop players being able to pause
|
|
|
|
|
Helper.HarmonyHelper.EmptyMethod(typeof(OWTime).GetMethod("Pause"));
|
|
|
|
|
}
|
2020-03-02 17:34:01 +01:00
|
|
|
|
|
2020-12-14 21:20:53 +00:00
|
|
|
|
public void Update() =>
|
|
|
|
|
QSBNetworkIdentity.UNetStaticUpdate();
|
2020-12-02 18:40:38 +00:00
|
|
|
|
|
2020-12-14 21:20:53 +00:00
|
|
|
|
public override void Configure(IModConfig config)
|
2020-12-02 21:29:53 +00:00
|
|
|
|
{
|
|
|
|
|
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
|
|
|
|
Port = config.GetSettingsValue<int>("port");
|
|
|
|
|
if (QSBNetworkManager.Instance != null)
|
|
|
|
|
{
|
|
|
|
|
QSBNetworkManager.Instance.networkPort = Port;
|
|
|
|
|
}
|
|
|
|
|
DebugMode = config.GetSettingsValue<bool>("debugMode");
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-03 08:28:05 +00:00
|
|
|
|
}
|