mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 03:28:26 +00:00
added basic menus
This commit is contained in:
parent
76f6bf232f
commit
66ce7b6927
32
QSB/Menus/IMenuAPI.cs
Normal file
32
QSB/Menus/IMenuAPI.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace QSB.Menus
|
||||
{
|
||||
public interface IMenuAPI
|
||||
{
|
||||
// Title screen
|
||||
GameObject TitleScreen_MakeMenuOpenButton(string name, Menu menuToOpen);
|
||||
GameObject TitleScreen_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null);
|
||||
Button TitleScreen_MakeSimpleButton(string name);
|
||||
// Pause menu
|
||||
GameObject PauseMenu_MakeMenuOpenButton(string name, Menu menuToOpen, Menu customMenu = null);
|
||||
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 placeholderText, string savedValue, Menu menuTab);
|
||||
// Misc
|
||||
PopupMenu MakeTwoChoicePopup(string message, string confirmText, string cancelText);
|
||||
PopupInputMenu MakeInputFieldPopup(string message, string placeholderMessage, string confirmText, string cancelText);
|
||||
}
|
||||
}
|
55
QSB/Menus/MenuManager.cs
Normal file
55
QSB/Menus/MenuManager.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Menus
|
||||
{
|
||||
class MenuManager : MonoBehaviour
|
||||
{
|
||||
private IMenuAPI MenuApi => QSBCore.MenuApi;
|
||||
private PopupMenu HostWaitingPopup;
|
||||
private PopupMenu ClientWaitingPopup;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
MakeTitleMenus();
|
||||
}
|
||||
|
||||
private void MakeTitleMenus()
|
||||
{
|
||||
HostWaitingPopup = MenuApi.MakeTwoChoicePopup("Waiting for players to join...", "Start Multiplayer Game", "Stop Server");
|
||||
HostWaitingPopup.OnPopupCancel += StopServerOrLeaveServer;
|
||||
ClientWaitingPopup = MenuApi.MakeTwoChoicePopup("Waiting for game to start...", "uhhhhh", "Disconnect");
|
||||
ClientWaitingPopup.OnPopupCancel += StopServerOrLeaveServer;
|
||||
|
||||
var hostButton = MenuApi.TitleScreen_MakeSimpleButton("HOST SERVER");
|
||||
hostButton.onClick.AddListener(HostServer);
|
||||
var connectButton = MenuApi.TitleScreen_MakeSimpleButton("CONNECT TO SERVER");
|
||||
connectButton.onClick.AddListener(ConnectToServer);
|
||||
|
||||
var menu = MenuApi.OptionsMenu_MakeNonScrollingOptionsTab("MULTIPLAYER");
|
||||
//MenuApi.OptionsMenu_MakeLabel("Connection Information", menu);
|
||||
MenuApi.OptionsMenu_MakeTextInput("IP Address", "IP Address", QSBCore.DefaultServerIP, menu);
|
||||
MenuApi.OptionsMenu_MakeTextInput("Port", "Port", $"{QSBCore.Port}", menu);
|
||||
}
|
||||
|
||||
private void HostServer()
|
||||
{
|
||||
HostWaitingPopup.EnableMenu(true);
|
||||
QSBNetworkManager.Instance.StartHost();
|
||||
}
|
||||
|
||||
private void StopServerOrLeaveServer()
|
||||
{
|
||||
QSBNetworkManager.Instance.StopHost();
|
||||
}
|
||||
|
||||
private void ConnectToServer()
|
||||
{
|
||||
ClientWaitingPopup.EnableMenu(true);
|
||||
QSBNetworkManager.Instance.StartClient();
|
||||
}
|
||||
}
|
||||
}
|
@ -159,6 +159,8 @@
|
||||
<Compile Include="Instruments\QSBCamera\CameraManager.cs" />
|
||||
<Compile Include="Instruments\QSBCamera\CameraMode.cs" />
|
||||
<Compile Include="Instruments\InstrumentsManager.cs" />
|
||||
<Compile Include="Menus\IMenuAPI.cs" />
|
||||
<Compile Include="Menus\MenuManager.cs" />
|
||||
<Compile Include="Messaging\BoolMessage.cs" />
|
||||
<Compile Include="OrbSync\TransformSync\NomaiOrbTransformSync.cs" />
|
||||
<Compile Include="Player\Patches\PlayerPatches.cs" />
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<GameDir>E:\Epic\Epic Games\OuterWilds</GameDir>
|
||||
<GameDir>D:\EpicGames\OuterWilds</GameDir>
|
||||
<OwmlDir>C:\Users\Henry\AppData\Roaming\OuterWildsModManager\OWML</OwmlDir>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
|
@ -8,6 +8,7 @@ using QSB.ConversationSync;
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.GeyserSync;
|
||||
using QSB.ItemSync;
|
||||
using QSB.Menus;
|
||||
using QSB.OrbSync;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
@ -69,6 +70,7 @@ namespace QSB
|
||||
public static bool IsInMultiplayer => QNetworkManager.singleton.isNetworkActive;
|
||||
public static string QSBVersion => Helper.Manifest.Version;
|
||||
public static GameObject GameObjectInstance => _thisInstance.gameObject;
|
||||
public static IMenuAPI MenuApi { get; private set; }
|
||||
|
||||
private static QSBCore _thisInstance;
|
||||
private const float _debugLineSpacing = 11f;
|
||||
@ -89,6 +91,8 @@ namespace QSB
|
||||
Helper = ModHelper;
|
||||
DebugLog.ToConsole($"* Start of QSB version {Helper.Manifest.Version} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
||||
|
||||
MenuApi = ModHelper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
|
||||
|
||||
NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network");
|
||||
InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments");
|
||||
ConversationAssetBundle = Helper.Assets.LoadBundle("assets/conversation");
|
||||
@ -96,7 +100,7 @@ namespace QSB
|
||||
QSBPatchManager.Init();
|
||||
|
||||
gameObject.AddComponent<QSBNetworkManager>();
|
||||
gameObject.AddComponent<QNetworkManagerHUD>();
|
||||
//gameObject.AddComponent<QNetworkManagerHUD>();
|
||||
gameObject.AddComponent<DebugActions>();
|
||||
gameObject.AddComponent<ConversationManager>();
|
||||
gameObject.AddComponent<QSBInputManager>();
|
||||
@ -104,6 +108,7 @@ namespace QSB
|
||||
gameObject.AddComponent<RepeatingManager>();
|
||||
gameObject.AddComponent<PlayerEntanglementWatcher>();
|
||||
gameObject.AddComponent<ShipManager>();
|
||||
gameObject.AddComponent<MenuManager>();
|
||||
|
||||
// WorldObject managers
|
||||
gameObject.AddComponent<QuantumManager>();
|
||||
|
@ -5,9 +5,10 @@
|
||||
"description": "Adds online multiplayer to the game.",
|
||||
"warning": {
|
||||
"title": "Follow these steps before playing multiplayer :",
|
||||
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications.\n- Make sure you have forwarded/opened the correct ports. (See the GitHub readme.)"
|
||||
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications.\n- Make sure you have forwarded/opened the correct ports. (See the GitHub readme.)"
|
||||
},
|
||||
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
|
||||
"version": "0.11.0",
|
||||
"owmlVersion": "1.1.8"
|
||||
"owmlVersion": "1.1.8",
|
||||
"dependencies": [ "_nebula.MenuFramework" ]
|
||||
}
|
@ -57,7 +57,7 @@
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UNETModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<GameDir>E:\Epic\Epic Games\OuterWilds</GameDir>
|
||||
<GameDir>D:\EpicGames\OuterWilds</GameDir>
|
||||
<OwmlDir>C:\Users\Henry\AppData\Roaming\OuterWildsModManager\OWML</OwmlDir>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user