mirror of
https://port.numenaute.org/aleajactaest/bazar_alea.git
synced 2024-11-22 07:06:13 +00:00
adding missing file
This commit is contained in:
parent
3564ff8d58
commit
2a560388d8
1 changed files with 31 additions and 0 deletions
31
client/scripts/PackedFlow.gd
Normal file
31
client/scripts/PackedFlow.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
class_name PackedFlow
|
||||
|
||||
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
|
Loading…
Reference in a new issue