Firstborn/Assets/RPG Creation Kit/Scripts/MainMenu/MainMenuUI.cs
Schaken-Mods ca9718144f Update 4/24/23
Fixed the extra hair, Overhauled the Environment Manager, Removed Save Bloat, Added Loading Screen before Character Menu.
2023-04-24 17:54:43 -05:00

88 lines
2.2 KiB
C#

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