本文整理匯總了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]