2020-02-10 22:03:28 +00:00
|
|
|
|
using OWML.Common;
|
|
|
|
|
using OWML.ModHelper;
|
2020-11-06 22:05:43 +00:00
|
|
|
|
using OWML.ModHelper.Events;
|
2020-09-22 20:11:29 +00:00
|
|
|
|
using QSB.ConversationSync;
|
2020-08-12 19:58:29 +00:00
|
|
|
|
using QSB.ElevatorSync;
|
2020-08-13 13:32:58 +00:00
|
|
|
|
using QSB.GeyserSync;
|
2020-09-04 19:54:34 +00: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 20:27:14 +00:00
|
|
|
|
using QSB.Utility;
|
2020-02-10 22:03:28 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Networking;
|
|
|
|
|
|
2020-02-15 19:48:02 +00:00
|
|
|
|
namespace QSB
|
|
|
|
|
{
|
|
|
|
|
public class QSB : ModBehaviour
|
|
|
|
|
{
|
2020-11-11 08:31:20 +00:00
|
|
|
|
public static IModBehaviour ModBehaviour { get; private set; }
|
2020-08-23 10:42:48 +00:00
|
|
|
|
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; }
|
2020-11-14 14:12:37 +00:00
|
|
|
|
public static AssetBundle InstrumentAssetBundle { get; private set; }
|
2020-09-06 08:07:31 +00:00
|
|
|
|
public static bool HasWokenUp { get; set; }
|
2020-02-10 22:03:28 +00:00
|
|
|
|
|
2020-02-15 19:48:02 +00:00
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
2020-02-10 22:03:28 +00:00
|
|
|
|
Application.runInBackground = true;
|
2020-11-06 22:05:43 +00:00
|
|
|
|
|
|
|
|
|
var instance = TextTranslation.Get().GetValue<TextTranslation.TranslationTable>("m_table");
|
2020-11-10 09:05:27 +00:00
|
|
|
|
instance.theUITable[(int)UITextType.PleaseUseController] =
|
2020-11-10 13:36:28 +00:00
|
|
|
|
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...";
|
2020-11-11 08:31:20 +00:00
|
|
|
|
|
|
|
|
|
ModBehaviour = this;
|
2020-12-02 08:29:32 +00:00
|
|
|
|
|
|
|
|
|
LogFilter.currentLogLevel = LogFilter.Debug;
|
|
|
|
|
|
2020-12-02 09:51:53 +00:00
|
|
|
|
// Application.logMessageReceived += Application_logMessageReceived;
|
2020-12-02 08:29:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Application_logMessageReceived(string condition, string stackTrace, LogType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case LogType.Assert:
|
|
|
|
|
DebugLog.DebugWrite($"Assert - {condition}", MessageType.Message);
|
|
|
|
|
break;
|
|
|
|
|
case LogType.Log:
|
|
|
|
|
DebugLog.DebugWrite($"Log - {condition}", MessageType.Message);
|
|
|
|
|
break;
|
|
|
|
|
case LogType.Warning:
|
|
|
|
|
DebugLog.DebugWrite($"Warning - {condition}", MessageType.Warning);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-02-10 22:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-15 19:48:02 +00:00
|
|
|
|
private void Start()
|
|
|
|
|
{
|
2020-08-20 13:10:37 +00:00
|
|
|
|
Helper = ModHelper;
|
2020-08-20 13:47:44 +00:00
|
|
|
|
DebugLog.ToConsole($"* Start of QSB version {Helper.Manifest.Version} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
2020-08-20 18:31:10 +00:00
|
|
|
|
|
2020-08-17 15:51:56 +00:00
|
|
|
|
NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network");
|
2020-11-14 14:12:37 +00:00
|
|
|
|
InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments");
|
2020-08-23 13:51:45 +00:00
|
|
|
|
|
2020-11-03 21:11:10 +00:00
|
|
|
|
QSBPatchManager.Init();
|
|
|
|
|
|
|
|
|
|
QSBPatchManager.DoPatchType(QSBPatchTypes.OnModStart);
|
2020-02-10 22:03:28 +00:00
|
|
|
|
|
2020-08-20 13:47:44 +00:00
|
|
|
|
// Turns out these are very finicky about what order they go. QSBNetworkManager seems to
|
|
|
|
|
// want to go first-ish, otherwise the NetworkManager complains about the PlayerPrefab being
|
2020-08-23 10:42:48 +00:00
|
|
|
|
// null (even though it isn't...)
|
2020-08-20 13:47:44 +00:00
|
|
|
|
gameObject.AddComponent<QSBNetworkManager>();
|
|
|
|
|
gameObject.AddComponent<NetworkManagerHUD>();
|
2020-03-14 20:42:43 +00:00
|
|
|
|
gameObject.AddComponent<DebugActions>();
|
2020-08-12 20:22:52 +00:00
|
|
|
|
gameObject.AddComponent<ElevatorManager>();
|
2020-08-13 17:25:12 +00:00
|
|
|
|
gameObject.AddComponent<GeyserManager>();
|
2020-09-29 20:34:46 +00:00
|
|
|
|
gameObject.AddComponent<OrbManager>();
|
2020-08-16 15:15:36 +00:00
|
|
|
|
gameObject.AddComponent<QSBSectorManager>();
|
2020-09-22 20:11:29 +00:00
|
|
|
|
gameObject.AddComponent<ConversationManager>();
|
2020-11-11 08:31:20 +00:00
|
|
|
|
gameObject.AddComponent<QSBInputManager>();
|
2020-11-26 19:46:09 +00:00
|
|
|
|
gameObject.AddComponent<TimeSyncUI>();
|
2020-10-23 18:06:11 +00:00
|
|
|
|
|
2020-11-26 19:46:09 +00:00
|
|
|
|
// Stop players being able to pause
|
2020-11-26 19:16:05 +00:00
|
|
|
|
Helper.HarmonyHelper.EmptyMethod(typeof(OWTime).GetMethod("Pause"));
|
2020-03-02 16:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Configure(IModConfig config)
|
|
|
|
|
{
|
|
|
|
|
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
2020-08-23 10:42:48 +00:00
|
|
|
|
Port = config.GetSettingsValue<int>("port");
|
|
|
|
|
if (QSBNetworkManager.Instance != null)
|
|
|
|
|
{
|
|
|
|
|
QSBNetworkManager.Instance.networkPort = Port;
|
|
|
|
|
}
|
2020-03-14 20:42:43 +00:00
|
|
|
|
DebugMode = config.GetSettingsValue<bool>("debugMode");
|
2020-02-10 22:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|