80 lines
1.8 KiB
C#
80 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SettingPanelController : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject settingPanel;
|
|
[SerializeField] private GameObject gameStopPanel;
|
|
[HideInInspector] public bool IsSettingOpen { get; private set; }
|
|
|
|
[Header("설정창 선택 패널")]
|
|
[SerializeField] private GameObject normalPanel;
|
|
[SerializeField] private GameObject graphicPanel;
|
|
|
|
[Header("열고 닫는 소리")]
|
|
[SerializeField] private AudioSource audioSource;
|
|
[SerializeField] private AudioClip openSound;
|
|
[SerializeField] private AudioClip closeSound;
|
|
|
|
public void AllClose()
|
|
{
|
|
normalPanel.SetActive(false);
|
|
graphicPanel.SetActive(false);
|
|
}
|
|
|
|
public void NormalOpen()
|
|
{
|
|
AllClose();
|
|
normalPanel.SetActive(true);
|
|
if (audioSource != null && openSound != null)
|
|
{
|
|
audioSource.PlayOneShot(openSound);
|
|
}
|
|
}
|
|
|
|
public void GraphicOpen()
|
|
{
|
|
AllClose();
|
|
graphicPanel.SetActive(true);
|
|
if (audioSource != null && openSound != null)
|
|
{
|
|
audioSource.PlayOneShot(openSound);
|
|
}
|
|
}
|
|
|
|
public void OpenSetting()
|
|
{
|
|
IsSettingOpen = true;
|
|
|
|
if (audioSource != null && openSound != null)
|
|
{
|
|
audioSource.PlayOneShot(openSound);
|
|
}
|
|
|
|
settingPanel.SetActive(true);
|
|
|
|
if (gameStopPanel != null)
|
|
{
|
|
gameStopPanel.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void CloseSetting()
|
|
{
|
|
IsSettingOpen = false;
|
|
|
|
if (audioSource != null && closeSound != null)
|
|
{
|
|
audioSource.PlayOneShot(closeSound);
|
|
}
|
|
|
|
settingPanel.SetActive(false);
|
|
|
|
if (gameStopPanel != null)
|
|
{
|
|
gameStopPanel.SetActive(true);
|
|
}
|
|
}
|
|
}
|