示例#1
0
    def getFireworkShowIval(self, eventId, index, songId, startT):
        show = FireworkShows.getShow(eventId, index)
        if show is None:
            FireworkShowMixin.notify.warning('could not find firework show: index: %s' % index)
            return
        preShow = self.preShow(eventId, songId, startT)
        mainShow = Sequence()
        currentT = skyTransitionDuration + preShowPauseDuration
        for effect in show:
            waitTime, style, colorIndex1, colorIndex2, amp, x, y, z = effect
            if waitTime > 0:
                currentT += waitTime
                mainShow.append(Wait(waitTime))
            if currentT >= startT:
                mainShow.append(Func(Fireworks.shootFirework, style, x, y, z, colorIndex1, colorIndex2, amp))

        postShow = self.postShow(eventId)
        return Sequence(preShow, mainShow, postShow)
示例#2
0
 def getFireworkShowIval(self, eventId, index, startT):
     show = FireworkShows.getShow(eventId, index)
     if show is None:
         FireworkShowMixin.notify.warning('could not find firework show: index: %s' % index)
         return None
     
     preShow = self.preShow(eventId, startT)
     mainShow = Sequence()
     currentT = skyTransitionDuration + preShowPauseDuration
     for effect in show:
         (waitTime, style, colorIndex1, colorIndex2, amp, x, y, z) = effect
         if waitTime > 0:
             currentT += waitTime
             mainShow.append(Wait(waitTime))
         
         if currentT >= startT:
             mainShow.append(Func(Fireworks.shootFirework, style, x, y, z, colorIndex1, colorIndex2, amp))
             continue
     
     postShow = self.postShow(eventId)
     return Sequence(preShow, mainShow, postShow)
