本文整理汇总了Python中fofix.game.Dialogs.chooseAvatar方法的典型用法代码示例。如果您正苦于以下问题:Python Dialogs.chooseAvatar方法的具体用法?Python Dialogs.chooseAvatar怎么用?Python Dialogs.chooseAvatar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fofix.game.Dialogs
的用法示例。
在下文中一共展示了Dialogs.chooseAvatar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyPressed
# 需要导入模块: from fofix.game import Dialogs [as 别名]
# 或者: from fofix.game.Dialogs import chooseAvatar [as 别名]
def keyPressed(self, key, unicode):
c = self.engine.input.controls.getMapping(key)
if key == pygame.K_BACKSPACE and self.active:
self.choices[self.selected] = self.choices[self.selected][:-1]
elif unicode and ord(unicode) > 31 and self.active:
if self.selected in (0, 7):
if self.selected == 0 and (ord(unicode) in (34, 42, 47, 58, 60, 62, 63, 92, 124) or ord(unicode) > 126): #ascii only
self.engine.data.cancelSound.play()
return True
if len(self.choices[self.selected]) > 24:
self.choices[self.selected] = self.choices[self.selected][:-1]
self.choices[self.selected] += unicode
return
if c and not (c in Player.playerkeys[self.playerNum]):
if key not in [pygame.K_RETURN, pygame.K_ESCAPE, pygame.K_DOWN, pygame.K_UP, pygame.K_LEFT, pygame.K_RIGHT]:
return
if c in Player.key1s or key == pygame.K_RETURN:
self.scrolling = 0
self.engine.data.acceptSound.play()
if self.selected in (0, 7):
if self.active:
self.active = False
else:
self.blink = 0
self.active = True
self.oldValue = self.choices[self.selected]
elif self.selected == 6:
if self.choices[6] == 2:
self.engine.view.pushLayer(Dialogs.NeckChooser(self.engine, player = self.player, owner = self))
self.keyActive = False
elif self.selected == 8:
self.avatar = Dialogs.chooseAvatar(self.engine)
elif self.selected == 9:
self.deleteCharacter()
elif self.selected == 10:
self.saveCharacter()
elif c in Player.key2s + Player.cancels or key == pygame.K_ESCAPE:
self.engine.data.cancelSound.play()
if not self.active:
if self.player:
self.updatedName = self.oldName
self.engine.view.popLayer(self)
self.engine.input.removeKeyListener(self)
else:
self.choices[self.selected] = self.oldValue
self.active = False
elif c in Player.action1s + Player.ups or key == pygame.K_UP:
self.scrolling = 1
self.delay = self.scrollDelay
self.scrollUp()
elif c in Player.action2s + Player.downs or key == pygame.K_DOWN:
self.scrolling = 2
self.delay = self.scrollDelay
self.scrollDown()
elif (c in Player.key3s + Player.rights or key == pygame.K_RIGHT) and self.active:
if len(self.choices[self.selected]) > 0:
self.choices[self.selected] += self.choices[self.selected][len(self.choices[self.selected]) - 1]
if c in Player.key3s:
self.engine.data.acceptSound.play()
elif (c in Player.key4s + Player.lefts or key == pygame.K_LEFT) and self.active:
self.choices[self.selected] = self.choices[self.selected][:-1]
if c in Player.key4s:
self.engine.data.cancelSound.play()
elif c in Player.rights or key == pygame.K_RIGHT:
if self.selected in (0, 7, 8, 9, 10):
pass
elif self.selected in [4, 6]:
self.choices[self.selected]+=1
if self.choices[self.selected] > 2:
self.choices[self.selected] = 0
else:
self.choices[self.selected] = 1 and (self.choices[self.selected] == 0) or 0
elif c in Player.lefts or key == pygame.K_LEFT:
if self.selected in (0, 7, 8, 9, 10):
pass
elif self.selected in [4, 6]:
self.choices[self.selected]-=1
if self.choices[self.selected] < 0:
self.choices[self.selected] = 2
else:
self.choices[self.selected] = 1 and (self.choices[self.selected] == 0) or 0