當前位置: 首頁>>代碼示例>>Python>>正文


Python Region.autowarp方法代碼示例

本文整理匯總了Python中region.Region.autowarp方法的典型用法代碼示例。如果您正苦於以下問題:Python Region.autowarp方法的具體用法?Python Region.autowarp怎麽用?Python Region.autowarp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在region.Region的用法示例。


在下文中一共展示了Region.autowarp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: modify_lvl

# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import autowarp [as 別名]

#.........這裏部分代碼省略.........
	for flag in all_simple_flags:
		for spec in getattr(opts, 'regs_to_set_' + flag):
			try:
				rname, state = spec.split('=')
				state = int(state)
			except:
				print "*** bad %s option: '%s' (should be 'region=0/1')" % (flag, spec)
				sys.exit(1)

			r = lvl.find_region(rname)
			if not r:
				print "*** can't find region %s" % mq(rname)
				sys.exit(1)

			setattr(r, flag, state)
			if state:
				print "turned on %s for region %s" % (flag, mq(rname))
			else:
				print "turned off %s for region %s" % (flag, mq(rname))

	for spec in opts.regs_to_set_aw:
		try:
			rname, xyarena = spec.split('=')
			xyarena = xyarena.split(',')
			if len(xyarena) == 2:
				x, y = xyarena
				arena = None
			elif len(xyarena) == 3:
				x, y, arena = xyarena

			r = lvl.find_region(rname)
			x = int(x)
			y = int(y)
			r.autowarp = (x, y, arena)
			if arena:
				print "set autowarp destination for region %s to %d,%d, arena %s" % \
					(mq(rname), x, y, arena)
			else:
				print "set autowarp destination for region %s to %d,%d" % \
					(mq(rname), x, y)
		except:
			print "*** bad autowarp option: '%s' (should be 'region=x,y[,arena]')" % spec
			sys.exit(1)

	for spec in opts.regs_to_set_tiles:
		try:
			rname, cspec = spec.split('=', 1)
			bmpfile, rgb = cspec.split(':')
			r, g, b = map(int, rgb.split(','))
		except:
			print "*** bad setregiontiles option: '%s' (should be 'region=bmpfile:r,g,b')" % spec
			sys.exit(1)

		rgn = lvl.find_region(rname)
		if not rgn:
			print "*** can't find region %s" % mq(rname)
			sys.exit(1)

		try:
			bmp = BMPFile(bmpfile)
		except:
			print "*** error loading bmp file %s" % mq(bmpfile)
			sys.exit(1)

		if bmp.width != 1024 or bmp.height != 1024:
			print "*** bmp %s has wrong dimensions (must be 1024x1024)" % mq(bmpfile)
開發者ID:Ceiu,項目名稱:hyperspace-asss,代碼行數:70,代碼來源:lvltool.py


注:本文中的region.Region.autowarp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。