本文整理匯總了Python中cuwo.bytes.ByteReader.get_left方法的典型用法代碼示例。如果您正苦於以下問題:Python ByteReader.get_left方法的具體用法?Python ByteReader.get_left怎麽用?Python ByteReader.get_left使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cuwo.bytes.ByteReader
的用法示例。
在下文中一共展示了ByteReader.get_left方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_static_entities
# 需要導入模塊: from cuwo.bytes import ByteReader [as 別名]
# 或者: from cuwo.bytes.ByteReader import get_left [as 別名]
def test_static_entities(self):
with open('./tests/tgen_static.dat', 'rb') as fp:
data = zlib.decompress(fp.read())
reader = ByteReader(data)
source = []
while reader.get_left() > 0:
entity = StaticEntityHeader()
entity.read(reader)
source.append(entity)
chunk = tgen.generate(32803, 32803)
self.assertEqual(len(chunk.static_entities), len(source))
for index, entity in enumerate(chunk.static_entities):
header1 = entity.header
header2 = source[index]
self.assertEqual(header1.entity_type, header2.entity_type)
self.assertEqual(header1.pos, header2.pos)
self.assertEqual(header1.orientation, header2.orientation)
self.assertEqual(header1.size, header2.size)
self.assertEqual(header1.closed, header2.closed)
self.assertEqual(header1.time_offset, header2.time_offset)
self.assertEqual(header1.something8, header2.something8)
self.assertEqual(header1.user_id, header2.user_id)
示例2: test_static_entities
# 需要導入模塊: from cuwo.bytes import ByteReader [as 別名]
# 或者: from cuwo.bytes.ByteReader import get_left [as 別名]
def test_static_entities(self):
with open('./tests/tgen_static.dat', 'rb') as fp:
data = zlib.decompress(fp.read())
reader = ByteReader(data)
source = []
while reader.get_left() > 0:
entity = StaticEntityHeader()
entity.read(reader)
source.append(entity)
chunk = tgen.generate(32803, 32803)
self.assertEqual(len(chunk.static_entities), len(source))
for index, entity in enumerate(chunk.static_entities):
header1 = entity.header
header2 = source[index]
self.assertEqual(header1.entity_type, header2.entity_type)
self.assertEqual(header1.pos, header2.pos)
self.assertEqual(header1.orientation, header2.orientation)
self.assertEqual(header1.size, header2.size)
self.assertEqual(header1.closed, header2.closed)
self.assertEqual(header1.time_offset, header2.time_offset)
self.assertEqual(header1.something8, header2.something8)
self.assertEqual(header1.user_id, header2.user_id)
events = [
('generate', (1007, 4974)),
('generate', (1007, 4973)),
('generate', (1007, 4972)),
('generate', (1007, 4971)),
('destroy', (1007, 4973)),
('generate', (1007, 4970)),
('destroy', (1007, 4972)),
('generate', (1007, 4969))
]
chunks = {}
for (event, chunk) in events:
if event == 'generate':
chunks[chunk] = tgen.generate(*chunk)
elif event == 'destroy':
chunks[chunk].destroy()