Firstborn/Assets/RPG Creation Kit/Scripts/MainMenu/MainMenuUI.cs

88 lines
2.2 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using System.IO;
using UnityEngine.UI;
using TMPro;
using RPGCreationKit;
using RPGCreationKit.SaveSystem;
using UnityEngine.InputSystem;
using UnityEngine.EventSystems;
namespace RPGCreationKit
{
public class MainMenuUI : MonoBehaviour
{
public PlayerInput input;
public LoadPanel loadPanel;
public GameObject mainMenuButtons;
public GameObject defaultSelected;
public GameObject previouslySelected;
public GameObject LoginControls;
public GameObject Loading;
private void Start()
{
Time.timeScale = 1.0f;
RckInput.LoadInputSave();
RckInput.SetPlayerInputInstance(input);
OnShowingUp();
}
public void OnShowingUp()
{
mainMenuButtons.SetActive(true);
if (RckInput.isUsingGamepad)
{
if (previouslySelected != null)
EventSystem.current.SetSelectedGameObject(previouslySelected);
else
EventSystem.current.SetSelectedGameObject(defaultSelected);
}
}
private void Update()
{
}
public void MainMenuButton_Load()
{
previouslySelected = EventSystem.current.currentSelectedGameObject;
mainMenuButtons.SetActive(false);
loadPanel.gameObject.SetActive(true);
if(RckInput.isUsingGamepad)
loadPanel.SelectFirstElementInList();
}
public void SelectedButton(GameObject btn)
{
previouslySelected = btn;
}
public void MainMenuButton_NewGame()
{
mainMenuButtons.SetActive(false);
LoginControls.SetActive(false);
//Loading.SetActive(true);
LoadingScreenInfo.whatToLoad.Add("_CharacterCreation_");
SceneManager.LoadScene("_LoadingScreen_");
//SceneManager.LoadScene("_CharacterCreation_");
}
public void MainMenuButton_Exit()
{
Application.Quit();
}
}
}