86 lines
2.5 KiB
C#
86 lines
2.5 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using Com.LuisPedroFonseca.ProCamera2D;
|
||
|
|
using UnityEngine.SceneManagement;
|
||
|
|
using TMPro;
|
||
|
|
|
||
|
|
public class MainMenuController : MonoBehaviour
|
||
|
|
{
|
||
|
|
[SerializeField] ProCamera2DTransitionsFX transition;
|
||
|
|
[SerializeField] RectTransform menuPanel;
|
||
|
|
[SerializeField] RectTransform newGamePanel;
|
||
|
|
|
||
|
|
[SerializeField] TMP_InputField girlName;
|
||
|
|
[SerializeField] TMP_InputField playerName;
|
||
|
|
|
||
|
|
[SerializeField] AudioClip mainMenuMusicIntro;
|
||
|
|
[SerializeField] AudioClip mainMenuMusic;
|
||
|
|
|
||
|
|
MusicFadeController music;
|
||
|
|
|
||
|
|
void NewGame() {
|
||
|
|
GameData.GLOBAL = new GameData();
|
||
|
|
GameData.GLOBAL.characterNames[Character.Her] = girlName.text;
|
||
|
|
GameData.GLOBAL.characterNames[Character.You] = playerName.text;
|
||
|
|
GameData.Save();
|
||
|
|
Debug.Log("She's named " + GameData.GLOBAL.characterNames[Character.Her]);
|
||
|
|
Debug.Log("You're named " + GameData.GLOBAL.characterNames[Character.You]);
|
||
|
|
VNData.NextScene = Dialogue.Intro;
|
||
|
|
SceneManager.LoadScene("SceneViewer");
|
||
|
|
}
|
||
|
|
|
||
|
|
void Continue() {
|
||
|
|
GameData.Load();
|
||
|
|
SceneManager.LoadScene("Manager");
|
||
|
|
}
|
||
|
|
|
||
|
|
void Quit() {
|
||
|
|
Application.Quit();
|
||
|
|
}
|
||
|
|
|
||
|
|
void StartTransition() {
|
||
|
|
Debug.Log("TODO: Make a sound");
|
||
|
|
transition.TransitionExit();
|
||
|
|
music.FadeOut(0.5f);
|
||
|
|
menuPanel.gameObject.SetActive(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void PressedNewGame() {
|
||
|
|
newGamePanel.gameObject.SetActive(true);
|
||
|
|
menuPanel.gameObject.SetActive(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void PressedNewGameBack() {
|
||
|
|
newGamePanel.gameObject.SetActive(false);
|
||
|
|
menuPanel.gameObject.SetActive(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void PressedNewGameStart() {
|
||
|
|
transition.OnTransitionExitEnded = NewGame;
|
||
|
|
StartTransition();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void PressedContinue() {
|
||
|
|
transition.OnTransitionExitEnded = Continue;
|
||
|
|
StartTransition();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void PressedQuit() {
|
||
|
|
transition.OnTransitionExitEnded = Quit;
|
||
|
|
StartTransition();
|
||
|
|
}
|
||
|
|
|
||
|
|
// Start is called before the first frame update
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
transition.TransitionEnter();
|
||
|
|
music = GameObject.FindWithTag("Music").GetComponent<MusicFadeController>();
|
||
|
|
music.audioSource.clip = mainMenuMusicIntro;
|
||
|
|
music.audioSource.Play();
|
||
|
|
music.shouldLoop = true;
|
||
|
|
music.PlayMainMenuLoopAfter(mainMenuMusicIntro.length, mainMenuMusic);
|
||
|
|
music.FadeIn(0.0f);
|
||
|
|
}
|
||
|
|
}
|