本文整理汇总了Python中dialog.Dialog.show_instancemenu方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.show_instancemenu方法的具体用法?Python Dialog.show_instancemenu怎么用?Python Dialog.show_instancemenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog.Dialog
的用法示例。
在下文中一共展示了Dialog.show_instancemenu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show_instancemenu [as 别名]
#.........这里部分代码省略.........
except AttributeError as e:
print "###################################################################################"
print "Unexpected error:", sys.exc_info()[0]
print e.message
print "--- Configuration file malformed. Deleted. ---"
print "--- Please, restart again the game ---"
print "###################################################################################"
self.deleteStatus()
self.exit()
"""
This function set the current state: if it's STATE_PAUSE it shows the PAUSE label below the
user icon. If it's a different state it hides that label.
"""
def setState(self, state):
self._state = state
if state == STATE_PLAY:
self.statusBar.hide()
else:
self.statusBar.show()
"""
These functions handle the user's clicks on the map or on one character.
If the game is paused, they'll be ignored.
"""
def leftClick(self, clickpoint):
if self._state == STATE_PLAY:
self.dialog.hide_instancemenu()
self.agentManager.getActiveAgent().run(clickpoint)
def rightClick(self, instances, clickpoint):
if self._state == STATE_PLAY:
if instances:
self.show_instancemenu(clickpoint, instances[0])
"""
The following functions are the callbacks for the instancemenu popup.
"""
# Callbacks from the popupmenu
def onMoveButtonPress(self):
if self._state == STATE_PLAY:
self.dialog.hide_instancemenu()
self.agentManager.getActiveAgent().run(self.dialog.instancemenu.instance.getLocationRef())
def onKickButtonPress(self):
if self._state == STATE_PLAY:
self.dialog.hide_instancemenu()
activeAgent = self.agentManager.getActiveInstance()
instance = self.dialog.instancemenu.instance
target_distance = activeAgent.getLocation().getLayerDistanceTo(instance.getLocation())
if target_distance < 3:
self.agentManager.getActiveAgent().kick(self.dialog.instancemenu.instance.getLocationRef())
target = self.agentManager.getAgentFromId(instance.getFifeId())
if target != None:
target.onKick()
else:
activeAgent.say("Too far...", 2000)
def onInspectButtonPress(self):
if self._state == STATE_PLAY:
self.dialog.hide_instancemenu()
inst = self.dialog.instancemenu.instance
saytext = []
saytext.append('%s' % inst.getObject().getId())
self.agentManager.getActiveAgent().say('\n'.join(saytext))