Exemplo n.º 1
0
        private void handlePacketProxy(object sender, OnPacketEventArgs e)
        {
            switch (e.Type)
            {
            case PacketTypes.GET_ROOM_LIST:
                RoomListPacket l  = (RoomListPacket)this.server.GetRoomListPacket();
                RoomListPacket l2 = new RoomListPacket(l.getBytes());
                Console.WriteLine("Room Count: " + l2.RoomCount);
                for (int i = 0; i < l2.RoomCount; i++)
                {
                    Console.WriteLine(l2.RoomList[i].Id + ": " + l2.RoomList[i].P1Name);
                }
                this.Send(l);
                break;

            case PacketTypes.CONNECT:
                this.handleConnectPacket((ConnectPacket)e.Packet);
                break;

            case PacketTypes.GAME_ERR:
                GameErrorPacket p = (GameErrorPacket)e.Packet;
                Console.WriteLine("Received Client Error: #" + p.Code + " \"" + p.Message + "\"");
                break;

            case PacketTypes.GAME_CLIENT_END:
                this.handleClientEndPacket((GameClientEndPacket)e.Packet);
                break;

            default:
                //EMIT Packet for GameRooms
                this.emitPacketEvent(e);
                break;
            }
        }
Exemplo n.º 2
0
    public RoomListPacket GetRoomList()
    {
        RoomListData roomListData = new RoomListData(room);
        RoomListPacket roomListPacket = new RoomListPacket(roomListData);

        return roomListPacket;
    }
Exemplo n.º 3
0
    //Server - 방 목록 수신
    public void RoomList(DataPacket packet)
    {
        Debug.Log("방 목록 수신");
        RoomListPacket roomListPacket = new RoomListPacket(packet.msg);
        RoomListData   roomListData   = roomListPacket.GetData();

        uiManager.WaitUIManager.SetRoom(roomListData);
    }
Exemplo n.º 4
0
    //Server - 방 목록 수신
    public void RoomList(DataPacket packet)
    {
        Debug.Log("방 목록 수신");
        RoomListPacket roomListPacket = new RoomListPacket(packet.msg);
        RoomListData   roomListData   = roomListPacket.GetData();

        UIManager.Instance.WaitingUIManager.SetRoomListData(roomListData);

        if (SceneChanger.Instance.CurrentScene == SceneChanger.SceneName.LoadingScene)
        {
            SceneChanger.Instance.LoadingCheck[0] = true;
        }
        else if (SceneChanger.Instance.CurrentScene == SceneChanger.SceneName.WaitingScene)
        {
            UIManager.Instance.WaitingUIManager.SetRoom();
        }
    }
Exemplo n.º 5
0
    //Server - 방 목록 수신
    public void RoomList(DataPacket packet)
    {
        Debug.Log("방 목록 수신");
        RoomListPacket roomListPacket = new RoomListPacket(packet.msg);
        RoomListData   roomListData   = roomListPacket.GetData();

        uiManager.WaitingUIManager.SetRoomListData(roomListData);

        for (int i = 0; i < WaitingUIManager.maxRoomNum; i++)
        {
            Debug.Log(roomListData.Rooms[i].RoomName);
            Debug.Log(roomListData.Rooms[i].PlayerNum);
        }

        if (SceneChanger.Instance.CurrentScene == SceneChanger.SceneName.LoadingScene)
        {
            SceneChanger.Instance.LoadingCheck[0] = true;
        }
    }
Exemplo n.º 6
0
    //방 목록 요청
    public void RequestRoomList(DataPacket packet)
    {
        try
        {
            Console.WriteLine(packet.client.RemoteEndPoint.ToString() + "방 목록 요청");
        }
        catch
        {
            Console.WriteLine("DataHandler::RequestRoomList.Socket 에러");
            return;
        }

        RoomListPacket roomListPacket = roomManager.GetRoomList();

        roomListPacket.SetPacketId((int)ServerPacketId.RoomList);

        byte[] msg = CreatePacket(roomListPacket);
        packet = new DataPacket(msg, packet.client);

        lock (sendLock)
        {
            sendMsgs.Enqueue(packet);
        }
    }