Beispiel #1
0
 def __updateRewardCountdown(self, task):
     curTime = self.getCurrentGameTime()
     if self.clockStopTime is not None:
         if self.clockStopTime < curTime:
             self.__killRewardCountdown()
             curTime = self.clockStopTime
     if not hasattr(task, 'curScore'):
         task.curScore = CannonGameGlobals.calcScore(curTime)
     score = CannonGameGlobals.calcScore(curTime)
     self.rewardPanel['text'] = str(score)
     if task.curScore != score:
         if hasattr(self, 'jarIval'):
             self.jarIval.finish()
         s = self.rewardPanel.getScale()
         self.jarIval = Parallel(Sequence(
             self.rewardPanel.scaleInterval(0.15,
                                            s * 3.0 / 4.0,
                                            blendType='easeOut'),
             self.rewardPanel.scaleInterval(0.15, s, blendType='easeIn')),
                                 SoundInterval(self.sndRewardTick),
                                 name='cannonGameRewardJarThrob')
         self.jarIval.start()
     task.curScore = score
     return Task.cont
     return
 def _DistributedCannonGame__updateRewardCountdown(self, task):
     if not hasattr(self, 'rewardPanel'):
         return Task.cont
     
     curTime = self.getCurrentGameTime()
     if self.clockStopTime is not None:
         if self.clockStopTime < curTime:
             self._DistributedCannonGame__killRewardCountdown()
             curTime = self.clockStopTime
         
     
     score = int(self.scoreMult * CannonGameGlobals.calcScore(curTime) + 0.5)
     if not hasattr(task, 'curScore'):
         task.curScore = score
     
     self.rewardPanel['text'] = str(score)
     if task.curScore != score:
         if hasattr(self, 'jarIval'):
             self.jarIval.finish()
         
         s = self.rewardPanel.getScale()
         self.jarIval = Parallel(Sequence(self.rewardPanel.scaleInterval(0.14999999999999999, s * 3.0 / 4.0, blendType = 'easeOut'), self.rewardPanel.scaleInterval(0.14999999999999999, s, blendType = 'easeIn')), SoundInterval(self.sndRewardTick), name = 'cannonGameRewardJarThrob')
         self.jarIval.start()
     
     task.curScore = score
     return Task.cont
 def __updateRewardCountdown(self, task):
     if not hasattr(self, "rewardPanel"):
         return Task.cont
     curTime = self.getCurrentGameTime()
     if self.clockStopTime is not None:
         if self.clockStopTime < curTime:
             self.__killRewardCountdown()
             curTime = self.clockStopTime
     score = int(self.scoreMult * CannonGameGlobals.calcScore(curTime) + 0.5)
     if not hasattr(task, "curScore"):
         task.curScore = score
     self.rewardPanel["text"] = str(score)
     if task.curScore != score:
         if hasattr(self, "jarIval"):
             self.jarIval.finish()
         s = self.rewardPanel.getScale()
         self.jarIval = Parallel(
             Sequence(
                 self.rewardPanel.scaleInterval(0.15, s * 3.0 / 4.0, blendType="easeOut"),
                 self.rewardPanel.scaleInterval(0.15, s, blendType="easeIn"),
             ),
             SoundInterval(self.sndRewardTick),
             name="cannonGameRewardJarThrob",
         )
         self.jarIval.start()
     task.curScore = score
     return Task.cont
    def setToonWillLandInWater(self, landTime):
        if not self.__playing():
            self.notify.debug('ignoring setToonWillLandInWater message')
            return
        senderAvId = self.air.getAvatarIdFromSender()
        score = CannonGameGlobals.calcScore(landTime)
        for avId in self.avIdList:
            self.scoreDict[avId] = score

        self.notify.debug('setToonWillLandInWater: time=%s, score=%s' % (landTime, score))
        taskMgr.remove(self.taskName('gameTimer'))
        delay = max(0, landTime - self.getCurrentGameTime())
        taskMgr.doMethodLater(delay, self.toonLandedInWater, self.taskName('game-over'))
        self.sendUpdate('announceToonWillLandInWater', [senderAvId, landTime])
Beispiel #5
0
    def setToonWillLandInWater(self, landTime):
        if not self.__playing():
            self.notify.debug('ignoring setToonWillLandInWater message')
            return
        senderAvId = self.air.getAvatarIdFromSender()
        score = CannonGameGlobals.calcScore(landTime)
        for avId in self.avIdList:
            self.scoreDict[avId] = score

        self.notify.debug('setToonWillLandInWater: time=%s, score=%s' %
                          (landTime, score))
        taskMgr.remove(self.taskName('gameTimer'))
        delay = max(0, landTime - self.getCurrentGameTime())
        taskMgr.doMethodLater(delay, self.toonLandedInWater,
                              self.taskName('game-over'))
        self.sendUpdate('announceToonWillLandInWater', [senderAvId, landTime])
Beispiel #6
0
    def setToonWillLandInWater(self, landTime):
        """ landTime is game-relative """
        if not self.__playing():
            self.notify.debug('ignoring setToonWillLandInWater message')
            return
        senderAvId = self.air.getAvatarIdFromSender()
        # a toon will land in the water at some point in the future
        # calculate the score
        score = CannonGameGlobals.calcScore(landTime)
        # give everyone that many jbeans
        for avId in self.avIdList:
            self.scoreDict[avId] = score
        self.notify.debug("setToonWillLandInWater: time=%s, score=%s" % \
                          (landTime, score))

        taskMgr.remove(self.taskName("gameTimer"))
        delay = max(0, landTime - self.getCurrentGameTime())
        #self.notify.debug("setToonWillLandInWater: delay=%s" % delay)
        taskMgr.doMethodLater(delay, self.toonLandedInWater,
                              self.taskName("game-over"))

        self.sendUpdate("announceToonWillLandInWater", [senderAvId, landTime])