本文整理汇总了Python中Debug.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Debug.debug方法的具体用法?Python Debug.debug怎么用?Python Debug.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doConditionScript
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def doConditionScript(self, scriptData):
Debug.debug(__name__,'==?= condition script data form : '+str(scriptData))
tag = scriptData[0]
if len(scriptData) > 1:
args = scriptData[1]
else:
args = []
##print tag,",",args
if self.hasScript(tag):
if not self.getNumScriptArgs(tag) == len(args):
for ii in range(self.getNumScriptArgs(tag)):
print ii
if ii > len(args):
args.append("")
scriptFn = self.tagMap[tag]
bool = scriptFn(self.world, *args)
# temp
#bool = False
#print '=test= scriptFn type : ', type(scriptFn)
#print '=test= scriptFn with world and args type : ', type(scriptFn(self.world, *args))
#print '=test= scriptFn return when eval used : ', eval(scriptFn(self.world, *args))
Debug.debug(__name__,'==== script '+str(tag)+' with args '+str(args)+ ' evaluated to be : '+str(bool))
return bool
## else:
## # CONSIDER: exception class
## print 'ERROR: script \'%s\' takes %d args (%d given)' %(tag, self.getNumScriptArgs(tag), len(args))
else:
print 'ERROR: script name \'%s\' not found in doConditionScript function' %(tag)
示例2: updateData
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def updateData(self,evt = None):
Debug.debug(__name__,"Data is being Updating")
self.editor.fNeedToSave = True
#children = self.journalTree.GetChildren(rootItem)
parent = self.journalTree.GetRootItem()
node, cookie = self.journalTree.GetLastChild(parent)
#LEjournalEntries = {}
self.editor.journalMgr.reset()
while node.IsOk():#for i in range(self.journalTree.GetChildrenCount(rootItem)):
name = self.journalTree.GetItemText(node, 0)
tag = self.journalTree.GetItemText(node, 1)
#print "Tag ", tag
#filename = self.journalTree.GetItemText(node, 4)
journalEntry = JournalEntry(tag, name)
#lines = self.journalTree.GetChildren(node)
l, cookie = self.journalTree.GetFirstChild(node)
while l.IsOk():#for j in range(self.journalTree.GetChildrenCount(node)):
text = self.journalTree.GetItemText(l, 0)
endpoint = self.journalTree.GetItemText(l, 2)
entryValue = self.journalTree.GetItemText(l,3)
journalLine = JournalLine(text,entryValue, endpoint)
journalEntry.addJournalLine(journalLine)
l = self.journalTree.GetNextSibling(l)
self.editor.journalMgr.addJournalEntry(journalEntry)
#LEjournalEntries[LEjournalEntry.tag] = LEjournalEntry
node = self.journalTree.GetPrevSibling(node)
示例3: addSuccessor
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def addSuccessor(self, id):
if not id in self.successorIDs:
self.successorIDs.append(id)
Debug.debug(__name__, "added successor (id=" + str(id) + ") to line (id=" + str(self.id) + ")")
return True
else:
return False
示例4: setPlayerChoice
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def setPlayerChoice(self,n):
#[antonjs] temp
Debug.debug(__name__,'setPlayerChoice called')
'''pass the player's choice to ConversationMgr'''
self.world.conversationMgr.playResponse(n)
self.syncedWithConvoMgr = False
示例5: callTrigger
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def callTrigger(self, world, triggerName):
if triggerName in self.scripts:
scriptsData = self.scripts[triggerName]
Debug.debug(__name__,str(scriptsData))
for key in sorted(scriptsData):
tuple = scriptsData[key]
world.scriptMgr.doScript(tuple)
# CONSIDER: use world param to check scene, pass to scriptMgr to queue if scene is different
else:
pass
示例6: manageAggro
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def manageAggro(self, aggressorObj):
namesActivated = []
for potentialEnemyName, aggroRange in self.inactiveEnemies.iteritems():
if findGameObjDistance(aggressorObj, self.world.gameObjects[potentialEnemyName]) <= aggroRange:
self.activeEnemies[potentialEnemyName] = aggroRange
newEnemy = self.world.gameObjects[potentialEnemyName]
Debug.debug(__name__,'newEnemy : '+str(newEnemy)+str(type(newEnemy)))
self.aiWorld.addAiChar(newEnemy.getAICharacterHandle())
newEnemy.getAIBehaviorsHandle().pursue(aggressorObj, 1.0)
# TODO: override other movement that the gameObj may have...paths, idle anim, etc.
namesActivated.append(potentialEnemyName)
for nameActivated in namesActivated:
del self.inactiveEnemies[nameActivated]
示例7: queueAttack
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def queueAttack(self, attackerObj, attackerSpell, targetObj):
if attackerSpell.isCooldownReady():
if self.combatGraph.checkCanAttack(attackerObj, targetObj):
dist = findGameObjDistance(attackerObj, targetObj)
if dist > attackerSpell.getAttackRange():
Debug.debug(__name__,'out of attack range...')
else:
Debug.debug(__name__, 'attack!')
proj = attackerSpell.makeProjectile()
seq = Sequence()
charge = Sequence()
isActor = proj.getOwner().getActorHandle() != None
if isActor:
charge.append(Func(proj.getOwner().getActorHandle().stop))
charge.append(Func(self.world.disableMovement, proj.getOwner()))
if isActor and attackerSpell.properties['chargeSequence']['firstAnimation'] != '':
charge.append(Func(proj.getOwner().getActorHandle().play, attackerSpell.properties['chargeSequence']['firstAnimation']))##
charge.append(Wait(attackerSpell.properties['chargeSequence']['firstAnimationTime']))##
if isActor and attackerSpell.properties['chargeSequence']['secondAnimation'] != '':
charge.append(Func(proj.getOwner().getActorHandle().play, attackerSpell.properties['chargeSequence']['secondAnimation']))##
charge.append(Wait(attackerSpell.properties['chargeSequence']['secondAnimationTime']))##
if isActor and attackerSpell.properties['chargeSequence']['idleAnimation'] != '':
charge.append(Func(proj.getOwner().getActorHandle().loop, attackerSpell.properties['chargeSequence']['idleAnimation']))##
charge.append(Func(self.attemptResumeMovement, proj.getOwner()))
fire = Sequence()
fire.append(Func(proj.setPos, proj.getOwner().getPos(render)))
#fire.append(Func(proj.lookAt, targetObj))
#fire.append(Func(proj.setH, render, 270))
fire.append(Func(proj.setH, render, proj.getOwner().getH(render)))
fire.append(Func(proj.reparentTo, render))
fire.append(Func(self.projectiles.append, (proj, targetObj)))
fire.append(Func(self.aiWorld.addAiChar, proj.getAICharacterHandle()))
fire.append(Func(proj.getAIBehaviorsHandle().pursue, targetObj, 1.0))
fire.append(Wait(attackerSpell.getCooldownTime()))
seq.append(Func(attackerSpell.setCooldownReady, False))
seq.append(charge)
seq.append(fire)
seq.append(Func(attackerSpell.setCooldownReady, True))
seq.append(Func(self.setSequenceFinished, proj.getOwner().getName(), seq))
self.sequences[proj.getOwner().getName()].append(seq)
seq.start()
示例8: renameScene
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def renameScene(self, name, newName):
if(self.getScene(newName)!= None):
raise DuplicateNameError(newName,name, newName)
#print name," ", newName
sceneFile = self.getScene(name)
del self.scenes[name]
self.scenes[newName] = sceneFile
if(self.sceneName == name):
self.sceneName = newName
self.scenesOrder = sorted(self.scenes)
Debug.debug(__name__,str(self.scenes))
Debug.debug(__name__,str(self.scenesOrder))
示例9: __doLineScripts
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def __doLineScripts(self, lineID):
if lineID == LineIDType.END_CONVERSATION:
return
else:
lineScripts = self.conversations[self.curConversationKey].getLine(lineID).getScripts()
for condition, scripts in lineScripts.iteritems():
Debug.debug(__name__,"Condition"+str(condition))
Debug.debug(__name__,str(scripts))
if(condition == "LE-trigger-noCondition"):
for i in sorted(scripts):
self.world.scriptMgr.doScript(scripts[i])
else:
#for other conditions which can be scripts as well.
pass
示例10: playResponse
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def playResponse(self, text_id): # text_id is index from original array sent with getValidResponses
if self.conversationIsOpen:
responseID = self.curValidResponseIDs[text_id]
# Do the scripts for the player's chosen response line
self.__doLineScripts(responseID)
#print "HERRREEEE"
#playerLineScripts = self.conversations[self.curConversationKey].getLine(responseID).getScripts()
#print '==== Player line scripts ~'
#print playerLineScripts
# for condition, scripts in playerLineScripts.iteritems():
# print "Condition", condition
# print scripts
# if(condition == "LE-trigger-noCondition"):
# for i in sorted(scripts):
# self.world.scriptMgr.doScript(scripts[i])
# else:
# #for other conditions which can be scripts as well.
# pass
self.curNPCStatementID = self.__calculateNextNPCStatementID(responseID)
if not self.curNPCStatementID == LineIDType.END_CONVERSATION:
# Do the scripts for the next NPC line
self.__doLineScripts(self.curNPCStatementID)
# npcLineScripts = self.conversations[self.curConversationKey].getLine(self.curNPCStatementID).getScripts()
# print '==== NPC line scripts ~'
# for condition, scripts in playerLineScripts.iteritems():
# print "Condition", condition
# print scripts
# if(condition == "LE-trigger-noCondition"):
# for i in sorted(scripts):
# self.world.scriptMgr.doScript(scripts[i])
# else:
# #for other conditions which can be scripts as well.
# pass
self.curValidResponseIDs = self.__calculateValidResponseIDs(self.curNPCStatementID)
# Yo dude
self.playLineSound(self.curConversationKey,self.curNPCStatementID);
if len(self.curValidResponseIDs) == 0:
Debug.debug(__name__,'(player response list is empty)')
# TODO: close conversation while still showing the last NPC line...involve ConversationUI?
else:
Debug.debug(__name__,'(NPC line is END)')
self.closeConversation()
else:
print 'WARNING: playResponse called when no conversation was open'
示例11: loadConversations
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def loadConversations(sceneFile, libraryFile): # Anton added 2/24
sceneFilename = Filename(sceneFile)
libraryFilename = Filename.fromOsSpecific(os.getcwd()) + '/' + libraryFile
lib = Library(Filename(libraryFilename.getDirname()))
assetIndex = AssetIndex(lib)
conversationAssets = assetIndex.conversations
conversationObjects = {}
for key, filename in conversationAssets.items():
xmlFilename = Filename(filename)
doc = xml.dom.minidom.parse(xmlFilename.toOsSpecific())
Debug.debug(__name__,'loading '+str(xmlFilename.toOsSpecific())+'...')
convo = Conversation.decode(doc)
conversationObjects[key] = convo
return conversationObjects
示例12: runOnePuzzle
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def runOnePuzzle():
for puzzle in PUZZLES:
p = SudokuPuzzle(puzzle.getPuzzle())
Debug.debug(puzzle.getName(),1)
Debug.debugPrintPuzzle(p, 1)
orderingStrategy = GuessOrdering.SimpleGuessOrderingByTuple((4,3,2,5,6,7,8,9))
s = Solver.Solver(p, orderingStrategy)
time_start = time.time()
s.solve()
time_end = time.time()
elapsed_time = time_end - time_start
Profiler.printAll(elapsed_time)
print 'solved puzzle'
print 'name:', puzzle.getName()
p.printPuzzle()
pass
pass
示例13: doScript
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def doScript(self, scriptData):
#temp
Debug.debug(__name__,'==?= regular script data form : '+str(scriptData))
tag = scriptData[0]
if len(scriptData) > 1:
args = scriptData[1]
else:
args = []
if self.hasScript(tag):
if self.getNumScriptArgs(tag) == len(args):
scriptFn = self.tagMap[tag]
scriptFn(self.world, *args) # always pass the world as parameter 0
else:
# CONSIDER: exception class
print 'ERROR: script \'%s\' takes %d args (%d given)' %(tag, self.getNumScriptArgs(tag), len(args))
else:
print 'ERROR: script name \'%s\' not found' %(tag)
示例14: setupCanvas
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
def setupCanvas(self):
self.temp = loader.loadModel("jack")
#self.temp.reparentTo(self.terrain2d)
#self.viewport.camera.lookAt(self.temp)
self.canvas = PNMImage(513,513)
# if(self.terrain.terrain.hasColorMap()==False):
# self.canvas.fill(1,1,1)
# self.canvas.makeRgb()
# print self.canvas.getNumChannels()
# self.terrain.terrain.setColorMap(self.canvas)
# else:
self.canvas = self.terrain.terrain.heightfield()#self.canvas.read(Filename(self.terrain.asset.getFullFilename()))
if(self.canvas.hasAlpha()):
Debug.debug(__name__,"In canvas there is alpha")
self.canvas.addAlpha()
for i in range(0,self.canvas.getReadXSize()):
for j in range(0, self.canvas.getReadYSize()):
self.canvas.setAlpha(i,j,.5)
sizeX = self.canvas.getReadXSize()
sizeY = self.canvas.getReadYSize()
#self.canvas.makeGrayscale()
Debug.debug(__name__, str(sizeX)+" "+str(sizeY))
self.tex = Texture()
self.tex.load(self.canvas)
#self.tex.reparentTo(self.terrain2d)
CM=CardMaker('')
CM.setFrameFullscreenQuad()
self.card=self.terrain2d.attachNewNode(CM.generate())
self.card.setTexture(self.tex)
self.viewport.SetClientSize((sizeX, sizeY))
self.canvasPanel.SetSize(wx.Size(sizeX, sizeY))
self.viewport.Update()
base.le.ui.wxStep()
self.painter = PNMPainter(self.canvas)
brush = PNMBrush.makeSpot((1,1,1,1),5.0,True )
self.painter.setPen(brush)
示例15: debug
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debug [as 别名]
#==============================================================================#
# TESTING =====================================================================#
#==============================================================================#
if __name__ == "__main__":
try:
print "__Arrancamos__"
_file = sys.argv[1]
_file = os.path.join(os.getcwd(), _file)
debug('debugLBLUE', "Working on file: " + _file)
_mdl = Parser.parse(_file)
Debug.debug("debugGREEN", "Checking ...")
Check(_mdl)
Debug.debug("debugGREEN", "it's OK!")
except Error, _e:
debug("debugRED", str(_e))
print "__Terminamos__"
#===============================================================================
# TODO levantar excepcion por falta de instancias si es correcto hacerlo.
# TODO Aclarar que instancia se esta checkeando al levantar una excepcion de
# tipos. Quizas deberia distinguirse entre errores de tipado 'sintactico' y
# aquellos que surgen de un erroneo pasaje de variables de contexto.