DEG-130 [Feat] 메뉴 패널, 패널 매니저 추가 및 리팩토링

This commit is contained in:
Lim0_C 2025-05-08 17:10:30 +09:00
parent 3151e17899
commit 2b84d1fd2f
34 changed files with 1381 additions and 786 deletions

File diff suppressed because one or more lines are too long

BIN
Assets/LYM/Scenes/HousingUI.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -5,18 +5,16 @@ using UnityEngine.UI;
public class MainUIPanelController : MonoBehaviour
{
[SerializeField] private GameObject settingsPanelPrefab;
[SerializeField] private GameObject popupPanelPrefab;
public void OnClickStartButton()
{
var popupPanel = Instantiate(popupPanelPrefab, transform);
popupPanel.GetComponent<PopupPanelController>().Show("This is PopupPanel!!", () => {Debug.Log("Confirmed");});
var popupPanel = GameManager.Instance.PanelManager.GetPanel("PopupPanel");
popupPanel.GetComponent<PopupPanelController>().Show("This is PopupPanel!!", () => {Debug.Log("Confirmed");}, () => {Debug.Log("Canceled");});
}
public void OnClickSettingsButton()
{
var settingsPanel = Instantiate(settingsPanelPrefab, transform);
var settingsPanel = GameManager.Instance.PanelManager.GetPanel("SettingsPanel");
settingsPanel.GetComponent<SettingsPanelController>().Show();
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MenuPanelController : PanelController
{
public void OnClickExitButton()
{
//todo: 나가기 팝업 띄움(씬에 따라 다른 문구. 던전이면 "던전을 나가시겠습니까?")
var popupPanel = GameManager.Instance.PanelManager.GetPanel("PopupPanel");
popupPanel.GetComponent<PopupPanelController>().Show("정말 나가시겠습니까?",
() =>
{
//todo: 메인으로 가거나 하우징 으로 감
},
() =>
{
//todo: 게임재개
});
}
public void OnClickSettingsButton()
{
var settingsPanel = GameManager.Instance.PanelManager.GetPanel("SettingsPanel");
settingsPanel.GetComponent<SettingsPanelController>().Show();
}
public void OnClickBackButton()
{
Hide();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fed648e7a115a174d916a6f0a7c9ce21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
[RequireComponent(typeof(CanvasGroup))]
public class PanelController : MonoBehaviour
@ -19,13 +20,13 @@ public class PanelController : MonoBehaviour
public void Show()
{
if (_canvasGroup == null) return;
_canvasGroup.alpha = 1;
_canvasGroup.DOFade(1, 0.5f);
}
public void Hide()
public void Hide(bool doDestroy = true)
{
if (_canvasGroup == null) return;
_canvasGroup.alpha = 0;
Destroy(gameObject);
if (doDestroy) Destroy(gameObject);
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PanelManager : MonoBehaviour
{
private Canvas _canvas;
private Dictionary<string, GameObject> _panels = new Dictionary<string, GameObject>();
private void Awake()
{
if (_canvas == null)
{
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
}
LoadPanels();
}
//패널을 딕셔너리에 오브젝트 이름으로 로드
private void LoadPanels()
{
GameObject[] prefabs = Resources.LoadAll<GameObject>("Prefabs/Panels");
foreach (GameObject prefab in prefabs)
{
_panels[prefab.name] = prefab;
}
}
//패널 이름을 딕셔너리 키로 찾음
public GameObject GetPanel(string panelName)
{
if (_panels.TryGetValue(panelName, out GameObject prefab))
{
return Instantiate(prefab, _canvas.transform);
}
else
{
Debug.LogError($"패널 '{panelName}'을 찾을 수 없습니다.");
}
return null;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b459829fc21f01047bcf9e0db5b140f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseButton : MonoBehaviour
{
public void OnClicked()
{
var menuPanel = GameManager.Instance.PanelManager.GetPanel("MenuPanel");
menuPanel.GetComponent<MenuPanelController>().Show();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 93ea4f5b6838c6347a34495974000c46
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -49,13 +49,11 @@ public class SettingsPanelController : PanelController
public void OnSFXSliderValueChanged(float value)
{
//todo: 소리 볼륨 조절
Debug.Log("sfx changed value" + value);
}
public void OnBGMSliderValueChanged(float value)
{
//todo: 소리 볼륨 조절
Debug.Log("bgm changed value" + value);
}
public void OnCloseButtonClicked()

BIN
Assets/LYM/Sprites/button 1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 9d058766d27e0ca40a93bc021c14488b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/Sprites/panel 1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: de581ef7f3846d64c9341cc3a64aaefb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 18, y: 23, z: 19, w: 15}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/UIPrefabs/Interaction Panel.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a3da136bd80e56243873bacce840253d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/UIPrefabs/PopupPanel.prefab (Stored with Git LFS)

Binary file not shown.

BIN
Assets/LYM/UIPrefabs/SettingsPanel.prefab (Stored with Git LFS)

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: edf594bbb8d208d4aa8df5846f0da31c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Prefabs/PanelManager.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d57ffc5c436a5d545bc0e7c3dc2b153f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 224cdaf603f27484ea80d32b62159993
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Prefabs/Panels/MenuPanel.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2e7ff641fb27901438b31f2f2f310f88
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Prefabs/Panels/PopupPanel.prefab (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Resources/Prefabs/Panels/SettingsPanel.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -21,11 +21,17 @@ public partial class GameManager : Singleton<GameManager>
private ChatWindowController chatWindowController; // 대화창 컨트롤러
//패널 관련
private PanelManager panelManager;
public PanelManager PanelManager => panelManager;
private void Start()
{
// 오디오 초기화
InitializeAudio();
PlayerStats.Instance.OnDayEnded += AdvanceDay;
//패널 매니저 생성
panelManager = Instantiate(Resources.Load<GameObject>("Prefabs/PanelManager")).GetComponent<PanelManager>();
}
#region