mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 01:27:38 +02:00
make all dialogs inherit one base class
- opening a new dialog closes the previous one
This commit is contained in:
28
Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs
Normal file
28
Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
using TMPro;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class Dialog : MonoBehaviour
|
||||
{
|
||||
[SerializeField] protected GameObject dialog;
|
||||
public void ForceState(bool onoff = false)
|
||||
{
|
||||
Editor.instance.canSelect = onoff;
|
||||
Editor.instance.inAuthorativeMenu = !onoff;
|
||||
dialog.SetActive(onoff);
|
||||
}
|
||||
|
||||
public static void ResetAllDialogs()
|
||||
{
|
||||
foreach(var dialog in FindObjectsOfType<Dialog>())
|
||||
{
|
||||
dialog.ForceState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs.meta
Normal file
11
Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e317d304732b562489c993ae93ce2265
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user