void responseExitGameroom(C_BasePacket eventData)
    {
        if (eventData.m_basicType != BasePacketType.basePacketTypeRoom)
        {
            return;
        }
        C_BaseRoomPacket data = (C_BaseRoomPacket)eventData;

        if (data.m_roomType != RoomPacketType.roomPacketTypeLeaveRoomResponse)
        {
            return;
        }

        C_RoomPacketLeaveRoomResponse curData = (C_RoomPacketLeaveRoomResponse)data;

        if (curData.m_bIsSuccess)
        {
            m_uiManager.closeUI(1);
        }
        else
        {
            ((ResultUI)m_uiList[(int)INDEX_OF_GAMEROOM_UI.RESULT_UI]).setResultMSG("<Size= 50>방 나가기 실패!</Size>\n<size=40>다시 시도해주세요.</size>");
            openUI((int)INDEX_OF_GAMEROOM_UI.RESULT_UI);
        }
    }
    void responseRoomInfo(C_BasePacket eventData)
    {
        if (eventData.m_basicType != BasePacketType.basePacketTypeRoom)
        {
            return;
        }

        C_BaseRoomPacket data = (C_BaseRoomPacket)eventData;

        if (data.m_roomType != RoomPacketType.packetTypeRoomRoomInfoResponse)
        {
            return;
        }
        C_RoomPacketRoomInfoResponse curData = (C_RoomPacketRoomInfoResponse)data;

        if (m_bNeedInfo)
        {
            stopWaiting();
            m_bNeedInfo = false;
        }

        for (int i = 0; i < m_userInfoList.Count; ++i)
        {
            m_userInfoList[i].exitUser();
        }
        for (int i = 0; i < curData.m_listCount; ++i)
        {
            setUserInfo(curData.m_userList[i]);
        }
    }
    void responseRoomList(C_BasePacket eventData)
    {
        if (eventData.m_basicType != BasePacketType.basePacketTypeRoom)
        {
            return;
        }
        C_BaseRoomPacket data = (C_BaseRoomPacket)eventData;

        if (data.m_roomType != RoomPacketType.roomPacketTypeRoomListResponse)
        {
            return;
        }
        C_RoomPacketRoomListResponse curData = (C_RoomPacketRoomListResponse)data;


        m_nCurPageNUM   += m_nOffsetPageNUM;
        m_nOffsetPageNUM = 0;
        if (curData.m_listCount <= 0)
        {
            if (m_nCurPageNUM != 1)
            {
                m_nCurPageNUM -= 1;
                requestRoomList(m_nCurPageNUM);
            }
            else
            {
                clearRoomList();
                m_roomListParent.gameObject.SetActive(false);
                m_emptyRoomText.SetActive(true);
            }
        }
        else
        {
            m_nPrePageNUM      = m_nCurPageNUM;
            m_pageNumText.text = m_nCurPageNUM + "";
            clearRoomList();
            for (int i = 0; i < curData.m_listCount; ++i)
            {
                GameObject   roomInfoObject = Instantiate(m_roomInfoPrefabs, m_roomListParent);
                roomInfoSlot curRoomInfo    = roomInfoObject.GetComponent <roomInfoSlot>();
                curRoomInfo.setRoomInfo(i,
                                        curData.m_roomList[i],
                                        "대충 모드",
                                        new roomInfoSlot.d_onClickEvent(roomInfoOnClickEvent));
                m_roomInfoList.Add(curRoomInfo);
            }
            m_roomListParent.gameObject.SetActive(true);
            m_emptyRoomText.SetActive(false);
        }
    }
 public override void update(C_BasePacket eventData)
 {
     if (eventData.m_basicType == BasePacketType.basePacketTypeSocial)
     {
         responseChat(eventData);
     }
     // 만약 서브 ui가 열려있다면 그쪽으로 throw
     isExistSubUI(eventData);
     if (m_listener != null)
     {
         m_listener(eventData);
     }
     else if (eventData.m_basicType == BasePacketType.basePacketTypeRoom)
     {
         C_BaseRoomPacket data = (C_BaseRoomPacket)eventData;
         if (data.m_roomType == RoomPacketType.roomPacketTypeRoomListResponse)
         {
             responseRoomList(eventData);
         }
     }
 }
