private void ProcessMatchSuccess(MatchMakingResponseEventArgs args) { ErrorInfo errorInfo; if (sessionIdList != null) { Debug.Log("이전 세션 정보 저장"); sessionIdList.Clear(); } if (!Backend.Match.JoinGameServer(args.RoomInfo.m_inGameServerEndPoint.m_address, args.RoomInfo.m_inGameServerEndPoint.m_port, false, out errorInfo)) { var debugLog = string.Format("실패", errorInfo.ToString(), string.Empty); Debug.Log(debugLog); } isConnectInGameServer = true; isJoinGameRoom = false; isReconnectProcess = false; inGameRoomToken = args.RoomInfo.m_inGameRoomToken; isSandBoxGame = args.RoomInfo.m_enableSandbox; var info = GetMatchInfo(args.MatchCardIndate); if (info == null) { Debug.LogError("매치 정보를 불러오는 데 실패했습니다."); return; } nowmatchType = info.matchType; nowModeType = info.matchModeType; numOfClient = int.Parse(info.HeadCount); }
// 매칭 성공 public void MatchSuccess(MatchMakingResponseEventArgs args) { ErrorInfo errorInfo; inGameRoomToken = args.RoomInfo.m_inGameRoomToken; Backend.Match.JoinGameServer(args.RoomInfo.m_inGameServerEndPoint.m_address, args.RoomInfo.m_inGameServerEndPoint.m_port, false, out errorInfo); }
private void ProcessAccessMatchMaking(MatchMakingResponseEventArgs args) { switch (args.ErrInfo) { case ErrorCode.Success: Log.text += "매칭성사! 곧 이동됩니다!\n"; MatchSuccess(args); break; case ErrorCode.Match_InProgress: Log.text += "매칭중...\n"; break; default: break; } }
// 매칭 성공했을 때 // 인게임 서버로 접속해야 한다. private void ProcessMatchSuccess(MatchMakingResponseEventArgs args) { ErrorInfo errorInfo; if (sessionIdList != null) { Debug.Log("이전 세션 저장 정보"); sessionIdList.Clear(); } if (!Backend.Match.JoinGameServer(args.RoomInfo.m_inGameServerEndPoint.m_address, args.RoomInfo.m_inGameServerEndPoint.m_port, false, out errorInfo)) { var debugLog = string.Format(FAIL_ACCESS_INGAME, errorInfo.ToString(), string.Empty); Debug.Log(debugLog); } // 인자값에서 인게임 룸토큰을 저장해두어야 한다. // 인게임 서버에서 룸에 접속할 때 필요 // 1분 내에 모든 유저가 룸에 접속하지 않으면 해당 룸은 파기된다. isConnectInGameServer = true; isJoinGameRoom = false; isReconnectProcess = false; inGameRoomToken = args.RoomInfo.m_inGameRoomToken; isSandBoxGame = args.RoomInfo.m_enableSandbox; var info = GetMatchInfo(args.MatchCardIndate); if (info == null) { Debug.LogError("매치 정보를 불러오는 데 실패했습니다."); return; } nowMatchType = info.matchType; nowModeType = info.matchModeType; numOfClient = int.Parse(info.headCount); }
private void ProcessMatchMakingResponse(MatchMakingResponseEventArgs args) { string debugLog = string.Empty; switch (args.ErrInfo) { case ErrorCode.Success: //매칭성공시 debugLog = string.Format("성공", args.Reason); ProcessMatchSuccess(args); SceneManager.LoadScene("GameScene"); break; case ErrorCode.Match_InProgress: //매치 중일때 재신청하면 if (args.Reason == string.Empty) { debugLog = "성공"; } break; case ErrorCode.Match_MatchMakingCanceled: debugLog = string.Format("취소", args.Reason); break; } }
/* * 매칭 신청에 대한 리턴값 (호출되는 종류) * 매칭 신청 성공했을 때 * 매칭 성공했을 때 * 매칭 신청 실패했을 때 */ private void ProcessMatchMakingResponse(MatchMakingResponseEventArgs args) { string debugLog = string.Empty; bool isError = false; switch (args.ErrInfo) { case ErrorCode.Success: // 매칭 성공했을 때 debugLog = string.Format(SUCCESS_MATCHMAKE, args.Reason); MainUI.instance.MatchDoneCallback(); ProcessMatchSuccess(args); break; case ErrorCode.Match_InProgress: // 매칭 신청 성공했을 때 or 매칭 중일 때 매칭 신청을 시도했을 때 // 매칭 신청 성공했을 때 if (args.Reason == string.Empty) { debugLog = SUCCESS_REGIST_MATCHMAKE; MainUI.instance.MatchRequestCallback(true); } break; case ErrorCode.Match_MatchMakingCanceled: // 매칭 신청이 취소되었을 때 debugLog = string.Format(CANCEL_MATCHMAKE, args.Reason); MainUI.instance.MatchCancelCallback(); LeaveMatchLoom(); break; case ErrorCode.Match_InvalidMatchType: isError = true; // 매치 타입을 잘못 전송했을 때 debugLog = string.Format(FAIL_REGIST_MATCHMAKE, INVAILD_MATCHTYPE); MainUI.instance.MatchCancelCallback(); break; case ErrorCode.Match_InvalidModeType: isError = true; // 매치 모드를 잘못 전송했을 때 debugLog = string.Format(FAIL_REGIST_MATCHMAKE, INVALID_MODETYPE); MainUI.instance.MatchCancelCallback(); break; case ErrorCode.InvalidOperation: isError = true; // 잘못된 요청을 전송했을 때 debugLog = string.Format(INVALID_OPERATION, args.Reason); MainUI.instance.MatchCancelCallback(); CancelRegistMatchMaking(); break; case ErrorCode.Match_Making_InvalidRoom: isError = true; // 잘못된 요청을 전송했을 때 debugLog = string.Format(INVALID_OPERATION, args.Reason); MainUI.instance.MatchCancelCallback(); break; case ErrorCode.Exception: isError = true; // 매칭 되고, 서버에서 방 생성할 때 에러 발생 시 exception이 리턴됨 // 이 경우 다시 매칭 신청해야 됨 debugLog = string.Format(EXCEPTION_OCCUR, args.Reason); MainUI.instance.ResetMatchRoom(); MainUI.instance.RequestMatch(); break; } if (!debugLog.Equals(string.Empty)) { Debug.Log(debugLog); if (isError == true) { MainUI.instance.SetErrorLog(debugLog); } } }