public void OnRoomListAnswer(ProtobufPacket <RoomListAnswerPacket> packet)
        {
            RoomListAnswerPacket answer = packet.ProtobufMessage;

            List <string> names = new List <string>();

            foreach (var s in answer.RoomNames)
            {
                names.Add(s);
            }

            OnRoomListRefresh?.Invoke(this, names);
        }
Beispiel #2
0
        private void OnRoomListRequest(ProtobufPacket <RoomListRequestPacket> packet)
        {
            RoomListRequestPacket request = packet.ProtobufMessage;
            RoomListAnswerPacket  send    = new RoomListAnswerPacket();

            // Packet Data Set

            foreach (var iter in NetworkLobby.GetAllRoomNames())
            {
                send.RoomNames.Add(iter);
            }

            Debug.Log($"S:[{packet.Serial}] Room list return request.");

            SendPacket(new ProtobufPacket <RoomListAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                 (int)MessageType.RoomListAnswer, send));
        }