Compare commits
6 Commits
21c2f14ca8
...
cec64dd203
Author | SHA1 | Date | |
---|---|---|---|
cec64dd203 | |||
|
9d163fe992 | ||
|
32a442ea20 | ||
|
9615a2d84c | ||
|
0e206aa885 | ||
|
6de9aee53b |
BIN
Assets/KSH/ReHousing.unity
(Stored with Git LFS)
BIN
Assets/KSH/ReHousing.unity
(Stored with Git LFS)
Binary file not shown.
@ -6,6 +6,7 @@ public class PauseButton : MonoBehaviour
|
||||
{
|
||||
public void OnClicked()
|
||||
{
|
||||
//todo: 게임 일시정지 필요
|
||||
var menuPanel = GameManager.Instance.PanelManager.GetPanel("MenuPanel");
|
||||
menuPanel.GetComponent<MenuPanelController>().Show();
|
||||
}
|
||||
|
31
Assets/LYM/Scripts/PlayerPrefsManager.cs
Normal file
31
Assets/LYM/Scripts/PlayerPrefsManager.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class PlayerPrefsManager
|
||||
{
|
||||
//사운드 설정 저장
|
||||
public static void SaveSettings(float sfxVolume, float bgmVolume, bool sfxIsActive, bool bgmIsActive)
|
||||
{
|
||||
//볼륨
|
||||
sfxVolume = Mathf.Clamp01(sfxVolume);
|
||||
bgmVolume = Mathf.Clamp01(bgmVolume);
|
||||
PlayerPrefs.SetFloat("SFXVolume", sfxVolume);
|
||||
PlayerPrefs.SetFloat("BGMVolume", bgmVolume);
|
||||
//뮤트
|
||||
PlayerPrefs.SetInt("SFXIsActive", sfxIsActive ? 1 : 0);
|
||||
PlayerPrefs.SetInt("BGMIsActive", bgmIsActive ? 1 : 0);
|
||||
//즉시 저장
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
//사운드 설정 불러오기
|
||||
public static (float sfxVolume, float bgmVolume, bool sfxIsActive, bool bgmIsActive) LoadSettings()
|
||||
{
|
||||
var sfxVolume = PlayerPrefs.GetFloat("SFXVolume", 1f);
|
||||
var bgmVolume = PlayerPrefs.GetFloat("BGMVolume", 1f);
|
||||
var sfxIsActive = PlayerPrefs.GetInt("SFXIsActive", 1) == 1;
|
||||
var bgmIsActive = PlayerPrefs.GetInt("BGMIsActive", 1) == 1;
|
||||
return (sfxVolume, bgmVolume, sfxIsActive, bgmIsActive);
|
||||
}
|
||||
}
|
11
Assets/LYM/Scripts/PlayerPrefsManager.cs.meta
Normal file
11
Assets/LYM/Scripts/PlayerPrefsManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 083089baf7a258646917ef5c4fc63979
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -19,16 +19,11 @@ public class SettingsPanelController : PanelController
|
||||
|
||||
private void InitSettings()
|
||||
{
|
||||
//todo:저장된 데이터를 가져오게 해야함
|
||||
var sfxIsActive = true;
|
||||
var bgmIsActive = true;
|
||||
var (sfxVolume, bgmVolume, sfxIsActive, bgmIsActive) = PlayerPrefsManager.LoadSettings();
|
||||
sfxSliderButton.Init(sfxIsActive);
|
||||
bgmSliderButton.Init(bgmIsActive);
|
||||
//todo:저장된 데이터를 가져오게 해야함
|
||||
var sfxSliderValue = 1f;
|
||||
var bgmSliderValue = 1f;
|
||||
sfxSlider.value = sfxSliderValue;
|
||||
bgmSlider.value = bgmSliderValue;
|
||||
sfxSlider.value = sfxVolume;
|
||||
bgmSlider.value = bgmVolume;
|
||||
Show();
|
||||
}
|
||||
|
||||
@ -73,6 +68,7 @@ public class SettingsPanelController : PanelController
|
||||
public void OnCloseButtonClicked()
|
||||
{
|
||||
//todo: 설정 저장 필요
|
||||
PlayerPrefsManager.SaveSettings(sfxSlider.value, bgmSlider.value, sfxSliderButton.IsActive, bgmSliderButton.IsActive);
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
BIN
Assets/LYM/UIPrefabs/ChatWindowPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/ChatWindowPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/DungeonMainUIPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/DungeonMainUIPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/HousingMainUIPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/HousingMainUIPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/Interaction Panel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/Interaction Panel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/JoystickPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/JoystickPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/MainUIPanel.prefab
(Stored with Git LFS)
BIN
Assets/LYM/UIPrefabs/MainUIPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Resources/Prefabs/Panels/MenuPanel.prefab
(Stored with Git LFS)
BIN
Assets/Resources/Prefabs/Panels/MenuPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Resources/Prefabs/Panels/PopupPanel.prefab
(Stored with Git LFS)
BIN
Assets/Resources/Prefabs/Panels/PopupPanel.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Resources/Prefabs/Panels/SettingsPanel.prefab
(Stored with Git LFS)
BIN
Assets/Resources/Prefabs/Panels/SettingsPanel.prefab
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@ -95,7 +96,7 @@ public partial class GameManager
|
||||
if (beamSFX != null) SafeSoundManager?.LoadAudioClip("Beam", beamSFX);
|
||||
|
||||
// 저장된 볼륨 설정 로드
|
||||
// LoadVolumeSettings();
|
||||
LoadVolumeSettings();
|
||||
|
||||
// 현재 씬에 맞는 배경음 재생
|
||||
string currentSceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
|
||||
@ -132,16 +133,18 @@ public partial class GameManager
|
||||
}
|
||||
|
||||
// PlayerPrefs에 저장된 볼륨 설정 불러오기
|
||||
// private void LoadVolumeSettings()
|
||||
// {
|
||||
// float bgmVolume = PlayerPrefs.GetFloat("BGMVolume", 1.0f);
|
||||
// float sfxVolume = PlayerPrefs.GetFloat("SFXVolume", 1.0f);
|
||||
//
|
||||
//
|
||||
// SafeSoundManager?.SetBGMVolume(bgmVolume);
|
||||
// SafeSoundManager?.SetSFXVolume(sfxVolume);
|
||||
//
|
||||
// }
|
||||
private void LoadVolumeSettings()
|
||||
{
|
||||
// float bgmVolume = PlayerPrefs.GetFloat("BGMVolume", 1.0f);
|
||||
// float sfxVolume = PlayerPrefs.GetFloat("SFXVolume", 1.0f);
|
||||
//
|
||||
//
|
||||
// SafeSoundManager?.SetBGMVolume(bgmVolume);
|
||||
// SafeSoundManager?.SetSFXVolume(sfxVolume);
|
||||
var (sfxVolume, bgmVolume, sfxIsActive, bgmIsActive) = PlayerPrefsManager.LoadSettings();
|
||||
SafeSoundManager?.SetSFXVolume(sfxIsActive? sfxVolume : 0);
|
||||
SafeSoundManager?.SetBGMVolume(bgmIsActive? bgmVolume : 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user