add back in menu support

This commit is contained in:
Mister_Nebula 2021-10-16 16:57:01 +01:00
parent 56e6792ed4
commit 576c14b6c6
6 changed files with 6 additions and 141 deletions

View File

@ -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);

View File

@ -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<IMenuAPI>("_nebula.MenuFramework");
MenuApi = ModHelper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network");
InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments");
@ -94,9 +94,8 @@ namespace QSB
gameObject.AddComponent<RepeatingManager>();
gameObject.AddComponent<PlayerEntanglementWatcher>();
gameObject.AddComponent<DebugGUI>();
//gameObject.AddComponent<MenuManager>();
gameObject.AddComponent<MenuManager>();
gameObject.AddComponent<RespawnManager>();
gameObject.AddComponent<QNetworkManagerHUD>();
// WorldObject managers
gameObject.AddComponent<QuantumManager>();

View File

@ -36,7 +36,8 @@ namespace QSB.SectorSync
if (sync.HasAuthority
&& sync.AttachedObject.gameObject.activeInHierarchy
&& sync.IsReady)
&& sync.IsReady
&& sync.SectorSync.IsReady)
{
CheckTransformSyncSector(sync);
}

View File

@ -9,5 +9,6 @@
},
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
"version": "0.12.0-pr4",
"owmlVersion": "2.0.0"
"owmlVersion": "2.0.0",
"dependencies": [ "_nebula.MenuFramework" ]
}

View File

@ -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<QNetworkManager>();
}
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;
}
}

View File

@ -65,7 +65,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Components\QNetworkManagerHUD.cs" />
<Compile Include="Components\QNetworkTransformChild.cs" />
<Compile Include="Messages\QMsgType.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />