mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-31 11:12:35 +01:00
Add array buffer check
This commit is contained in:
parent
c64515e0f7
commit
63ff32a7ee
@ -24,6 +24,7 @@ export class EvaWireFormat implements ICodec
|
|||||||
if(value === null) type = 'null';
|
if(value === null) type = 'null';
|
||||||
else if(value instanceof Byte) type = 'byte';
|
else if(value instanceof Byte) type = 'byte';
|
||||||
else if(value instanceof Short) type = 'short';
|
else if(value instanceof Short) type = 'short';
|
||||||
|
else if(value instanceof ArrayBuffer) type = 'arraybuffer';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
@ -50,6 +51,9 @@ export class EvaWireFormat implements ICodec
|
|||||||
writer.writeString(value, true);
|
writer.writeString(value, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'arraybuffer':
|
||||||
|
writer.writeBytes(value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,4 +88,4 @@ export class EvaWireFormat implements ICodec
|
|||||||
|
|
||||||
return wrappers;
|
return wrappers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RenderTexture } from 'pixi.js';
|
import { RenderTexture } from 'pixi.js';
|
||||||
import { Byte } from '../../../../../core/communication/codec/Byte';
|
|
||||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||||
import { PNGEncoder } from '../../../../utils/PNGEncoder';
|
import { PNGEncoder } from '../../../../utils/PNGEncoder';
|
||||||
|
|
||||||
@ -26,9 +25,6 @@ export class RenderRoomMessageComposer implements IMessageComposer<ConstructorPa
|
|||||||
{
|
{
|
||||||
const bitmapEncoded = PNGEncoder.encode(texture);
|
const bitmapEncoded = PNGEncoder.encode(texture);
|
||||||
|
|
||||||
for(let i = 0; i < bitmapEncoded.byteLength; i++)
|
this._data.push(bitmapEncoded);
|
||||||
{
|
|
||||||
this._data[i] = new Byte(bitmapEncoded[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user