Example #1
0
    //매칭 응답 패킷 받기
    //매칭 중, 매칭 잡힘 처리
    public void OnReceiveMatchingResponsePacket(PacketId id, byte[] data)
    {
        //MatchingPacketId에 대한 처리해주기
        MatchingResponsePacket packet     = new MatchingResponsePacket(data);
        MatchingResponseData   packetData = packet.GetPacket();

        if (packetData.request == MatchingPacketId.MatchingResponse)
        {
            if (packetData.result == MatchingResult.Success)
            {
                Debug.Log("매칭중~~~~~~~");
                //매칭 중인것을 클라이언트에 표시해야 함
                ChangeMatchingState(MatchingState.WaitMatchingResult);
            }
            else
            {
                Debug.Log("매칭 실패");
                ChangeMatchingState(MatchingState.Nothing);
            }
        }
        //매칭이 잡힘
        else if (packetData.request == MatchingPacketId.MatchingCatch)
        {
            myInfo = -1;

            if (packetData.result == MatchingResult.Success)
            {
                myInfo = packetData.myInfo;
                //내 정보 상대 정보 저장.
                //수락 여부 버튼 띄우기.
                SoundManager.instance.PlaySound("Lobby_Matching", 1f);
                ChangeMatchingState(MatchingState.SelectMatchingResult);
            }
            else
            {
                Debug.Log("매칭 잡힘 실패");
                ChangeMatchingState(MatchingState.Nothing);
            }
        }
    }
Example #2
0
    //
    // 패킷 수신 처리.
    //

    void OnReceiveMatchingResponse(int node, PacketId id, byte[] data)
    {
        MatchingResponsePacket packet   = new MatchingResponsePacket(data);
        MatchingResponse       response = packet.GetPacket();

        string str = "ReceiveMatchingResponse:" + response.request;

        Debug.Log(str);

        switch (response.request)
        {
        case MatchingRequestId.CreateRoom:
            CreateRoomResponse(response.result, response.roomId);
            break;

        case MatchingRequestId.JoinRoom:
            JoinRoomResponse(response.result, response.roomId);
            break;

        default:
            Debug.Log("Unknown request.");
            break;
        }
    }
Example #3
0
	//
	// 패킷 수신 처리.
	//
	
	void OnReceiveMatchingResponse(int node, PacketId id, byte[] data)
	{
		MatchingResponsePacket packet = new MatchingResponsePacket(data);
		MatchingResponse response = packet.GetPacket();

		string str = "ReceiveMatchingResponse:" + response.request;
		Debug.Log(str);

		switch (response.request) {
		case MatchingRequestId.CreateRoom:
			CreateRoomResponse(response.result, response.roomId);
			break;

		case MatchingRequestId.JoinRoom:
			JoinRoomResponse(response.result, response.roomId) ;
			break;

		default:
			Debug.Log("Unknown request.");
			break;
		}
	}