Skip to content

Commit

Permalink
Merge pull request #730 from GG-Studio-990001/721-bug-설정창-화면-모드-변경-버그
Browse files Browse the repository at this point in the history
Fix: 설정창 버그 수정 및 기능 추가
  • Loading branch information
NearthYou authored Oct 27, 2024
2 parents 9217e0d + 70d6637 commit 886cd76
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 11 deletions.
31 changes: 22 additions & 9 deletions Assets/Prefabs/System/SettingSystem.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 325, y: 88}
m_AnchoredPosition: {x: 127, y: 88}
m_SizeDelta: {x: 360, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2676726580588217903
Expand Down Expand Up @@ -2088,7 +2088,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 80, y: 130}
m_AnchoredPosition: {x: 130, y: 130}
m_SizeDelta: {x: 200, y: 84.6133}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &1767295622917427692
Expand Down Expand Up @@ -2119,7 +2119,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\uD654\uBA74\uBAA8\uB4DC"
m_text: "\uD654\uBA74"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 20df6cf4e3969cc46a9e547f18e066d3, type: 2}
m_sharedMaterial: {fileID: 8267675722650998094, guid: 20df6cf4e3969cc46a9e547f18e066d3, type: 2}
Expand Down Expand Up @@ -2153,7 +2153,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
Expand Down Expand Up @@ -2783,7 +2783,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 80, y: 130}
m_AnchoredPosition: {x: 130, y: 130}
m_SizeDelta: {x: 200, y: 84.6133}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &6156808254248267116
Expand Down Expand Up @@ -2814,7 +2814,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\uC0AC\uC6B4\uB4DC"
m_text: "\uC18C\uB9AC"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 20df6cf4e3969cc46a9e547f18e066d3, type: 2}
m_sharedMaterial: {fileID: 8267675722650998094, guid: 20df6cf4e3969cc46a9e547f18e066d3, type: 2}
Expand Down Expand Up @@ -2848,7 +2848,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
Expand Down Expand Up @@ -2893,6 +2893,7 @@ GameObject:
m_Component:
- component: {fileID: 7427133140673661764}
- component: {fileID: 6154748035360889642}
- component: {fileID: 335110141899180257}
m_Layer: 5
m_Name: SFXSlider
m_TagString: Untagged
Expand Down Expand Up @@ -2974,6 +2975,18 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!114 &335110141899180257
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6482141921439642028}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0aa69005081197948ba9d97ffb482252, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &6584498748132185721
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -5153,7 +5166,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 80, y: 130}
m_AnchoredPosition: {x: 130, y: 130}
m_SizeDelta: {x: 200, y: 84.6133}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &9060029179700398446
Expand Down Expand Up @@ -5218,7 +5231,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
Expand Down
37 changes: 35 additions & 2 deletions Assets/Scripts/Runtime/Common/Presentation/SettingsUIPresenter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Runtime.Common.View;
using Runtime.ETC;
using Runtime.InGameSystem;
using UnityEngine;
using UnityEngine.Rendering;

namespace Runtime.Common.Presentation
{
Expand All @@ -12,6 +15,7 @@ public SettingsUIPresenter(SettingsUIView settingsUIView)
_settingsUIView = settingsUIView;

InitVolume();
InitScreenMode();
_settingsUIView.BgmVolumeSlider.onValueChanged.AddListener(SetBgmVolume);
_settingsUIView.SfxVolumeSlider.onValueChanged.AddListener(SetSfxVolume);

Expand All @@ -28,6 +32,21 @@ private void InitVolume()
_settingsUIView.SfxVolumeSlider.value = Managers.Data.SfxVolume;
}

private void InitScreenMode()
{
if (Managers.Data.IsFullscreen)
{
_settingsUIView.FullScreenToggle.isOn = true;
SetFullScreenMode(true);
}
else
{
_settingsUIView.WindowScreenToggle.isOn = true;
SetWindowScreenMode(true);
}
}


private void SetBgmVolume(float volume)
{
Managers.Data.BgmVolume = volume;
Expand All @@ -43,12 +62,26 @@ private void SetSfxVolume(float volume)

private void SetFullScreenMode(bool isOn)
{
Screen.SetResolution(1920, 1080, FullScreenMode.FullScreenWindow);
if (isOn)
{
_settingsUIView.FullScreenToggle.interactable = false;
_settingsUIView.WindowScreenToggle.isOn = false;
_settingsUIView.WindowScreenToggle.interactable = true;
Managers.Data.IsFullscreen = true;
Screen.SetResolution(1920, 1080, FullScreenMode.FullScreenWindow);
}
}

private void SetWindowScreenMode(bool isOn)
{
Screen.SetResolution(1920, 1080, FullScreenMode.Windowed);
if (isOn)
{
_settingsUIView.WindowScreenToggle.interactable = false;
_settingsUIView.FullScreenToggle.isOn = false;
_settingsUIView.FullScreenToggle.interactable = true;
Managers.Data.IsFullscreen = false;
Screen.SetResolution(1280, 720, FullScreenMode.Windowed);
}
}

private void OnGameExitButtonClicked()
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Runtime/Manager/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GameData
public int Chapter;
public float BgmVolume;
public float SfxVolume;
public bool isFullScreen;
public CH1Data CH1;
public CH2Data CH2;

Expand All @@ -22,6 +23,7 @@ public GameData()
Chapter = 1;
BgmVolume = 0.5f;
SfxVolume = 0.5f;
isFullScreen = true;
CH1 = new CH1Data();
CH2 = new CH2Data();
}
Expand Down Expand Up @@ -49,6 +51,12 @@ public float SfxVolume
set { Mathf.Clamp(value, 0, 1); _gameData.SfxVolume = value; Managers.Sound.SFX.volume = value; }
}

public bool IsFullscreen
{
get { return _gameData.isFullScreen; }
set { _gameData.isFullScreen = value; }
}

public CH1Data CH1 { get { return _gameData.CH1; } set { _gameData.CH1 = value; } }

public CH2Data CH2 { get { return _gameData.CH2; } set { _gameData.CH2 = value; } }
Expand Down
21 changes: 21 additions & 0 deletions Assets/SettingSFXSlider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Runtime.ETC;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class SettingSFXSlider : MonoBehaviour, IPointerUpHandler
{
private Slider slider;

private void Start()
{
slider = GetComponent<Slider>();
}

public void OnPointerUp(PointerEventData eventData)
{
Managers.Sound.Play(Sound.SFX, "SLG/SLG_Stone_SFX");
}
}
11 changes: 11 additions & 0 deletions Assets/SettingSFXSlider.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 886cd76

Please sign in to comment.