[common] bullet with bricks collision

This commit is contained in:
2018-01-07 20:33:05 +03:00
parent 12328a8a5e
commit 348d31d754
33 changed files with 277 additions and 217 deletions

View File

@@ -0,0 +1,38 @@
package ru.m.connect.neko;
import haxe.io.BytesOutput;
import protohx.Message;
import haxe.io.Bytes;
import sys.net.Socket;
import ru.m.connect.IConnection;
class NekoConnection extends BaseConnection {
public var socket(default, null):Socket;
public function new(socket:Socket) {
super();
this.socket = socket;
socket.setFastSend(true);
socket.output.bigEndian = false;
socket.input.bigEndian = false;
}
override public function send(packet:Message):Void {
super.send(packet);
try {
var meta = builder.packetMeta(packet);
var b = new BytesOutput();
packet.writeTo(b);
var bytes = b.getBytes();
socket.output.writeByte(meta.family);
socket.output.writeByte(meta.id);
socket.output.writeUInt16(bytes.length);
socket.output.write(bytes);
socket.output.flush();
} catch (e:Dynamic) {
trace("Error send packet: " + Type.getClassName(Type.getClass(packet)));
trace(e);
}
}
}