DO-73 [Feat] 인게임 응답 로딩 패널 텍스트 설정
This commit is contained in:
parent
5b8d7b7253
commit
f5de84b4ea
@ -16,8 +16,8 @@ public class LoadingPanelController : MonoBehaviour
|
|||||||
[SerializeField] private Sprite[] dragonSprites;
|
[SerializeField] private Sprite[] dragonSprites;
|
||||||
[SerializeField] private Sprite[] tigerSprites;
|
[SerializeField] private Sprite[] tigerSprites;
|
||||||
|
|
||||||
private string fullText = "불러오는 중...";
|
private string _fullText = "불러오는 중...";
|
||||||
private readonly string[] loadingMessages = {
|
private readonly string[] _loadingMessages = {
|
||||||
"흑돌을 닦는 중...",
|
"흑돌을 닦는 중...",
|
||||||
"백돌을 닦는 중...",
|
"백돌을 닦는 중...",
|
||||||
"알을 반짝반짝 닦는 중...",
|
"알을 반짝반짝 닦는 중...",
|
||||||
@ -27,6 +27,8 @@ public class LoadingPanelController : MonoBehaviour
|
|||||||
"흑돌과 백돌을 구분하는 중...",
|
"흑돌과 백돌을 구분하는 중...",
|
||||||
"돌이 동글동글한지 확인하는 중..."
|
"돌이 동글동글한지 확인하는 중..."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private string _watingText = "상대방을 기다리는 중...";
|
||||||
private float interval = 0.2f;
|
private float interval = 0.2f;
|
||||||
[SerializeField] float flipDuration = 0.3f; // 회전 시간
|
[SerializeField] float flipDuration = 0.3f; // 회전 시간
|
||||||
[SerializeField] float delayBetweenFlips = 1f; // 이미지 변경 주기
|
[SerializeField] float delayBetweenFlips = 1f; // 이미지 변경 주기
|
||||||
@ -55,6 +57,8 @@ public class LoadingPanelController : MonoBehaviour
|
|||||||
imageBackground.SetActive(isBackgroundImage);
|
imageBackground.SetActive(isBackgroundImage);
|
||||||
simpleBackground.SetActive(!isBackgroundImage);
|
simpleBackground.SetActive(!isBackgroundImage);
|
||||||
|
|
||||||
|
_fullText = !isBackgroundImage ? _watingText : _fullText; // 인게임에서 사용하는 경우 맨 처음 텍스트 고정
|
||||||
|
|
||||||
if (animatedImage) RotateImages(); // 캐릭터들이 좌우로 회전하는 효과
|
if (animatedImage) RotateImages(); // 캐릭터들이 좌우로 회전하는 효과
|
||||||
if (animatedText) StartCoroutine(AnimateLoadingText()); // 한글자씩 나타나는 효과
|
if (animatedText) StartCoroutine(AnimateLoadingText()); // 한글자씩 나타나는 효과
|
||||||
if (animatedFlip) FlipImages(); // 캐릭터들이 뒤집히면서 표정이 바뀌는 효과
|
if (animatedFlip) FlipImages(); // 캐릭터들이 뒤집히면서 표정이 바뀌는 효과
|
||||||
@ -88,15 +92,15 @@ public class LoadingPanelController : MonoBehaviour
|
|||||||
while (!cancellationTokenSource.IsCancellationRequested)
|
while (!cancellationTokenSource.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
// 글자 하나씩 추가
|
// 글자 하나씩 추가
|
||||||
currentLength = (currentLength + 1) % (fullText.Length + 1); // 글자 하나씩 추가 (0 ~ fullText.Length 반복)
|
currentLength = (currentLength + 1) % (_fullText.Length + 1); // 글자 하나씩 추가 (0 ~ fullText.Length 반복)
|
||||||
loadingText.text = fullText.Substring(0, currentLength); // 부분 문자열 표시
|
loadingText.text = _fullText.Substring(0, currentLength); // 부분 문자열 표시
|
||||||
yield return new WaitForSeconds(interval); // 0.2초마다 변경
|
yield return new WaitForSeconds(interval); // 0.2초마다 변경
|
||||||
|
|
||||||
// 모든 글자가 다 표시되면 1초 대기
|
// 모든 글자가 다 표시되면 1초 대기
|
||||||
if (currentLength == fullText.Length)
|
if (currentLength == _fullText.Length)
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(1f); // 1초 대기
|
yield return new WaitForSeconds(1f); // 1초 대기
|
||||||
fullText = loadingMessages[Random.Range(0, loadingMessages.Length)]; // 랜덤 메시지 선택
|
_fullText = _loadingMessages[Random.Range(0, _loadingMessages.Length)]; // 랜덤 메시지 선택
|
||||||
currentLength = 0; // 다시 처음부터 시작
|
currentLength = 0; // 다시 처음부터 시작
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user