|
|
@ -150,6 +150,7 @@ public class Client : MonoBehaviour { |
|
|
this.currentImagesPacketLength = (int)p.ReturnCardsImages.Setup.Number; |
|
|
this.currentImagesPacketLength = (int)p.ReturnCardsImages.Setup.Number; |
|
|
this.currentImagesPacketIndex = 0; |
|
|
this.currentImagesPacketIndex = 0; |
|
|
this.currentImages = new MemoryStream(); |
|
|
this.currentImages = new MemoryStream(); |
|
|
|
|
|
// Debug.Log("Setup received");
|
|
|
} else { |
|
|
} else { |
|
|
if (p.ReturnCardsImages.DataPacket.Id != this.currentImagesPacketIndex) |
|
|
if (p.ReturnCardsImages.DataPacket.Id != this.currentImagesPacketIndex) |
|
|
throw new Exception("images packet id doesn't match expected"); |
|
|
throw new Exception("images packet id doesn't match expected"); |
|
|
@ -157,9 +158,12 @@ public class Client : MonoBehaviour { |
|
|
Debug.Log(this.currentImages.ToArray()[0] + ":" + p.ReturnCardsImages.DataPacket.Data.Span.ToArray()[0]); |
|
|
Debug.Log(this.currentImages.ToArray()[0] + ":" + p.ReturnCardsImages.DataPacket.Data.Span.ToArray()[0]); |
|
|
this.currentImagesPacketIndex++; |
|
|
this.currentImagesPacketIndex++; |
|
|
if (this.currentImagesPacketIndex == this.currentImagesPacketLength) { |
|
|
if (this.currentImagesPacketIndex == this.currentImagesPacketLength) { |
|
|
|
|
|
// Debug.Log("Last packet received");
|
|
|
// Debug.Log("Images tar length: " + this.currentImages.Length);
|
|
|
// Debug.Log("Images tar length: " + this.currentImages.Length);
|
|
|
this.currentImages.Seek(0, SeekOrigin.Begin); |
|
|
this.currentImages.Seek(0, SeekOrigin.Begin); |
|
|
|
|
|
// Debug.Log("Starting decoding");
|
|
|
Images i = new Images(this.currentImages); |
|
|
Images i = new Images(this.currentImages); |
|
|
|
|
|
// Debug.Log("Finished decoding");
|
|
|
this.currentImagesPacketIndex = 0; |
|
|
this.currentImagesPacketIndex = 0; |
|
|
var v = new Action<Images>[this.returnCardImagesHandlers.Count]; |
|
|
var v = new Action<Images>[this.returnCardImagesHandlers.Count]; |
|
|
this.returnCardImagesHandlers.Values.CopyTo(v, 0); |
|
|
this.returnCardImagesHandlers.Values.CopyTo(v, 0); |
|
|
|