2023-11-30 21:06:23 +00:00
|
|
|
class_name PackedFlowPull
|
2023-11-26 22:56:11 +00:00
|
|
|
|
|
|
|
var data:PackedByteArray = PackedByteArray()
|
|
|
|
|
|
|
|
var offset:int = 0
|
|
|
|
|
|
|
|
func _init(dataSrc:ENetPacketPeer) -> void:
|
|
|
|
if dataSrc != null:
|
|
|
|
self.data = dataSrc.get_packet()
|
|
|
|
else:
|
|
|
|
self.data.clear()
|
|
|
|
self.offset = 0
|
|
|
|
|
|
|
|
func get_u8() -> int:
|
|
|
|
var ret:int
|
|
|
|
#print(self.data.size(), " - " , self.offset)
|
|
|
|
ret = self.data[self.offset]
|
|
|
|
self.offset += 1
|
|
|
|
return ret
|
|
|
|
|
|
|
|
func get_u64() -> int:
|
|
|
|
var ret:int
|
|
|
|
ret = data.decode_u64(self.offset)
|
|
|
|
self.offset += 8
|
|
|
|
return ret
|
|
|
|
|
|
|
|
func get_f64() -> float:
|
|
|
|
var ret:float
|
|
|
|
ret = data.decode_double(self.offset)
|
|
|
|
self.offset += 8
|
|
|
|
return ret
|