2020-02-10 22:03:28 +00:00
|
|
|
|
using OWML.Common;
|
|
|
|
|
using OWML.ModHelper;
|
2020-02-12 20:39:59 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-02-10 22:03:28 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Networking;
|
|
|
|
|
|
|
|
|
|
namespace QSB {
|
|
|
|
|
public class QSB: ModBehaviour {
|
2020-02-13 19:34:51 +00:00
|
|
|
|
public static IModHelper Helper;
|
2020-02-10 22:03:28 +00:00
|
|
|
|
static QSB _instance;
|
|
|
|
|
|
|
|
|
|
void Awake () {
|
|
|
|
|
Application.runInBackground = true;
|
|
|
|
|
Cursor.lockState = CursorLockMode.None;
|
|
|
|
|
Cursor.visible = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Update () {
|
|
|
|
|
Cursor.lockState = CursorLockMode.None;
|
|
|
|
|
Cursor.visible = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Start () {
|
|
|
|
|
_instance = this;
|
2020-02-13 19:34:51 +00:00
|
|
|
|
Helper = ModHelper;
|
2020-02-10 22:03:28 +00:00
|
|
|
|
|
2020-02-13 19:34:51 +00:00
|
|
|
|
gameObject.AddComponent<QSBNetworkManager>();
|
2020-02-13 19:23:26 +00:00
|
|
|
|
gameObject.AddComponent<NetworkManagerHUD>();
|
2020-02-10 22:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-12 20:39:59 +00:00
|
|
|
|
static string JoinAll (params object[] logObjects) {
|
|
|
|
|
var result = "";
|
|
|
|
|
foreach (var obj in logObjects) {
|
|
|
|
|
result += obj + " ";
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2020-02-10 22:03:28 +00:00
|
|
|
|
}
|
2020-02-11 18:56:57 +00:00
|
|
|
|
|
2020-02-12 21:43:31 +00:00
|
|
|
|
public static void Log (params object[] logObjects) {
|
|
|
|
|
_instance.ModHelper.Console.WriteLine(JoinAll(logObjects));
|
|
|
|
|
}
|
2020-02-12 20:39:59 +00:00
|
|
|
|
|
|
|
|
|
public static void LogToScreen (params object[] logObjects) {
|
2020-02-13 19:23:26 +00:00
|
|
|
|
if (Locator.GetPlayerBody() == null) {
|
|
|
|
|
Log("Warning: tried to log to HUD but player is not ready.");
|
|
|
|
|
Log(logObjects);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-02-12 20:39:59 +00:00
|
|
|
|
NotificationData data = new NotificationData(NotificationTarget.Player, JoinAll(logObjects), 5f, true);
|
2020-02-11 18:56:57 +00:00
|
|
|
|
NotificationManager.SharedInstance.PostNotification(data, false);
|
|
|
|
|
}
|
2020-02-10 22:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|