Add array buffer check

This commit is contained in:
Bill 2021-07-30 15:57:57 -04:00
parent c64515e0f7
commit 63ff32a7ee
2 changed files with 6 additions and 6 deletions

View File

@ -24,6 +24,7 @@ export class EvaWireFormat implements ICodec
if(value === null) type = 'null';
else if(value instanceof Byte) type = 'byte';
else if(value instanceof Short) type = 'short';
else if(value instanceof ArrayBuffer) type = 'arraybuffer';
}
switch(type)
@ -50,6 +51,9 @@ export class EvaWireFormat implements ICodec
writer.writeString(value, true);
}
break;
case 'arraybuffer':
writer.writeBytes(value);
break;
}
}

View File

@ -1,5 +1,4 @@
import { RenderTexture } from 'pixi.js';
import { Byte } from '../../../../../core/communication/codec/Byte';
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
import { PNGEncoder } from '../../../../utils/PNGEncoder';
@ -26,9 +25,6 @@ export class RenderRoomMessageComposer implements IMessageComposer<ConstructorPa
{
const bitmapEncoded = PNGEncoder.encode(texture);
for(let i = 0; i < bitmapEncoded.byteLength; i++)
{
this._data[i] = new Byte(bitmapEncoded[i]);
}
this._data.push(bitmapEncoded);
}
}