2023-01-24 19:31:49 +00:00
|
|
|
using System;
|
2022-07-04 16:57:19 +00:00
|
|
|
using UnityEngine;
|
2023-01-24 19:31:49 +00:00
|
|
|
using UnityEngine.UI;
|
2022-07-04 16:57:19 +00:00
|
|
|
using TMPro;
|
|
|
|
|
2023-05-07 20:33:15 +00:00
|
|
|
using HeavenStudio.Editor;
|
2023-01-24 19:31:49 +00:00
|
|
|
|
2023-05-07 20:33:15 +00:00
|
|
|
namespace HeavenStudio.Common
|
2022-07-04 16:57:19 +00:00
|
|
|
{
|
2022-08-27 03:43:01 +00:00
|
|
|
public class SettingsDialog : Dialog
|
2022-07-04 16:57:19 +00:00
|
|
|
{
|
2022-10-13 16:20:48 +00:00
|
|
|
[SerializeField] private TMP_Text BuildDateDisplay;
|
2023-01-24 19:31:49 +00:00
|
|
|
[SerializeField] private TabsManager tabsManager;
|
|
|
|
[SerializeField] private TabsManager.TabsEntry[] tabs;
|
|
|
|
|
2022-07-04 16:57:19 +00:00
|
|
|
private void Start() {}
|
|
|
|
|
|
|
|
public void SwitchSettingsDialog()
|
|
|
|
{
|
2022-08-27 03:43:01 +00:00
|
|
|
if(dialog.activeSelf) {
|
|
|
|
dialog.SetActive(false);
|
2023-01-24 19:31:49 +00:00
|
|
|
|
|
|
|
PersistentDataManager.SaveSettings();
|
|
|
|
tabsManager.CleanTabs();
|
2023-05-07 20:33:15 +00:00
|
|
|
|
2023-12-26 05:22:51 +00:00
|
|
|
if (GameManager.instance != null && GameManager.instance.CircleCursor != null && GameManager.instance.playMode)
|
|
|
|
{
|
|
|
|
GameManager.instance.CircleCursor.LockCursor(true);
|
|
|
|
}
|
|
|
|
|
2023-05-07 20:33:15 +00:00
|
|
|
if (Editor.Editor.instance == null) return;
|
|
|
|
Editor.Editor.instance.canSelect = true;
|
|
|
|
Editor.Editor.instance.inAuthorativeMenu = false;
|
2022-07-04 16:57:19 +00:00
|
|
|
} else {
|
2022-08-27 03:43:01 +00:00
|
|
|
ResetAllDialogs();
|
|
|
|
dialog.SetActive(true);
|
2022-10-13 16:20:48 +00:00
|
|
|
|
2023-01-24 19:31:49 +00:00
|
|
|
tabsManager.GenerateTabs(tabs);
|
|
|
|
|
2022-10-13 16:20:48 +00:00
|
|
|
BuildDateDisplay.text = GlobalGameManager.buildTime;
|
2023-12-26 05:22:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (GameManager.instance != null && GameManager.instance.CircleCursor != null && GameManager.instance.playMode)
|
|
|
|
{
|
|
|
|
GameManager.instance.CircleCursor.LockCursor(false);
|
|
|
|
}
|
|
|
|
|
2023-05-07 20:33:15 +00:00
|
|
|
if (Editor.Editor.instance == null) return;
|
|
|
|
Editor.Editor.instance.canSelect = false;
|
|
|
|
Editor.Editor.instance.inAuthorativeMenu = true;
|
2022-07-04 16:57:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Update() {}
|
|
|
|
}
|
|
|
|
}
|