Beispiel #5
0
    // response make room
    void responseMakeRoom(C_BasePacket eventData)
    {
        if (eventData.m_basicType != BasePacketType.basePacketTypeRoom)
        {
            return;
        }
        C_BaseRoomPacket data = (C_BaseRoomPacket)eventData;

        if (data.m_roomType != RoomPacketType.roomPacketTypeMakeRoomResponse)
        {
            return;
        }
        C_RoomPacketMakeRoomResponse curData = (C_RoomPacketMakeRoomResponse)data;

        stopWaiting();

        if (curData.m_success == true)
        {
            m_uiManager.closeUI(1);
            //// 2. setting  game room
            //// ...
            string mode = myApi.GetDescription(m_selectedModeValue);
            if (mode == null)
            {
                throw new System.Exception("makeRoom::Enum Error");
            }
            List <S_RoomUserInfo> userInfo = new List <S_RoomUserInfo>();
            userInfo.Add(new S_RoomUserInfo(1, GameManager.m_Instance.getUserNickName(), 0, false, true));
            // 부모 ui 호출 및 게임 룸 세팅
            ((mainMenuUI)m_uiManager).openGameRoom(true, 1, m_roomNameIF.text, curData.m_roomNumber,
                                                   mode, m_bPublic, m_nSelectedManCountValue, userInfo);
        }
        else
        {
            //실패
            ((failUI)m_uiList[(int)INDEX_MAKEROOM_UI.FAIL_MAKE_ROOM]).setFail();
            openUI((int)INDEX_MAKEROOM_UI.FAIL_MAKE_ROOM);
        }
    }
    void responseEnterRoom(C_BasePacket eventData)
    {
        if (eventData.m_basicType != BasePacketType.basePacketTypeRoom)
        {
            return;
        }
        C_BaseRoomPacket data = (C_BaseRoomPacket)eventData;

        if (data.m_roomType != RoomPacketType.roomPacketTypeEnterRoomResponse)
        {
            return;
        }
        C_RoomPacketEnterRoomResponse curData = (C_RoomPacketEnterRoomResponse)data;

        stopWaiting();

        if (curData.m_bIsSuccess == true)
        {
            //성공
            // 1. close this ui
            m_uiManager.closeUI(1);
            // 2. setting  game room
            List <S_RoomUserInfo> userInfo = new List <S_RoomUserInfo>();
            // 패킷으로 받은 유저들의 정보 add
            // ...
            //userInfo.Add(new S_RoomUserInfo( GameManager.m_Instance.getUserNickName(), 0, false, false));
            // 부모 ui 호출 및 게임 룸 세팅
            ((mainMenuUI)m_uiManager).openGameRoom(false, curData.m_nSlotIndex,
                                                   m_roomInfo.m_roomName, m_roomInfo.m_number, m_modeText.text,
                                                   m_roomInfo.m_password == false, m_roomInfo.m_maxPlayerCount, userInfo);
        }
        else
        {
            string errorMsg = "<Size=50>방 참가 실패!!</Size>\n<size=30>";
            switch (curData.m_errorType)
            {
            case ErrorTypeEnterRoom.errorTypeNone:
                errorMsg += "알수 없는 이유";
                break;

            case ErrorTypeEnterRoom.errorTypeNotExistRoom:
                errorMsg += "해당 방이 존재 하지 않습니다.";
                m_dOnDeleteRoom?.Invoke(m_roomInfo.m_number);
                break;

            case ErrorTypeEnterRoom.errorTypeWrongPassword:
                errorMsg += "비밀 번호가 일치 하지 않습니다.";
                break;

            case ErrorTypeEnterRoom.errorTypeAlreadyIncluded:
                errorMsg += "잘 못된 접근입니다.";
                break;

            case ErrorTypeEnterRoom.errorTypeGameStart:
                errorMsg += "이미 게임이 시작된 방입니다.";
                m_dOnStartRoom?.Invoke(m_roomInfo.m_number);
                break;

            case ErrorTypeEnterRoom.errorTypeMaxPlayer:
                errorMsg += "꽉 차서 자리가 없습니다.";
                break;

            case ErrorTypeEnterRoom.errorTypeCanNotEnterRoom:
                errorMsg += "참여 할 수 없습니다.";
                break;

            case ErrorTypeEnterRoom.errorTypeCount:
                errorMsg += "알수 없는 이유";
                break;
            }
            errorMsg += "</size>";


            //실패
            ((ResultUI)m_uiList[(int)INDEX_SHOWROOMINFO_UI.REUSLT_UI]).setResultMSG(errorMsg, 2);
            openUI((int)INDEX_SHOWROOMINFO_UI.REUSLT_UI);
        }
    }