Exemple #1
0
        private async Task <ClientResponsePacketModel> SendAndListen(ClientPacketModelBase packet)
        {
            ClientResponsePacketModel replyPacket = null;

            this.replyIDListeners[packet.NormalRef] = null;
            await this.Send(packet);

            await this.WaitForSuccess(() =>
            {
                if (this.replyIDListeners.ContainsKey(packet.NormalRef) && this.replyIDListeners[packet.NormalRef] != null)
                {
                    replyPacket = this.replyIDListeners[packet.NormalRef];
                    return(true);
                }
                return(false);
            }, secondsToWait : 5);

            this.replyIDListeners.Remove(packet.NormalRef);
            return(replyPacket);
        }
Exemple #2
0
 private async Task Send(ClientPacketModelBase packet)
 {
     await this.Send(packet.ToSerializedPacketArray());
 }