本文整理汇总了Python中direct.interval.IntervalGlobal.SoundInterval.start方法的典型用法代码示例。如果您正苦于以下问题:Python SoundInterval.start方法的具体用法?Python SoundInterval.start怎么用?Python SoundInterval.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.interval.IntervalGlobal.SoundInterval
的用法示例。
在下文中一共展示了SoundInterval.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setMovie
# 需要导入模块: from direct.interval.IntervalGlobal import SoundInterval [as 别名]
# 或者: from direct.interval.IntervalGlobal.SoundInterval import start [as 别名]
def setMovie(self, mode, avId):
isLocalToon = avId == base.localAvatar.doId
if isLocalToon:
DistributedMailbox.notify.debug('setMovie( mode=%d, avId=%d ) called on a local toon' % (mode, avId))
else:
DistributedMailbox.notify.debug('setMovie( mode=%d, avId=%d ) called on a non-local toon' % (mode, avId))
if mode == MailboxGlobals.MAILBOX_MOVIE_CLEAR:
DistributedMailbox.notify.debug('setMovie: clear')
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_EXIT:
if random.random() < 0.5:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_close_1.ogg')
else:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_close_2.ogg')
sfxTrack = SoundInterval(sfx, node=self.model)
sfxTrack.start()
DistributedMailbox.notify.debug('setMovie: exit')
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_EMPTY:
DistributedMailbox.notify.debug('setMovie: empty')
if isLocalToon:
self.mailboxDialog = TTDialog.TTDialog(dialogName='MailboxEmpty', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedMailboxEmpty, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_WAITING:
DistributedMailbox.notify.debug('setMovie: waiting')
if isLocalToon:
self.mailboxDialog = TTDialog.TTDialog(dialogName='MailboxWaiting', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedMailboxWaiting, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_READY:
DistributedMailbox.notify.debug('setMovie: ready')
if random.random() < 0.5:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_open_1.ogg')
else:
sfx = base.loadSfx('phase_5.5/audio/sfx/mailbox_open_2.ogg')
sfxTrack = SoundInterval(sfx, node=self.model)
sfxTrack.start()
if isLocalToon:
self.mailboxGui = MailboxScreen.MailboxScreen(self, base.localAvatar, self.mailboxGuiDoneEvent)
self.mailboxGui.show()
self.accept(self.mailboxGuiDoneEvent, self.__handleMailboxDone)
return
elif mode == MailboxGlobals.MAILBOX_MOVIE_NOT_OWNER:
DistributedMailbox.notify.debug('setMovie: not owner')
if isLocalToon:
self.mailboxDialog = TTDialog.TTDialog(dialogName='MailboxNotOwner', style=TTDialog.Acknowledge, text=TTLocalizer.DistributedMailboxNotOwner, text_wordwrap=15, fadeScreen=1, command=self.__clearDialog)
return
else:
DistributedMailbox.notify.warning('unknown mode in setMovie: %s' % mode)
示例2: DistributedBanquetTable
# 需要导入模块: from direct.interval.IntervalGlobal import SoundInterval [as 别名]
# 或者: from direct.interval.IntervalGlobal.SoundInterval import start [as 别名]
#.........这里部分代码省略.........
def setupChairCols(self):
for i in xrange(self.numDiners):
chairCol = self.tableGroup.find("**/collision_chair_%d" % (i + 1))
colName = "ChairCol-%d-%d" % (self.index, i)
chairCol.setTag("chairIndex", str(i))
chairCol.setName(colName)
chairCol.setCollideMask(ToontownGlobals.WallBitmask)
self.accept("enter" + colName, self.touchedChair)
def touchedChair(self, colEntry):
chairIndex = int(colEntry.getIntoNodePath().getTag("chairIndex"))
if chairIndex in self.dinerStatus:
status = self.dinerStatus[chairIndex]
if status in (self.HUNGRY, self.ANGRY):
self.boss.localToonTouchedChair(self.index, chairIndex)
def serveFood(self, food, chairIndex):
self.removeFoodModel(chairIndex)
serviceLoc = self.serviceLocs.get(chairIndex)
if not food or food.isEmpty():
foodModel = loader.loadModel("phase_12/models/bossbotHQ/canoffood")
foodModel.setScale(ToontownGlobals.BossbotFoodModelScale)
foodModel.reparentTo(serviceLoc)
else:
food.wrtReparentTo(serviceLoc)
tray = food.find("**/tray")
if not tray.isEmpty():
tray.hide()
ivalDuration = 1.5
foodMoveIval = Parallel(
SoundInterval(self.serveFoodSfx, node=food),
ProjectileInterval(
food, duration=ivalDuration, startPos=food.getPos(serviceLoc), endPos=serviceLoc.getPos(serviceLoc)
),
LerpHprInterval(food, ivalDuration, Point3(0, -360, 0)),
)
intervalName = "serveFood-%d-%d" % (self.index, chairIndex)
foodMoveIval.start()
self.activeIntervals[intervalName] = foodMoveIval
def setDinerStatus(self, chairIndex, status):
if chairIndex in self.dinerStatus:
oldStatus = self.dinerStatus[chairIndex]
self.dinerStatus[chairIndex] = status
if oldStatus != status:
if status == self.EATING:
self.changeDinerToEating(chairIndex)
elif status == self.HUNGRY:
self.changeDinerToHungry(chairIndex)
elif status == self.ANGRY:
self.changeDinerToAngry(chairIndex)
elif status == self.DEAD:
self.changeDinerToDead(chairIndex)
elif status == self.HIDDEN:
self.changeDinerToHidden(chairIndex)
def removeFoodModel(self, chairIndex):
serviceLoc = self.serviceLocs.get(chairIndex)
if serviceLoc:
for i in xrange(serviceLoc.getNumChildren()):
serviceLoc.getChild(0).removeNode()
def changeDinerToEating(self, chairIndex):
indicator = self.dinerStatusIndicators.get(chairIndex)
eatingDuration = self.dinerInfo[chairIndex][1]