当前位置: 首页>>代码示例>>Python>>正文


Python Matrix.placeChars方法代码示例

本文整理汇总了Python中Matrix.placeChars方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.placeChars方法的具体用法?Python Matrix.placeChars怎么用?Python Matrix.placeChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix的用法示例。


在下文中一共展示了Matrix.placeChars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Client

# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import placeChars [as 别名]
class Client(object):
	
	def __init__(self):
		self.music = base.loader.loadSfx(GAME+'/music/24.ogg')
		self.music.setLoop(True)
		self.music.play()
		self.background = GUI.Background(self.loginScreen)
	
	# Display the login window
	def loginScreen(self):
		self.loginwindow = GUI.LoginWindow(self.authenticate)
	
	def processData(self, datagram):
		iterator = PyDatagramIterator(datagram)
		source = datagram.getConnection()
		callback = iterator.getString()
		getattr(globals()[callback], 'execute')(self, iterator)
	
	# This task process data sent by the server, if any
	def tskReaderPolling(self, taskdata):
		if self.cReader.dataAvailable():
			datagram=NetDatagram()
			if self.cReader.getData(datagram):
				self.processData(datagram)
		return Task.cont
	
	# Setup connection and send the LOGIN datagram with credentials
	def authenticate(self):
		login = self.loginwindow.loginEntry.get()
		password = self.loginwindow.passwordEntry.get()
		
		self.cManager  = QueuedConnectionManager()
		self.cListener = QueuedConnectionListener(self.cManager, 0)
		self.cReader   = QueuedConnectionReader(self.cManager, 0)
		self.cReader.setTcpHeaderSize(4)
		
		self.myConnection = self.cManager.openTCPClientConnection(IP, PORT, 5000)
		if self.myConnection:
			self.cReader.addConnection(self.myConnection)
			self.send = Send(self.cManager, self.myConnection)
			print 'Client listening on', IP, ':', PORT
			taskMgr.add(self.tskReaderPolling, "Poll the connection reader")
			
			self.send.LOGIN_MESSAGE(login, password)
			
		else:
			print 'Can\'t connect to server on', IP, ':', PORT
	
	# The battle begins
	def battle_init(self):
		self.subphase = None
		
		# Instanciate the camera handler
		self.camhandler = CameraHandler()
		
		# Instanciate the keyboard tile traverser
		self.inputs = KeyboardTileTraverser(self)
		
		# Instanciate the battle graphics
		self.battleGraphics = BattleGraphics(self.party['map'])
		
		# Light the scene
		self.battleGraphics.lightScene()
		
		# Display the terrain
		self.battleGraphics.displayTerrain()
		
		# Play the background music
		self.music = base.loader.loadSfx(GAME+'/music/'+self.party['map']['music']+'.ogg')
		self.music.setLoop(True)
		self.music.play()
		
		# Load sounds
		self.hover_snd   = base.loader.loadSfx(GAME+"/sounds/hover.ogg")
		self.clicked_snd = base.loader.loadSfx(GAME+"/sounds/clicked.ogg")
		self.cancel_snd  = base.loader.loadSfx(GAME+"/sounds/cancel.ogg")
		self.attack_snd  = base.loader.loadSfx(GAME+"/sounds/attack.ogg")
		self.die_snd     = base.loader.loadSfx(GAME+"/sounds/die.ogg")
		
		# Place highlightable tiles on the map
		self.matrix = Matrix(self.battleGraphics, self.party['map'])
		self.matrix.placeChars(self.party['chars'])
		
		# Instanciate and hide the AT flag
		self.at = AT()
		self.at.hide()
		
		self.charbars = None
		self.charcard = None
		self.actionpreview = None
		
		# Generate the sky and attach it to the camera
		self.sky = Sky(self.party['map'])
		
		# Tasks
		taskMgr.add(self.characterDirectionTask , 'characterDirectionTask')
		
		# Cursor stuff
		self.cursor = Cursor(self.battleGraphics, self.matrix.container)
		
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:103,代码来源:


注:本文中的Matrix.placeChars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。