From b482e40e3a2482003d3c878b8df12783cd66fca4 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Mon, 12 May 2025 17:12:58 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EC=94=AC=EC=A0=84=ED=99=98=20?= =?UTF-8?q?=EB=A1=9C=EB=94=A9=20=ED=8C=A8=EB=84=90=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.idea.exhaustion/.idea/indexLayout.xml | 8 +++ .idea/.idea.exhaustion/.idea/workspace.xml | 46 ++++++++++++++ Assets/LIN/Prefabs/SwitchingImage.prefab | 3 + Assets/LIN/Prefabs/SwitchingImage.prefab.meta | 7 +++ .../LIN/Prefabs/TutorialExamplePanel.prefab | 4 +- Assets/LIN/ReHousing Copy.unity | 4 +- .../DailyRoutine/InteractionController.cs | 5 -- Assets/LIN/Scripts/PlayerStateExhaustion.cs | 25 ++++++++ .../LIN/Scripts/PlayerStateExhaustion.cs.meta | 11 ++++ .../LIN/Scripts/UI/HousingCanvasController.cs | 17 ++++++ Assets/LIN/Scripts/UI/HousingConstants.cs | 2 + .../Scripts/UI/SwitchingPanelController.cs | 61 +++++++++++++++++++ .../UI/SwitchingPanelController.cs.meta | 11 ++++ 13 files changed, 195 insertions(+), 9 deletions(-) create mode 100644 .idea/.idea.exhaustion/.idea/indexLayout.xml create mode 100644 .idea/.idea.exhaustion/.idea/workspace.xml create mode 100644 Assets/LIN/Prefabs/SwitchingImage.prefab create mode 100644 Assets/LIN/Prefabs/SwitchingImage.prefab.meta create mode 100644 Assets/LIN/Scripts/PlayerStateExhaustion.cs create mode 100644 Assets/LIN/Scripts/PlayerStateExhaustion.cs.meta create mode 100644 Assets/LIN/Scripts/UI/SwitchingPanelController.cs create mode 100644 Assets/LIN/Scripts/UI/SwitchingPanelController.cs.meta diff --git a/.idea/.idea.exhaustion/.idea/indexLayout.xml b/.idea/.idea.exhaustion/.idea/indexLayout.xml new file mode 100644 index 00000000..7b08163c --- /dev/null +++ b/.idea/.idea.exhaustion/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.exhaustion/.idea/workspace.xml b/.idea/.idea.exhaustion/.idea/workspace.xml new file mode 100644 index 00000000..f8f4a5b5 --- /dev/null +++ b/.idea/.idea.exhaustion/.idea/workspace.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Assets/LIN/Prefabs/SwitchingImage.prefab b/Assets/LIN/Prefabs/SwitchingImage.prefab new file mode 100644 index 00000000..e4eba114 --- /dev/null +++ b/Assets/LIN/Prefabs/SwitchingImage.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f797bcff534783fd29d1e08550581ce53c8e270ab0456293948842f131868957 +size 9083 diff --git a/Assets/LIN/Prefabs/SwitchingImage.prefab.meta b/Assets/LIN/Prefabs/SwitchingImage.prefab.meta new file mode 100644 index 00000000..c0548dcf --- /dev/null +++ b/Assets/LIN/Prefabs/SwitchingImage.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5f886fa5087dfb04780f508410f72e46 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Prefabs/TutorialExamplePanel.prefab b/Assets/LIN/Prefabs/TutorialExamplePanel.prefab index 5071a7c0..a6045353 100644 --- a/Assets/LIN/Prefabs/TutorialExamplePanel.prefab +++ b/Assets/LIN/Prefabs/TutorialExamplePanel.prefab @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6d996355527e9a0aa940a2d0a503ba8e7c6e660cb7f0b7f9d403435862da11ee -size 44871 +oid sha256:2a205b1cb1b77da6069cc6b50bf84b6dde468c7dec7fe424d001a0d0e21062fc +size 44760 diff --git a/Assets/LIN/ReHousing Copy.unity b/Assets/LIN/ReHousing Copy.unity index f55700a2..adbf96f5 100644 --- a/Assets/LIN/ReHousing Copy.unity +++ b/Assets/LIN/ReHousing Copy.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:269bb7c215d56d44dbc58820f07ecf478a3797011323c359131fbe245d8fc78a -size 613220 +oid sha256:d1253abf44be4fe1896a540df113417f61f5d849f78e18b2a55cb1e34b7157d5 +size 613321 diff --git a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs index 7937da21..d984587b 100644 --- a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs +++ b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs @@ -17,7 +17,6 @@ public class InteractionController : MonoBehaviour private void Start() { - PlayerStats.Instance.OnStatsChanged += UpdateStat; PlayerStats.Instance.OnWorked += SuddenAfterWorkEventHappen; } @@ -115,8 +114,4 @@ public class InteractionController : MonoBehaviour #endregion - private void UpdateStat(PlayerStats.StatsChangeData statData) - { - Debug.Log(statData.Health); - } } diff --git a/Assets/LIN/Scripts/PlayerStateExhaustion.cs b/Assets/LIN/Scripts/PlayerStateExhaustion.cs new file mode 100644 index 00000000..6afe756e --- /dev/null +++ b/Assets/LIN/Scripts/PlayerStateExhaustion.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PlayerStateEx : IPlayerState +{ + private PlayerController _playerController; + public void Enter(PlayerController playerController) + { + // 파라미터가 존재하는지 확인 후 처리 + _playerController.SafeSetBool("Dizzy", true); + } + + public void Update() + { + + } + + public void Exit() + { + // 파라미터가 존재하는지 확인 후 처리 + _playerController.SafeSetBool("Dizzy", false); + + } +} diff --git a/Assets/LIN/Scripts/PlayerStateExhaustion.cs.meta b/Assets/LIN/Scripts/PlayerStateExhaustion.cs.meta new file mode 100644 index 00000000..f749a4b3 --- /dev/null +++ b/Assets/LIN/Scripts/PlayerStateExhaustion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: de272c8986ac39344a9242a82a8d7cc4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LIN/Scripts/UI/HousingCanvasController.cs b/Assets/LIN/Scripts/UI/HousingCanvasController.cs index a8b477a4..7df16c0a 100644 --- a/Assets/LIN/Scripts/UI/HousingCanvasController.cs +++ b/Assets/LIN/Scripts/UI/HousingCanvasController.cs @@ -15,6 +15,10 @@ public class HousingCanvasController : MonoBehaviour [SerializeField] private GameObject suddenPanel; [SerializeField] private TMP_Text suddenText; [SerializeField] private GameObject[] suddenEventImages; + + [Header("로딩 스위칭 패널")] + [SerializeField] private GameObject switchingPanel; + private SwitchingPanelController switchingPanelController; private Coroutine _autoHideCoroutine; @@ -27,6 +31,19 @@ public class HousingCanvasController : MonoBehaviour interactionButton.SetActive(false); suddenPanel.SetActive(false); } + + private void Update() + { + // 오른쪽 화살표 키 누르면 Fade 효과 테스트 가능. + // Sumulation 에서는 작동 안 함. + if (Input.GetKeyDown(KeyCode.A)) + { + var _switchingPanel = Instantiate(switchingPanel,this.transform); + switchingPanelController = _switchingPanel.GetComponent(); + switchingPanel.GetComponent().alpha = 0.0f; + switchingPanelController.FadeAndSceneLoad("ReDungeon"); + } + } #region NPC 상호 작용 diff --git a/Assets/LIN/Scripts/UI/HousingConstants.cs b/Assets/LIN/Scripts/UI/HousingConstants.cs index 6f1e189d..931012e5 100644 --- a/Assets/LIN/Scripts/UI/HousingConstants.cs +++ b/Assets/LIN/Scripts/UI/HousingConstants.cs @@ -16,6 +16,8 @@ public static class HousingConstants public static int AFTER_WORK_DENOMINATOR = 2; //돌발 이벤트 보여줄 시간 public static float SUDDENEVENT_IAMGE_SHOW_TIME = 4.0f; + //전환효과(Switching) 패널 애니메이션 시간 + public static float SWITCH_PANEL_AINIM_DURATION = 2.0f; #region 상호작용 멘트 diff --git a/Assets/LIN/Scripts/UI/SwitchingPanelController.cs b/Assets/LIN/Scripts/UI/SwitchingPanelController.cs new file mode 100644 index 00000000..5e1e8879 --- /dev/null +++ b/Assets/LIN/Scripts/UI/SwitchingPanelController.cs @@ -0,0 +1,61 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using DG.Tweening; +using TMPro; +using UnityEngine.SceneManagement; + +public class SwitchingPanelController : MonoBehaviour +{ + [SerializeField] private GameObject Loading_UI; + [SerializeField] TMP_Text Loading_text; + + static Sequence loadingSequence; + private CanvasGroup canvasGroup; + + private void Awake() + { + canvasGroup = this.GetComponent(); + canvasGroup.alpha = 0; + } + + IEnumerator LoadScene(string sceneName){ + Loading_UI.SetActive(true); + + AsyncOperation async = SceneManager.LoadSceneAsync(sceneName); + async.allowSceneActivation = false; //퍼센트 딜레이용 + + float past_time = 0; + float percentage = 0; + + while(!(async.isDone)){ + yield return null; + + past_time += Time.deltaTime; + + if(percentage >= 90){ + percentage = Mathf.Lerp(percentage, 100, past_time); + + if(percentage == 100){ + async.allowSceneActivation = true; //씬 전환 준비 완료 + } + } + else{ + percentage = Mathf.Lerp(percentage, async.progress * 100f, past_time); + if(percentage >= 90) past_time = 0; + } + Loading_text.text = percentage.ToString("0") + "%"; //로딩 퍼센트 표기 + } + } + + public void FadeAndSceneLoad(string sceneName) + { + if (canvasGroup == null) return; + + canvasGroup.DOFade(1.0f, HousingConstants.SWITCH_PANEL_AINIM_DURATION).OnComplete(() => + { + StartCoroutine(LoadScene(sceneName)); + }); + } +} diff --git a/Assets/LIN/Scripts/UI/SwitchingPanelController.cs.meta b/Assets/LIN/Scripts/UI/SwitchingPanelController.cs.meta new file mode 100644 index 00000000..12e637a9 --- /dev/null +++ b/Assets/LIN/Scripts/UI/SwitchingPanelController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b102a2215342ff14ea8214afcdf02dfe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: