DO-73 [Feat] 로딩 추가
This commit is contained in:
parent
4a541ee9e1
commit
265567a554
@ -66,6 +66,7 @@ public class GameUIController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
GameManager.Instance.panelManager.OpenConfirmPanel("재대결 신청을 하시겠습니까?", () =>
|
GameManager.Instance.panelManager.OpenConfirmPanel("재대결 신청을 하시겠습니까?", () =>
|
||||||
{
|
{
|
||||||
|
GameManager.Instance.panelManager.OpenLoadingPanel(false, true, true, false);
|
||||||
_multiplayManager.RequestRevengeRequest();
|
_multiplayManager.RequestRevengeRequest();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &4501886400186872935
|
--- !u!224 &4501886400186872935
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -322,6 +322,8 @@ MonoBehaviour:
|
|||||||
interval: 0.5
|
interval: 0.5
|
||||||
flipDuration: 0.3
|
flipDuration: 0.3
|
||||||
delayBetweenFlips: 1
|
delayBetweenFlips: 1
|
||||||
|
imageBackground: {fileID: 634998020045031155}
|
||||||
|
simpleBackground: {fileID: 3738728334186617240}
|
||||||
--- !u!1 &3738728334186617240
|
--- !u!1 &3738728334186617240
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -380,7 +382,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 0, g: 0, b: 0, a: 0.5882353}
|
m_Color: {r: 0, g: 0, b: 0, a: 0.78431374}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
|
@ -1104,7 +1104,7 @@ MonoBehaviour:
|
|||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_text: "1\uAE09"
|
m_text: "18\uAE09"
|
||||||
m_isRightToLeft: 0
|
m_isRightToLeft: 0
|
||||||
m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||||
m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||||
@ -1457,7 +1457,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &405965270916774547
|
--- !u!224 &405965270916774547
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1727,7 +1727,7 @@ MonoBehaviour:
|
|||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_text: ksh
|
m_text: "\uBC15\uD638\uB7AD"
|
||||||
m_isRightToLeft: 0
|
m_isRightToLeft: 0
|
||||||
m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||||
m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||||
@ -1813,7 +1813,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &8172929902404983356
|
--- !u!224 &8172929902404983356
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -177,7 +177,7 @@ public class MultiPlayerState: BasePlayerState
|
|||||||
gameLogic.UpdateForbiddenMoves();
|
gameLogic.UpdateForbiddenMoves();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
gameLogic.currentTurn = _playerType;
|
// gameLogic.currentTurn = _playerType;
|
||||||
// gameLogic.stoneController.OnStoneClickedDelegate = (row, col) =>
|
// gameLogic.stoneController.OnStoneClickedDelegate = (row, col) =>
|
||||||
// {
|
// {
|
||||||
// HandleMove(gameLogic, row, col);
|
// HandleMove(gameLogic, row, col);
|
||||||
@ -564,7 +564,6 @@ public class GameLogic : IDisposable
|
|||||||
|
|
||||||
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
||||||
{
|
{
|
||||||
// TODO: 응답 들어오기 전까지 로딩
|
|
||||||
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 재대결 요청을 승낙하였습니다.\n게임이 다시 시작됩니다.", () =>
|
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 재대결 요청을 승낙하였습니다.\n게임이 다시 시작됩니다.", () =>
|
||||||
{
|
{
|
||||||
InitBoardForRevenge(isFirstPlayer);
|
InitBoardForRevenge(isFirstPlayer);
|
||||||
@ -639,7 +638,6 @@ public class GameLogic : IDisposable
|
|||||||
//timer 초기화
|
//timer 초기화
|
||||||
fioTimer.InitTimer();
|
fioTimer.InitTimer();
|
||||||
|
|
||||||
Debug.Log("&&&&UserManager.Instance.imageIndex" + UserManager.Instance.imageIndex + "opponentImageIndex?: " + opponentImageIndex);
|
|
||||||
if (isFirstPlayer)
|
if (isFirstPlayer)
|
||||||
{
|
{
|
||||||
Debug.Log("해당 플레이어가 선공 입니다");
|
Debug.Log("해당 플레이어가 선공 입니다");
|
||||||
@ -662,6 +660,9 @@ public class GameLogic : IDisposable
|
|||||||
// 리플레이 데이터 업데이트
|
// 리플레이 데이터 업데이트
|
||||||
ReplayManager.Instance.InitReplayData(opponentNickname, UserManager.Instance.Nickname, opponentImageIndex, UserManager.Instance.imageIndex);
|
ReplayManager.Instance.InitReplayData(opponentNickname, UserManager.Instance.Nickname, opponentImageIndex, UserManager.Instance.imageIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameManager.Instance.panelManager.CloseLoadingPanel();
|
||||||
|
|
||||||
// 첫 번째 플레이어(유저)부터 시작
|
// 첫 번째 플레이어(유저)부터 시작
|
||||||
SetState(firstPlayerState);
|
SetState(firstPlayerState);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,6 @@ public class MultiplayManager : IDisposable
|
|||||||
private void DoOpponent(SocketIOResponse response)
|
private void DoOpponent(SocketIOResponse response)
|
||||||
{
|
{
|
||||||
var data = response.GetValue<MoveData>();
|
var data = response.GetValue<MoveData>();
|
||||||
|
|
||||||
if (data != null && data.position != null)
|
if (data != null && data.position != null)
|
||||||
{
|
{
|
||||||
Vector2Int opponentPosition = new Vector2Int(data.position.x, data.position.y);
|
Vector2Int opponentPosition = new Vector2Int(data.position.x, data.position.y);
|
||||||
@ -221,7 +220,7 @@ public class MultiplayManager : IDisposable
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_roomId))
|
if (string.IsNullOrEmpty(_roomId))
|
||||||
{
|
{
|
||||||
Debug.LogError("LeaveRoom 호출 실패: _roomId가 설정되지 않음");
|
Debug.LogError("RequestSurrender 호출 실패: _roomId가 설정되지 않음");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_socket.Emit("requestSurrender",new { roomId = _roomId });
|
_socket.Emit("requestSurrender",new { roomId = _roomId });
|
||||||
@ -248,7 +247,7 @@ public class MultiplayManager : IDisposable
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_roomId))
|
if (string.IsNullOrEmpty(_roomId))
|
||||||
{
|
{
|
||||||
Debug.LogError("LeaveRoom 호출 실패: _roomId가 설정되지 않음");
|
Debug.LogError("SendTimeout 호출 실패: _roomId가 설정되지 않음");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_socket.Emit("sendTimeout",new { roomId = _roomId });
|
_socket.Emit("sendTimeout",new { roomId = _roomId });
|
||||||
@ -345,7 +344,6 @@ public class MultiplayManager : IDisposable
|
|||||||
|
|
||||||
public void RequestRevengeRequest()
|
public void RequestRevengeRequest()
|
||||||
{
|
{
|
||||||
Debug.Log("RequestRevengeRequest: " + _roomId);
|
|
||||||
if (string.IsNullOrEmpty(_roomId))
|
if (string.IsNullOrEmpty(_roomId))
|
||||||
{
|
{
|
||||||
Debug.LogError("requestDraw 호출 실패: _roomId가 설정되지 않음");
|
Debug.LogError("requestDraw 호출 실패: _roomId가 설정되지 않음");
|
||||||
@ -388,7 +386,7 @@ public class MultiplayManager : IDisposable
|
|||||||
private void RevengeConfirmed(SocketIOResponse response)
|
private void RevengeConfirmed(SocketIOResponse response)
|
||||||
{
|
{
|
||||||
var data = response.GetValue<RevengeData>();
|
var data = response.GetValue<RevengeData>();
|
||||||
Debug.Log("data??: " + data.isBlack + data.message);
|
|
||||||
_onMultiplayStateChanged?.Invoke(Constants.MultiplayManagerState.RevengeConfirmed, data);
|
_onMultiplayStateChanged?.Invoke(Constants.MultiplayManagerState.RevengeConfirmed, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,6 +423,7 @@ public class MultiplayManager : IDisposable
|
|||||||
_socket.Disconnect();
|
_socket.Disconnect();
|
||||||
_socket.Dispose();
|
_socket.Dispose();
|
||||||
_socket = null;
|
_socket = null;
|
||||||
|
_roomId = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -19,16 +20,23 @@ public class LoadingPanelController : MonoBehaviour
|
|||||||
[SerializeField] private float interval = 0.4f; // 글자 추가 속도 조정 가능
|
[SerializeField] private float interval = 0.4f; // 글자 추가 속도 조정 가능
|
||||||
[SerializeField] float flipDuration = 0.3f; // 회전 시간
|
[SerializeField] float flipDuration = 0.3f; // 회전 시간
|
||||||
[SerializeField] float delayBetweenFlips = 1f; // 이미지 변경 주기
|
[SerializeField] float delayBetweenFlips = 1f; // 이미지 변경 주기
|
||||||
|
|
||||||
|
[SerializeField] private GameObject imageBackground;
|
||||||
|
[SerializeField] private GameObject simpleBackground;
|
||||||
|
|
||||||
private int currentLength = 0;
|
private int currentLength = 0;
|
||||||
private CancellationTokenSource cancellationTokenSource;
|
private CancellationTokenSource cancellationTokenSource;
|
||||||
|
|
||||||
// 타 컴포넌트에서 애니메이션 효과 설정을 위해 호출(RotateImages와 FlipImages 혼용은 불가능: DORotate가 서로 충돌함)
|
// 타 컴포넌트에서 애니메이션 효과 설정을 위해 호출(RotateImages와 FlipImages 혼용은 불가능: DORotate가 서로 충돌함)
|
||||||
public void StartLoading(bool animatedImage, bool animatedText, bool animatedFlip)
|
public void StartLoading(bool animatedImage, bool animatedText, bool animatedFlip, bool isBackgroundImage)
|
||||||
{
|
{
|
||||||
// 패널 활성화
|
// 패널 활성화
|
||||||
gameObject.SetActive(true);
|
gameObject.SetActive(true);
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
|
// 배경 이미지 설정
|
||||||
|
imageBackground.SetActive(isBackgroundImage);
|
||||||
|
simpleBackground.SetActive(!isBackgroundImage);
|
||||||
|
|
||||||
if (animatedImage) RotateImages(); // 캐릭터들이 좌우로 회전하는 효과
|
if (animatedImage) RotateImages(); // 캐릭터들이 좌우로 회전하는 효과
|
||||||
if (animatedText) StartCoroutine(AnimateLoadingText()); // 한글자씩 나타나는 효과
|
if (animatedText) StartCoroutine(AnimateLoadingText()); // 한글자씩 나타나는 효과
|
||||||
|
@ -157,7 +157,7 @@ public class PanelManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenLoadingPanel(bool rotateImage = false, bool animatedText = false, bool flipImage = false)
|
public void OpenLoadingPanel(bool rotateImage = false, bool animatedText = false, bool flipImage = false, bool isBackgroundImage = true)
|
||||||
{
|
{
|
||||||
SetCanvas();
|
SetCanvas();
|
||||||
if (_canvas != null)
|
if (_canvas != null)
|
||||||
@ -166,6 +166,7 @@ public class PanelManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
// 기존 로딩 패널이 활성화되어 있으면 먼저 닫기
|
// 기존 로딩 패널이 활성화되어 있으면 먼저 닫기
|
||||||
CloseLoadingPanel();
|
CloseLoadingPanel();
|
||||||
|
Destroy(loadingPanelObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadingPanelObject = GetPanel("Loading Panel");
|
loadingPanelObject = GetPanel("Loading Panel");
|
||||||
@ -174,7 +175,7 @@ public class PanelManager : MonoBehaviour
|
|||||||
loadingPanelController = loadingPanelObject.GetComponent<LoadingPanelController>();
|
loadingPanelController = loadingPanelObject.GetComponent<LoadingPanelController>();
|
||||||
if (loadingPanelController != null)
|
if (loadingPanelController != null)
|
||||||
{
|
{
|
||||||
loadingPanelController.StartLoading(rotateImage, animatedText, flipImage);
|
loadingPanelController.StartLoading(rotateImage, animatedText, flipImage, isBackgroundImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user