Merge pull request #89 from Degulleo/DO-85-LeaveRoom-상호작용
DO-85 [Fix] 자잘한 버그 수정
This commit is contained in:
commit
0ca6ff095b
@ -47,8 +47,7 @@ public class GameUIController : MonoBehaviour
|
||||
|
||||
public void OnClickExitButton()
|
||||
{
|
||||
// "Main" 씬으로 이동
|
||||
SceneManager.LoadScene("Main");
|
||||
GameManager.Instance.ChangeToMainScene();
|
||||
}
|
||||
|
||||
public void OnClickSurrenderButton()
|
||||
@ -94,12 +93,15 @@ public class GameUIController : MonoBehaviour
|
||||
|
||||
public void OnClickRevengeRequestButton()
|
||||
{
|
||||
if (!GameManager.Instance.GetGameLogic().OpponentExist)
|
||||
{
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 방을 나갔습니다.",() => { });
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameManager.Instance.CheckIsSinglePlay())
|
||||
{
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 방을 나갔습니다.",() =>
|
||||
{
|
||||
|
||||
});
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 방을 나갔습니다.",() => { });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -178,7 +180,6 @@ public class GameUIController : MonoBehaviour
|
||||
/// <param name="gameInProgress">게임 진행이면 true</param>
|
||||
public void SetButtonsIndicator(bool gameInProgress)
|
||||
{
|
||||
Debug.Log("gameInProgress" + gameInProgress);
|
||||
inGameMenuButtonsObject.SetActive(gameInProgress);
|
||||
confirmButtonObject.SetActive(gameInProgress);
|
||||
timerObject.SetActive(!gameInProgress);
|
||||
|
@ -146,6 +146,7 @@ GameObject:
|
||||
- component: {fileID: 8494676347912440962}
|
||||
- component: {fileID: 1257633341820217709}
|
||||
- component: {fileID: 1753961836956471979}
|
||||
- component: {fileID: 1873769388125956862}
|
||||
m_Layer: 5
|
||||
m_Name: Ok Button
|
||||
m_TagString: Untagged
|
||||
@ -267,6 +268,19 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &1873769388125956862
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2317228258542092256}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4330206548604932b038a7007dacf94b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
enableOneTimeClick: 1
|
||||
--- !u!1 &4661890517030743811
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -597,6 +611,7 @@ GameObject:
|
||||
- component: {fileID: 2998236242917363859}
|
||||
- component: {fileID: 8555214474145769210}
|
||||
- component: {fileID: 7759243219178030454}
|
||||
- component: {fileID: 3536771767490368521}
|
||||
m_Layer: 5
|
||||
m_Name: Close Button
|
||||
m_TagString: Untagged
|
||||
@ -717,3 +732,16 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &3536771767490368521
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8913073875457554875}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4330206548604932b038a7007dacf94b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
enableOneTimeClick: 1
|
||||
|
@ -146,6 +146,7 @@ GameObject:
|
||||
- component: {fileID: 8494676347912440962}
|
||||
- component: {fileID: 1257633341820217709}
|
||||
- component: {fileID: 1753961836956471979}
|
||||
- component: {fileID: 158827458667474525}
|
||||
m_Layer: 5
|
||||
m_Name: Yes Button
|
||||
m_TagString: Untagged
|
||||
@ -267,6 +268,19 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &158827458667474525
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2317228258542092256}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4330206548604932b038a7007dacf94b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
enableOneTimeClick: 1
|
||||
--- !u!1 &3698158704839373389
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -639,6 +653,8 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
panelRectTransform: {fileID: 1049729465715420315}
|
||||
messageText: {fileID: 773857893073654059}
|
||||
yesButton: {fileID: 2317228258542092256}
|
||||
noButton: {fileID: 8664974708086771355}
|
||||
--- !u!1 &8611399693750823341
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -729,6 +745,7 @@ GameObject:
|
||||
- component: {fileID: 6738990646649674804}
|
||||
- component: {fileID: 4523293559331202638}
|
||||
- component: {fileID: 3091834035832018361}
|
||||
- component: {fileID: 5520929008480269547}
|
||||
m_Layer: 5
|
||||
m_Name: No Button
|
||||
m_TagString: Untagged
|
||||
@ -850,3 +867,16 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &5520929008480269547
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8664974708086771355}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4330206548604932b038a7007dacf94b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
enableOneTimeClick: 1
|
||||
|
@ -1104,7 +1104,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "18\uAE09"
|
||||
m_text: "1\uAE09"
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||
m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||
@ -1457,7 +1457,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &405965270916774547
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1727,7 +1727,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "\uD638\uB7AD\uC774"
|
||||
m_text: ksh
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||
m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2}
|
||||
@ -1813,7 +1813,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &8172929902404983356
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2497,7 +2497,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 35a536dce57360441898a57e5d5a1335, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
exitButton: {fileID: 2183639868091494604}
|
||||
exitButton: {fileID: 403017146611159122}
|
||||
retryButton: {fileID: 0}
|
||||
playerANameText: {fileID: 4888719462249568075}
|
||||
playerBNameText: {fileID: 5649645114775233136}
|
||||
indicatorA: {fileID: 822440635660578859}
|
||||
|
@ -35,6 +35,7 @@ public partial class GameLogic : IDisposable
|
||||
public int SelectedCol { get; private set; }
|
||||
public FioTimer FioTimer { get; private set; }
|
||||
public bool GameInProgress { get; private set; } // 게임 진행 중인지 확인
|
||||
public bool OpponentExist { get; private set; } // 상대방 존재 여부
|
||||
|
||||
#endregion
|
||||
|
||||
@ -46,6 +47,7 @@ public partial class GameLogic : IDisposable
|
||||
InitializeBoard(stoneController, gameType); // 보드 초기화
|
||||
InitializeFioTimer(fioTimer); // timer 초기화
|
||||
GameModeSetter(gameType); // 게임 모드 설정
|
||||
OpponentExist = false;
|
||||
}
|
||||
|
||||
// 게임 모드 분기 처리
|
||||
@ -114,17 +116,16 @@ public partial class GameLogic : IDisposable
|
||||
StartGameOnMainThread();
|
||||
break;
|
||||
case Constants.MultiplayManagerState.ExitRoom:
|
||||
Debug.Log("## Exit Room");
|
||||
Debug.Log("## Exit Room"); // 방을 나갔으니 room id == null
|
||||
OpponentExist = false;
|
||||
// TODO: Exit Room 처리
|
||||
break;
|
||||
case Constants.MultiplayManagerState.EndGame:
|
||||
Debug.Log("## End Game");
|
||||
OpponentExist = false;
|
||||
ExecuteOnMainThread(() =>
|
||||
{
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 방을 나갔습니다.", () =>
|
||||
{
|
||||
// TODO: 무승부/항복 등 버튼 동작 안하도록 처리
|
||||
});
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel("상대방이 방을 나갔습니다.", () => { });
|
||||
});
|
||||
break;
|
||||
case Constants.MultiplayManagerState.DoSurrender:
|
||||
@ -298,6 +299,7 @@ public partial class GameLogic : IDisposable
|
||||
break;
|
||||
case Constants.MultiplayManagerState.OpponentDisconnected:
|
||||
Debug.Log("상대방 강제 종료");
|
||||
OpponentExist = false;
|
||||
ExecuteOnMainThread(() =>
|
||||
{
|
||||
GameManager.Instance.panelManager.OpenConfirmPanel("연결이 끊어졌습니다.", () =>
|
||||
@ -338,6 +340,8 @@ public partial class GameLogic : IDisposable
|
||||
|
||||
UpdateUIForSecondPlayer(_opponentNickname, _opponentImageIndex);
|
||||
}
|
||||
|
||||
OpponentExist = true;
|
||||
}
|
||||
|
||||
private void UpdateUIForFirstPlayer(string opponentNickname, int opponentImageIndex)
|
||||
@ -369,7 +373,6 @@ public partial class GameLogic : IDisposable
|
||||
private void StartGameOnMainThread()
|
||||
{
|
||||
ChangeGameInProgress(true);
|
||||
Debug.Log("GameInProgress 변경 true");
|
||||
GameButtonSetter(GameInProgress); // 버튼 상태 교체
|
||||
|
||||
ExecuteOnMainThread(() =>
|
||||
@ -601,13 +604,15 @@ public partial class GameLogic : IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MultiPlayManager?.LeaveRoom(_roomId);
|
||||
MultiPlayManager?.LeaveRoom();
|
||||
_roomId = null; // room id 초기화
|
||||
MultiPlayManager?.Dispose();
|
||||
}
|
||||
|
||||
public void ForceQuit()
|
||||
{
|
||||
MultiPlayManager?.ForceQuit(_roomId);
|
||||
MultiPlayManager?.ForceQuit();
|
||||
_roomId = null;
|
||||
MultiPlayManager?.Dispose();
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,11 @@ public class GameManager : Singleton<GameManager>
|
||||
InitPanels();
|
||||
}
|
||||
|
||||
public GameLogic GetGameLogic()
|
||||
{
|
||||
return _gameLogic;
|
||||
}
|
||||
|
||||
public MultiplayManager GetMultiplayManager()
|
||||
{
|
||||
_multiplayManager = _gameLogic.MultiPlayManager;
|
||||
@ -78,7 +83,10 @@ public class GameManager : Singleton<GameManager>
|
||||
{
|
||||
_gameType = Enums.GameType.None;
|
||||
// TODO: 추후 혹시 모를 존재하는 socket 통신 종료 필요 - _gameLogic?.Dispose에서 LeaveRoom 호출하긴 하는데 서버에서 이미 해당 방을 삭제했을 경우 동작 확인 필요
|
||||
// _gameLogic?.Dispose();
|
||||
if (_multiplayManager.GetRoomId() != null) // null 에러 방지
|
||||
{
|
||||
_gameLogic?.Dispose();
|
||||
}
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,6 @@ public partial class GameLogic
|
||||
ReplayManager.Instance.SaveReplayDataResult(result);
|
||||
//TODO: 게임 종료 후 행동 구현
|
||||
ChangeGameInProgress(false);
|
||||
Debug.Log("GameInProgress 변경 false");
|
||||
// 인게임 버튼 표시
|
||||
GameManager.Instance.SetButtonsIndicator(false);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public class MultiplayManager : IDisposable
|
||||
_onMultiplayStateChanged?.Invoke(Constants.MultiplayManagerState.EndGame, null);
|
||||
}
|
||||
|
||||
public void LeaveRoom(string roomId)
|
||||
public void LeaveRoom() // MultiplayManager에 있는 _roomId 사용, 매개변수 필요 X
|
||||
{
|
||||
if (string.IsNullOrEmpty(_roomId))
|
||||
{
|
||||
@ -218,7 +218,7 @@ public class MultiplayManager : IDisposable
|
||||
_roomId = null; // 방 나가면 roomId 초기화
|
||||
}
|
||||
|
||||
public void ForceQuit(string roomId)
|
||||
public void ForceQuit()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_roomId))
|
||||
{
|
||||
@ -454,4 +454,9 @@ public class MultiplayManager : IDisposable
|
||||
_roomId = null;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetRoomId()
|
||||
{
|
||||
return _roomId;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ public class ConfirmPanelController : PanelController
|
||||
|
||||
public void Show(string message, OnConfirmButtonClick onConfirmButtonClick, bool isClose, bool isConfirm)
|
||||
{
|
||||
confirmButton.GetComponent<SingleInteractableButtonHandler>().ResetButton();
|
||||
closeButton.GetComponent<SingleInteractableButtonHandler>().ResetButton();
|
||||
|
||||
messageText.text = message;
|
||||
this.onConfirmButtonClick = onConfirmButtonClick;
|
||||
closeButton.SetActive(isClose);
|
||||
|
@ -6,6 +6,8 @@ using UnityEngine;
|
||||
public class DrawConfirmPanelController : PanelController
|
||||
{
|
||||
[SerializeField] private TMP_Text messageText; //자식 텍스트 변수
|
||||
[SerializeField] private GameObject yesButton;
|
||||
[SerializeField] private GameObject noButton;
|
||||
|
||||
public delegate void OnConfirmButtonClick();
|
||||
private OnConfirmButtonClick onConfirmButtonClick;
|
||||
@ -15,6 +17,9 @@ public class DrawConfirmPanelController : PanelController
|
||||
|
||||
public void Show(string message, OnConfirmButtonClick onConfirmButtonClick, OnContradictButtonClick onContradictButtonClick)
|
||||
{
|
||||
yesButton.GetComponent<SingleInteractableButtonHandler>().ResetButton();
|
||||
noButton.GetComponent<SingleInteractableButtonHandler>().ResetButton();
|
||||
|
||||
messageText.text = message;
|
||||
this.onConfirmButtonClick = onConfirmButtonClick;
|
||||
this.onContradictButtonClick = onContradictButtonClick;
|
||||
|
@ -66,6 +66,13 @@ public class PanelManager : MonoBehaviour
|
||||
|
||||
public GameObject GetEffectPanel(string panelName)
|
||||
{
|
||||
// 게임 결과 이펙트 전에 로딩 패널이 있으면 닫기
|
||||
if (loadingPanelObject != null && loadingPanelObject.activeSelf)
|
||||
{
|
||||
CloseLoadingPanel();
|
||||
Destroy(loadingPanelObject);
|
||||
}
|
||||
|
||||
if (effectPanelPrefabs.TryGetValue(panelName, out GameObject prefab))
|
||||
{
|
||||
return Instantiate(prefab, _canvas.transform);
|
||||
|
Loading…
x
Reference in New Issue
Block a user