From 576c14b6c646f3e670cc9989c6ff763eefec1fd1 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 16 Oct 2021 16:57:01 +0100 Subject: [PATCH] add back in menu support --- QSB/Menus/IMenuAPI.cs | 7 - QSB/QSBCore.cs | 5 +- QSB/SectorSync/QSBSectorManager.cs | 3 +- QSB/manifest.json | 3 +- QuantumUNET/Components/QNetworkManagerHUD.cs | 128 ------------------- QuantumUNET/QuantumUNET.csproj | 1 - 6 files changed, 6 insertions(+), 141 deletions(-) delete mode 100644 QuantumUNET/Components/QNetworkManagerHUD.cs diff --git a/QSB/Menus/IMenuAPI.cs b/QSB/Menus/IMenuAPI.cs index e4682dd2..c30510f0 100644 --- a/QSB/Menus/IMenuAPI.cs +++ b/QSB/Menus/IMenuAPI.cs @@ -14,13 +14,6 @@ namespace QSB.Menus GameObject PauseMenu_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null, Menu customMenu = null); Button PauseMenu_MakeSimpleButton(string name, Menu customMenu = null); Menu PauseMenu_MakePauseListMenu(string title); - // Options - Menu OptionsMenu_MakeNonScrollingOptionsTab(string name); - GameObject OptionsMenu_MakeTwoButtonToggle(string label, string trueText, string falseText, string tooltipText, bool savedValue, Menu menuTab); - GameObject OptionsMenu_MakeNonDisplaySliderElement(string label, string tooltipText, float savedValue, Menu menuTab); - void OptionsMenu_MakeSpacer(float minHeight, Menu menuTab); - void OptionsMenu_MakeLabel(string label, Menu menuTab); - void OptionsMenu_MakeTextInput(string label, string tooltipText, string placeholderText, string savedValue, Menu menuTab); // Misc PopupMenu MakeTwoChoicePopup(string message, string confirmText, string cancelText); PopupInputMenu MakeInputFieldPopup(string message, string placeholderMessage, string confirmText, string cancelText); diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index 91dc9ee3..55c2fd1f 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -78,7 +78,7 @@ namespace QSB Helper = ModHelper; DebugLog.ToConsole($"* Start of QSB version {QSBVersion} - authored by {Helper.Manifest.Author}", MessageType.Info); - //MenuApi = ModHelper.Interaction.GetModApi("_nebula.MenuFramework"); + MenuApi = ModHelper.Interaction.GetModApi("_nebula.MenuFramework"); NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network"); InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments"); @@ -94,9 +94,8 @@ namespace QSB gameObject.AddComponent(); gameObject.AddComponent(); gameObject.AddComponent(); - //gameObject.AddComponent(); + gameObject.AddComponent(); gameObject.AddComponent(); - gameObject.AddComponent(); // WorldObject managers gameObject.AddComponent(); diff --git a/QSB/SectorSync/QSBSectorManager.cs b/QSB/SectorSync/QSBSectorManager.cs index 3bbc053a..9dedaa14 100644 --- a/QSB/SectorSync/QSBSectorManager.cs +++ b/QSB/SectorSync/QSBSectorManager.cs @@ -36,7 +36,8 @@ namespace QSB.SectorSync if (sync.HasAuthority && sync.AttachedObject.gameObject.activeInHierarchy - && sync.IsReady) + && sync.IsReady + && sync.SectorSync.IsReady) { CheckTransformSyncSector(sync); } diff --git a/QSB/manifest.json b/QSB/manifest.json index 3779d4d0..32918373 100644 --- a/QSB/manifest.json +++ b/QSB/manifest.json @@ -9,5 +9,6 @@ }, "uniqueName": "Raicuparta.QuantumSpaceBuddies", "version": "0.12.0-pr4", - "owmlVersion": "2.0.0" + "owmlVersion": "2.0.0", + "dependencies": [ "_nebula.MenuFramework" ] } \ No newline at end of file diff --git a/QuantumUNET/Components/QNetworkManagerHUD.cs b/QuantumUNET/Components/QNetworkManagerHUD.cs deleted file mode 100644 index 2da86771..00000000 --- a/QuantumUNET/Components/QNetworkManagerHUD.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.ComponentModel; -using UnityEngine; - -namespace QuantumUNET.Components -{ - [EditorBrowsable(EditorBrowsableState.Never)] - public class QNetworkManagerHUD : MonoBehaviour - { - private void Awake() - { - this.manager = base.GetComponent(); - } - - private void OnGUI() - { - if (this.showGUI) - { - int num = 10 + this.offsetX; - int num2 = 40 + this.offsetY; - bool flag = this.manager.client == null || this.manager.client.connection == null || this.manager.client.connection.connectionId == -1; - if (!this.manager.IsClientConnected() && !QNetworkServer.active) - { - if (flag) - { - if (Application.platform != RuntimePlatform.WebGLPlayer) - { - if (GUI.Button(new Rect((float)num, (float)num2, 200f, 20f), "LAN Host(H)")) - { - this.manager.StartHost(); - } - num2 += 24; - } - if (GUI.Button(new Rect((float)num, (float)num2, 105f, 20f), "LAN Client(C)")) - { - this.manager.StartClient(); - } - this.manager.networkAddress = GUI.TextField(new Rect((float)(num + 100), (float)num2, 95f, 20f), this.manager.networkAddress); - num2 += 24; - if (Application.platform == RuntimePlatform.WebGLPlayer) - { - GUI.Box(new Rect((float)num, (float)num2, 200f, 25f), "( WebGL cannot be server )"); - num2 += 24; - } - else - { - if (GUI.Button(new Rect((float)num, (float)num2, 200f, 20f), "LAN Server Only(S)")) - { - this.manager.StartServer(); - } - num2 += 24; - } - } - else - { - GUI.Label(new Rect((float)num, (float)num2, 200f, 20f), string.Concat(new object[] - { - "Connecting to ", - this.manager.networkAddress, - ":", - this.manager.networkPort, - ".." - })); - num2 += 24; - if (GUI.Button(new Rect((float)num, (float)num2, 200f, 20f), "Cancel Connection Attempt")) - { - this.manager.StopClient(); - } - } - } - else - { - if (QNetworkServer.active) - { - string text = "Server: port=" + this.manager.networkPort; - GUI.Label(new Rect((float)num, (float)num2, 300f, 20f), text); - num2 += 24; - } - if (this.manager.IsClientConnected()) - { - GUI.Label(new Rect((float)num, (float)num2, 300f, 20f), string.Concat(new object[] - { - "Client: address=", - this.manager.networkAddress, - " port=", - this.manager.networkPort - })); - num2 += 24; - } - } - - if (this.manager.IsClientConnected() && !QClientScene.ready) - { - if (GUI.Button(new Rect((float)num, (float)num2, 200f, 20f), "Client Ready")) - { - QClientScene.Ready(this.manager.client.connection); - if (QClientScene.localPlayers.Count == 0) - { - QClientScene.AddPlayer(0); - } - } - num2 += 24; - } - - if (QNetworkServer.active || this.manager.IsClientConnected()) - { - if (GUI.Button(new Rect((float)num, (float)num2, 200f, 20f), "Stop (X)")) - { - this.manager.StopHost(); - } - num2 += 24; - } - } - } - - public QNetworkManager manager; - - [SerializeField] - public bool showGUI = true; - - [SerializeField] - public int offsetX; - - [SerializeField] - public int offsetY; - - private bool m_ShowServer; - } -} diff --git a/QuantumUNET/QuantumUNET.csproj b/QuantumUNET/QuantumUNET.csproj index 861b1034..74f0f29a 100644 --- a/QuantumUNET/QuantumUNET.csproj +++ b/QuantumUNET/QuantumUNET.csproj @@ -65,7 +65,6 @@ -