public sealed override void CreateBuffer(dynamic obj = null)
        {
            var request      = new SquareRoomBufferRequest();
            var actionBuffer = new ActionBuffer <SquareRoomBufferRequest>(request);

            actionBuffer.BeforeSendBuffer +=
                (sender, args) =>
            {
                actionBuffer.Connections = ClientSingleton.Instance.Users.ToReadonlyList().GetAllConnections();

                var packet = actionBuffer.RequestPacket;
                actionBuffer.CanSend = packet.InsertRooms.Any() ||
                                       packet.RemoveRooms.Any() ||
                                       packet.UpdatedRooms.Any();
            };

            Buffers.Add(actionBuffer);
        }
Exemple #2
0
        public override void CreateBuffer(dynamic roomId)
        {
            var request = new RoomUserListBufferRequest(roomId);
            var buffer  = new ActionBuffer <RoomUserListBufferRequest>(request);

            buffer.BeforeSendBuffer += (sender, args) =>
            {
                var roomInstance = RoomSingleton.Instance.RoomInstances
                                   .FirstOrDefault(x => x.Id == roomId);

                buffer.Connections = new List <Connection>(roomInstance.TemporaryRoomHelper.GetConnections);

                var packet = buffer.RequestPacket;
                buffer.CanSend = (packet.InsertUsers.Any() ||
                                  packet.RemoveUsers.Any() ||
                                  packet.UpdateUsers.Any());
            };

            Buffers.Add(buffer);
        }
 protected override void ClearBuffer(ActionBuffer <SquareRoomBufferRequest> actionBuffer)
 {
     actionBuffer.RequestPacket = new SquareRoomBufferRequest();
 }
Exemple #4
0
        protected override void ClearBuffer(ActionBuffer <RoomUserListBufferRequest> actionBuffer)
        {
            var roomId = actionBuffer.RequestPacket.RoomId;

            actionBuffer.RequestPacket = new RoomUserListBufferRequest(roomId);
        }
 protected abstract void ClearBuffer(ActionBuffer <TReq> actionBuffer);