Projext/Assets/Scripts/System_Scripts/SettingPanelController.cs

80 lines
1.8 KiB
C#
Raw Normal View History

2026-01-30 09:27:44 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SettingPanelController : MonoBehaviour
{
[SerializeField] private GameObject settingPanel;
2026-02-02 08:39:05 +00:00
[SerializeField] private GameObject gameStopPanel;
[HideInInspector] public bool IsSettingOpen { get; private set; }
[Header("<22><><EFBFBD><EFBFBD>â <20><><EFBFBD><EFBFBD> <20>г<EFBFBD>")]
[SerializeField] private GameObject normalPanel;
[SerializeField] private GameObject graphicPanel;
[Header("<22><><EFBFBD><EFBFBD> <20>ݴ<EFBFBD> <20>Ҹ<EFBFBD>")]
2026-01-30 09:27:44 +00:00
[SerializeField] private AudioSource audioSource;
[SerializeField] private AudioClip openSound;
[SerializeField] private AudioClip closeSound;
2026-02-02 08:39:05 +00:00
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);
}
}
2026-01-30 09:27:44 +00:00
public void OpenSetting()
{
2026-02-02 08:39:05 +00:00
IsSettingOpen = true;
2026-01-30 09:27:44 +00:00
if (audioSource != null && openSound != null)
{
audioSource.PlayOneShot(openSound);
}
2026-02-02 08:39:05 +00:00
2026-01-30 09:27:44 +00:00
settingPanel.SetActive(true);
2026-02-02 08:39:05 +00:00
if (gameStopPanel != null)
{
gameStopPanel.SetActive(false);
}
2026-01-30 09:27:44 +00:00
}
public void CloseSetting()
{
2026-02-02 08:39:05 +00:00
IsSettingOpen = false;
2026-01-30 09:27:44 +00:00
if (audioSource != null && closeSound != null)
{
audioSource.PlayOneShot(closeSound);
}
2026-02-02 08:39:05 +00:00
2026-01-30 09:27:44 +00:00
settingPanel.SetActive(false);
2026-02-02 08:39:05 +00:00
if (gameStopPanel != null)
{
gameStopPanel.SetActive(true);
}
2026-01-30 09:27:44 +00:00
}
}