示例#3
0
    def getFireworkShow(self, index, t):
        show = FireworkShows.getShow(index)
        if show is None:
            self.notify.warning('could not find firework show: index' % index)
            return None
        iList = []
        dark = 0.5
        skyDark = 0.0
        currentT = 0.0

        def checkDDFog():
            if isinstance(toonbase.tcr.playGame.hood, DDHood.DDHood):
                toonbase.tcr.playGame.hood.whiteFogColor = Vec4(0.2, 0.2, 0.2, 1)
                if not toonbase.tcr.playGame.getPlace().cameraSubmerged:
                    toonbase.tcr.playGame.hood.setWhiteFog()

        def restoreDDFog():
            if isinstance(toonbase.tcr.playGame.hood, DDHood.DDHood):
                toonbase.tcr.playGame.hood.whiteFogColor = Vec4(0.8, 0.8, 0.8, 1)
                if not toonbase.tcr.playGame.getPlace().cameraSubmerged:
                    toonbase.tcr.playGame.hood.setWhiteFog()

        showMusic = loader.loadMusic('phase_4/audio/bgm/firework_music.mid')
        showMusic.setVolume(1)
        iList.extend((Func(toonbase.localToon.setSystemMessage, 0, Localizer.FireworksBeginning), Func(checkDDFog),
         Parallel(LerpColorScaleInterval(toonbase.tcr.playGame.hood.loader.geom, 2, Vec4(dark, dark, dark, 1)), LerpColorScaleInterval(toonbase.tcr.playGame.hood.sky, 2, Vec4(skyDark, skyDark, skyDark, 1))), Func(toonbase.localToon.setSystemMessage, 0, Localizer.FireworksInstructions), Wait(2), Func(toonbase.tcr.playGame.hood.loader.music.stop), Func(base.playMusic, showMusic, 0, 1, 0.8, t), Wait(1)))
        currentT = 7.0
        for effect in show:
            waitTime, style, colorIndex1, colorIndex2, amp, x, y, z = effect
            if waitTime > 0:
                currentT += waitTime
                iList.append(Wait(waitTime))
            if currentT >= t:
                iList.append(Func(Fireworks.shootFirework, style, x, y, z, colorIndex1, colorIndex2, amp))

        iList.extend((Wait(4), Func(restoreDDFog),
         Parallel(LerpColorScaleInterval(toonbase.tcr.playGame.hood.loader.geom, 2, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(toonbase.tcr.playGame.hood.sky, 2, Vec4(1, 1, 1, 1))), Func(toonbase.tcr.playGame.hood.loader.geom.clearColorScale), Func(toonbase.tcr.playGame.hood.sky.clearColorScale), Func(showMusic.stop), Func(toonbase.localToon.setSystemMessage, 0, Localizer.FireworksEnding), Wait(0.5), Func(base.playMusic, toonbase.tcr.playGame.hood.loader.music, 1, 1, 0.8)))
        return Track(iList)
        return
 def startShow(self, eventId, style, timeStamp):
     taskMgr.doMethodLater(FireworkShows.getShowDuration(eventId, style), self.requestDelete, 'delete%i' % self.doId, [])
示例#5
0
    def getFireworkShowIval(self, eventId, index, startT):
        show = FireworkShows.getShow(eventId, index)
        if show is None:
            FireworkShowMixin.notify.warning(
                "could not find firework show: index: %s" % (index))
            return None

        # dark = 0.5
        # skyDark = 1
        # Show is beginning, turn off the lights
        # Stop the playground music
        # Start our music
        # preShow = Sequence(
        # Func(base.localAvatar.setSystemMessage, 0, startMessage),
        # Func(self.__checkDDFog),
        # Parallel(
        # LerpColorScaleInterval(
        # self.getGeom(),
        # skyTransitionDuration,
        # Vec4(dark, dark, dark, 1)
        # Vec4(0.33, 0.33, 0.52, 1)
        # ),
        # LerpColorScaleInterval(
        # self.getSky(),
        # skyTransitionDuration,
        # Vec4(skyDark,skyDark,skyDark,1)
        # Vec4(0.1, 0.1, 0.25, 1)
        # ),
        # ),
        # Func(base.localAvatar.setSystemMessage, 0, instructionMessage),
        # Wait(preShowPauseDuration),
        # Func(self.getLoader().music.stop),
        # Start music at right place when elapsed time is > 4 seconds
        # Func(base.playMusic, showMusic, 0, 1, 0.8, max(0, startT-(skyTransitionDuration + preShowPauseDuration))),
        # )

        preShow = self.preShow(eventId, startT)

        # Main show
        mainShow = Sequence()
        currentT = skyTransitionDuration + preShowPauseDuration
        for effect in show:
            waitTime, style, colorIndex1, colorIndex2, amp, x, y, z = effect
            if waitTime > 0:
                currentT += waitTime
                mainShow.append(Wait(waitTime))
            # Do not add the firework Ival if our start time is greater than
            # the current time since the Func Interval can not be skipped over
            # and all the skipped over fireworks will otherwise fire at once
            if currentT >= startT:
                mainShow.append(
                    Func(Fireworks.shootFirework, style, x, y, z, colorIndex1,
                         colorIndex2, amp))

        # Show is over, turn on the lights
        # postShow = Sequence(
        # Wait(postShowPauseDuration),
        # Func(self.__restoreDDFog),
        # Parallel(
        # LerpColorScaleInterval(
        # self.getGeom(),
        # skyTransitionDuration, Vec4(1, 1, 1, 1)
        # ),
        # LerpColorScaleInterval(
        # self.getSky(),
        # skyTransitionDuration, Vec4(1, 1, 1, 1)
        # ),
        # ),
        # Func(self.clearMyColorScales),
        # Func(showMusic.stop),
        # Func(base.localAvatar.setSystemMessage, 0, endMessage),
        # )
        # if self.restorePlaygroundMusic:
        # Start the playground music up again
        # postShow.append( Wait(preNormalMusicPauseDuration) )
        # postShow.append( Func(base.playMusic, self.getLoader().music, 1, 1, 0.8) )

        postShow = self.postShow(eventId)
        return Sequence(preShow, mainShow, postShow)
示例#6
0
 def startShow(self, eventId, style, timeStamp):
     taskMgr.doMethodLater(FireworkShows.getShowDuration(eventId, style),
                           self.requestDelete, 'delete%i' % self.doId, [])