124 lines
4.0 KiB
C#
124 lines
4.0 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using Com.LuisPedroFonseca.ProCamera2D;
|
||
|
|
using UnityEngine.SceneManagement;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
public class ManagerController : MonoBehaviour {
|
||
|
|
[SerializeField] ProCamera2DTransitionsFX transition;
|
||
|
|
[SerializeField] string mainGameSceneName;
|
||
|
|
[SerializeField] string mainMenuSceneName;
|
||
|
|
[SerializeField] string sceneViewerSceneName;
|
||
|
|
[SerializeField] string managerSceneName;
|
||
|
|
[SerializeField] RectTransform menuBox;
|
||
|
|
[SerializeField] RectTransform dialogueBox;
|
||
|
|
[SerializeField] RectTransform optionPicker;
|
||
|
|
[SerializeField] RectTransform scenePicker;
|
||
|
|
[SerializeField] RectTransform sidePiecePicker;
|
||
|
|
[SerializeField] VerticalLayoutGroup scenePickerList;
|
||
|
|
|
||
|
|
[SerializeField] RectTransform iridaPickButton;
|
||
|
|
[SerializeField] RectTransform clemPickButton;
|
||
|
|
[SerializeField] RectTransform schroderPickButton;
|
||
|
|
|
||
|
|
[SerializeField] GameObject ScenePickerButtonProto;
|
||
|
|
|
||
|
|
private void Start() {
|
||
|
|
transition.TransitionEnter();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void SaveButtonPressed() {
|
||
|
|
Debug.Log("TODO: Autosave toggle as option");
|
||
|
|
GameData.Save();
|
||
|
|
Debug.Log("TODO: Play a save noise");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OptionScenePickerPressed() {
|
||
|
|
foreach (Transform child in scenePickerList.transform) {
|
||
|
|
Destroy(child.gameObject);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Get all unlocked scenes.
|
||
|
|
foreach (Dialogue d in VNData.DIALOGUE_DESCRIPTIONS.Keys) {
|
||
|
|
if (!VNData.UNLOCKABLES.ContainsKey(d) ||
|
||
|
|
GameData.IsUnlocked(VNData.UNLOCKABLES[d])) {
|
||
|
|
ViewSceneButtonController newButton = Instantiate(ScenePickerButtonProto).GetComponent<ViewSceneButtonController>();
|
||
|
|
newButton.SetUp(d);
|
||
|
|
newButton.transform.SetParent(scenePickerList.transform);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
scenePicker.gameObject.SetActive(true);
|
||
|
|
optionPicker.gameObject.SetActive(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnChangeSidePiecePressed() {
|
||
|
|
|
||
|
|
optionPicker.gameObject.SetActive(false);
|
||
|
|
sidePiecePicker.gameObject.SetActive(true);
|
||
|
|
iridaPickButton.gameObject.SetActive(GameData.IsPlayerUnlocked(Employee.Irida));
|
||
|
|
clemPickButton.gameObject.SetActive(GameData.IsPlayerUnlocked(Employee.Clem));
|
||
|
|
schroderPickButton.gameObject.SetActive(GameData.IsPlayerUnlocked(Employee.Schroder));
|
||
|
|
}
|
||
|
|
|
||
|
|
public void SidePiecePickerBackPressed() {
|
||
|
|
optionPicker.gameObject.SetActive(true);
|
||
|
|
sidePiecePicker.gameObject.SetActive(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void ScenePickerBackPressed() {
|
||
|
|
scenePicker.gameObject.SetActive(false);
|
||
|
|
optionPicker.gameObject.SetActive(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void PickSidePiece(int e) {
|
||
|
|
// Why does Modern UI Pack not support enums?!
|
||
|
|
GameData.GLOBAL.sidePiece = (Employee)e;
|
||
|
|
transition.OnTransitionExitEnded = ResetManager;
|
||
|
|
StartTransition();
|
||
|
|
}
|
||
|
|
|
||
|
|
void MainMenu() {
|
||
|
|
SceneManager.LoadScene(mainMenuSceneName);
|
||
|
|
}
|
||
|
|
|
||
|
|
void NextDay() {
|
||
|
|
SceneManager.LoadScene(mainGameSceneName);
|
||
|
|
}
|
||
|
|
|
||
|
|
void ShowVNScene() {
|
||
|
|
SceneManager.LoadScene(sceneViewerSceneName);
|
||
|
|
}
|
||
|
|
|
||
|
|
void ResetManager() {
|
||
|
|
SceneManager.LoadScene(managerSceneName);
|
||
|
|
}
|
||
|
|
|
||
|
|
void StartTransition() {
|
||
|
|
transition.TransitionExit();
|
||
|
|
menuBox.gameObject.SetActive(false);
|
||
|
|
dialogueBox.gameObject.SetActive(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void SceneViewButtonPressed(Dialogue scene) {
|
||
|
|
VNData.NextScene = scene;
|
||
|
|
transition.OnTransitionExitEnded = ShowVNScene;
|
||
|
|
StartTransition();
|
||
|
|
Debug.Log("TODO: Make a sound");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void NextDayPressed() {
|
||
|
|
transition.OnTransitionExitEnded = NextDay;
|
||
|
|
StartTransition();
|
||
|
|
Debug.Log("TODO: Make a sound");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void MainMenuPressed() {
|
||
|
|
Debug.Log("TODO: Maybe add save-first confirmation, or auto-save");
|
||
|
|
transition.OnTransitionExitEnded = MainMenu;
|
||
|
|
StartTransition();
|
||
|
|
Debug.Log("TODO: Make a sound");
|
||
|
|
}
|
||
|
|
}
|