Firstborn/Assets/RPG Creation Kit/Scripts/MainMenu/MainMenuUI.cs
Schaken-Mods 959e80cf72 assets upload
assets upload description.
2023-03-28 12:16:30 -05:00

92 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 ModManager;
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 LoadModManager()
{
mainMenuButtons.SetActive(false);
ModManager.SetActive(true);
}
public void MainMenu()
{
mainMenuButtons.SetActive(true);
ModManager.SetActive(false);
}
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()
{
SceneManager.LoadScene("_CharacterCreation_");
}
public void MainMenuButton_Exit()
{
Application.Quit();
}
}
}