[Feat] 씬전환 로딩 패널 구현

This commit is contained in:
HaeinLEE 2025-05-12 17:12:58 +09:00
parent cd6f53e580
commit b482e40e3a
13 changed files with 195 additions and 9 deletions

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c3b8a67e-61ad-4d5a-9de5-dce8e18c1710" name="변경" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/d6bbda9f0f5a4a7b944aefffbac6e8501fe00/57/cd48a3dd/CharacterController.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/LIN/Scripts/PlayerStateExhaustion.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/LIN/Scripts/UI/SwitchingPanelController.cs" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"node.js.selected.package.tslint": "(autodetect)"
}
}]]></component>
<component name="RunManager">
<configuration name="유닛 테스트(배치 모드)" type="RunUnityExe" factoryName="Unity Executable">
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\2022.3.60f1\Editor\Unity.exe" />
<option name="PROGRAM_PARAMETERS" value="-runTests -batchmode -projectPath D:\LikeLion\TeamProject\TEAFridge\exhaustion -testResults Logs/results.xml -logFile Logs/Editor.log -testPlatform EditMode -debugCodeOptimization" />
<option name="WORKING_DIRECTORY" value="D:\LikeLion\TeamProject\TEAFridge\exhaustion" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<method v="2" />
</configuration>
<configuration name="Unity 시작" type="RunUnityExe" factoryName="Unity Executable">
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\2022.3.60f1\Editor\Unity.exe" />
<option name="PROGRAM_PARAMETERS" value="-projectPath D:\LikeLion\TeamProject\TEAFridge\exhaustion -debugCodeOptimization" />
<option name="WORKING_DIRECTORY" value="D:\LikeLion\TeamProject\TEAFridge\exhaustion" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<method v="2" />
</configuration>
</component>
<component name="TaskManager">
<servers />
</component>
<component name="UnityProjectConfiguration" hasMinimizedUI="true" />
<component name="UnityUnitTestConfiguration" currentTestLauncher="Both" />
</project>

BIN
Assets/LIN/Prefabs/SwitchingImage.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

Binary file not shown.

BIN
Assets/LIN/ReHousing Copy.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

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

View File

@ -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<SwitchingPanelController>();
switchingPanel.GetComponent<CanvasGroup>().alpha = 0.0f;
switchingPanelController.FadeAndSceneLoad("ReDungeon");
}
}
#region NPC

View File

@ -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

View File

@ -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>();
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));
});
}
}

View File

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