117 lines
2.5 KiB
C#
117 lines
2.5 KiB
C#
|
using Dissonance;
|
||
|
using TMPro;
|
||
|
using Unity.Netcode;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class QuickMenuManager : MonoBehaviour
|
||
|
{
|
||
|
[Header("HUD")]
|
||
|
public TextMeshProUGUI interactTipText;
|
||
|
|
||
|
public TextMeshProUGUI leaveGameClarificationText;
|
||
|
|
||
|
public Image cursorIcon;
|
||
|
|
||
|
[Header("In-game Menu")]
|
||
|
public GameObject menuContainer;
|
||
|
|
||
|
public GameObject mainButtonsPanel;
|
||
|
|
||
|
public GameObject leaveGameConfirmPanel;
|
||
|
|
||
|
public GameObject settingsPanel;
|
||
|
|
||
|
public bool isMenuOpen;
|
||
|
|
||
|
private int currentMicrophoneDevice;
|
||
|
|
||
|
public TextMeshProUGUI currentMicrophoneText;
|
||
|
|
||
|
public DissonanceComms voiceChatModule;
|
||
|
|
||
|
public TextMeshProUGUI changesNotAppliedText;
|
||
|
|
||
|
public TextMeshProUGUI settingsBackButton;
|
||
|
|
||
|
public GameObject PleaseConfirmChangesSettingsPanel;
|
||
|
|
||
|
public Button PleaseConfirmChangesSettingsPanelBackButton;
|
||
|
|
||
|
public CanvasGroup inviteFriendsTextAlpha;
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
currentMicrophoneDevice = PlayerPrefs.GetInt("LethalCompany_currentMic", 0);
|
||
|
}
|
||
|
|
||
|
public void OpenQuickMenu()
|
||
|
{
|
||
|
menuContainer.SetActive(value: true);
|
||
|
Cursor.lockState = CursorLockMode.None;
|
||
|
if (!StartOfRound.Instance.localPlayerUsingController)
|
||
|
{
|
||
|
Cursor.visible = true;
|
||
|
}
|
||
|
isMenuOpen = true;
|
||
|
}
|
||
|
|
||
|
public void CloseQuickMenu()
|
||
|
{
|
||
|
if (settingsPanel.activeSelf)
|
||
|
{
|
||
|
IngamePlayerSettings.Instance.DiscardChangedSettings();
|
||
|
}
|
||
|
CloseQuickMenuPanels();
|
||
|
menuContainer.SetActive(value: false);
|
||
|
Cursor.lockState = CursorLockMode.Locked;
|
||
|
Cursor.visible = false;
|
||
|
isMenuOpen = false;
|
||
|
}
|
||
|
|
||
|
public void CloseQuickMenuPanels()
|
||
|
{
|
||
|
leaveGameConfirmPanel.SetActive(value: false);
|
||
|
settingsPanel.SetActive(value: false);
|
||
|
mainButtonsPanel.SetActive(value: true);
|
||
|
}
|
||
|
|
||
|
public void DisableInviteFriendsButton()
|
||
|
{
|
||
|
inviteFriendsTextAlpha.alpha = 0.5f;
|
||
|
}
|
||
|
|
||
|
public void InviteFriendsButton()
|
||
|
{
|
||
|
if (!GameNetworkManager.Instance.gameHasStarted)
|
||
|
{
|
||
|
GameNetworkManager.Instance.InviteFriendsUI();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void LeaveGame()
|
||
|
{
|
||
|
leaveGameConfirmPanel.SetActive(value: true);
|
||
|
mainButtonsPanel.SetActive(value: false);
|
||
|
leaveGameClarificationText.enabled = NetworkManager.Singleton != null && NetworkManager.Singleton.IsServer && !StartOfRound.Instance.inShipPhase;
|
||
|
}
|
||
|
|
||
|
public void LeaveGameConfirm()
|
||
|
{
|
||
|
if (GameNetworkManager.Instance != null)
|
||
|
{
|
||
|
GameNetworkManager.Instance.Disconnect();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void EnableUIPanel(GameObject enablePanel)
|
||
|
{
|
||
|
enablePanel.SetActive(value: true);
|
||
|
}
|
||
|
|
||
|
public void DisableUIPanel(GameObject enablePanel)
|
||
|
{
|
||
|
enablePanel.SetActive(value: false);
|
||
|
}
|
||
|
}
|