当前位置: 首页>>代码示例>>Python>>正文


Python gui.DirectLabel类代码示例

本文整理汇总了Python中direct.gui.DirectLabel的典型用法代码示例。如果您正苦于以下问题:Python DirectLabel类的具体用法?Python DirectLabel怎么用?Python DirectLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DirectLabel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _createIface

 def _createIface(self):
     textFg = PiratesGuiGlobals.TextFG1
     if self.world != None:
         scoreText = self.world.getScoreText(self.scoreValue)
     else:
         scoreText = ''
     self.descText = DirectLabel(parent = self, relief = None, text = scoreText, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = textFg, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.040000000000000001, 0, 0.014999999999999999))
     if self.itemColorScale:
         self.colorLabel(self.itemColorScale)
     
     if self.blink:
         textPos = self.descText['text_pos']
         textPosX = textPos[0]
         textPosY = textPos[1]
         self.scaleSeq = Parallel(Sequence(LerpFunctionInterval(self.descText.setScale, duration = 0.20000000000000001, toData = 1.05, fromData = 1.0, blendType = 'easeInOut'), LerpFunctionInterval(self.descText.setScale, duration = 0.69999999999999996, toData = 1.0, fromData = 1.05, blendType = 'easeInOut')), Sequence(Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, PiratesGuiGlobals.TextFG1), Func(self.moveLabel, (textPosX, textPosY))))
         self.scaleSeq.start()
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:16,代码来源:MiniScoreItemGui.py

示例2: update

    def update(self, time):
        placeSorter = []
        placeCount = 0
        for key in self.racerDict.keys():
            racer = self.racerDict[key]
            curvetime = racer.curvetime
            face = racer.face
            mapspot = racer.mapspot
            maxlaphit = racer.maxlaphit
            if not racer.finished and racer.enabled:
                placeSorter.append((curvetime, key))
            if racer.finished or racer.enabled:
                placeCount += 1
            pt = Vec3(0, 0, 0)
            mapT = (curvetime % 1 + self.race.startT / self.race.curve.getMaxT()) % 1 * self.race.curve.getMaxT()
            self.race.curve.getPoint(mapT, pt)
            self.race.curve.getPoint(mapT % self.race.curve.getMaxT(), pt)
            lapT = clampScalar(curvetime / self.race.lapCount, 0.0, 1.0)
            faceX = self.faceStartPos[0] * (1 - lapT) + self.faceEndPos[0] * lapT
            racer.update(faceX=faceX, mapspotPt=pt)
            t = time - self.race.baseTime - self.raceTimeDelta
            if key == localAvatar.doId:
                if self.race.laps > maxlaphit:
                    racer.update(maxlaphit=self.race.laps)
                    self.maxLapHit = racer.maxlaphit
                    if self.maxLapHit < self.race.lapCount:
                        for y in self.timeLabels[self.maxLapHit - 1]:
                            y.configure(text_font=ToontownGlobals.getSignFont())

                        for y in self.timeLabels[self.maxLapHit]:
                            y.show()

                        for y in self.timeLabels[self.maxLapHit]:
                            y.configure(text_font=ToontownGlobals.getSignFont())

                        self.raceTimeDelta = globalClock.getFrameTime() - self.race.baseTime
                        lapNotice = DirectLabel()
                        lapNotice.setScale(0.1)
                        if self.maxLapHit == self.race.lapCount - 1:
                            lapNotice['text'] = TTLocalizer.KartRace_FinalLapText
                        else:
                            lapNotice['text'] = TTLocalizer.KartRace_LapText % str(self.maxLapHit + 1)
                        taskMgr.doMethodLater(2, lapNotice.remove, 'removeIt', extraArgs=[])
                self.lapLabel['text'] = str(clampScalar(self.maxLapHit + 1, 1, self.race.lapCount)) + '/' + str(self.race.lapCount)

        suffix = {1: TTLocalizer.KartRace_FirstSuffix,
         2: TTLocalizer.KartRace_SecondSuffix,
         3: TTLocalizer.KartRace_ThirdSuffix,
         4: TTLocalizer.KartRace_FourthSuffix}
        placeSorter.sort()
        for x, p in zip(placeSorter, xrange(len(placeSorter), 0, -1)):
            self.racerDict[x[1]].update(place=p + placeCount - len(placeSorter))

        localRacer = self.racerDict[localAvatar.doId]
        nearDiff, farDiff = RaceGlobals.TrackDict[self.race.trackId][8]
        if not localRacer.finished and self.faceEndPos[0] - localRacer.face.getX() < nearDiff:
            for racerId in self.racerDict.keys():
                racer = self.racerDict[racerId]
                if not racer.enabled or racerId == localAvatar.doId or racer.face.getX() >= self.faceEndPos[0]:
                    continue
                if self.faceEndPos[0] - racer.face.getX() < farDiff:
                    self.photoFinish = True

        if self.photoFinish:
            self.photoFinishLabel.show()
            self.placeLabelNum['text'] = ''
            self.placeLabelStr['text'] = ''
        else:
            self.photoFinishLabel.hide()
            self.placeLabelNum['text'] = str(self.racerDict[localAvatar.doId].place)
            self.placeLabelStr['text'] = suffix[self.racerDict[localAvatar.doId].place]
        minutes = int(t / 60)
        t -= minutes * 60
        seconds = int(t)
        padding = (seconds < 10 and ['0'] or [''])[0]
        t -= seconds
        fraction = str(t)[2:4]
        fraction = fraction + '0' * (2 - len(fraction))
        if self.timerEnabled and self.maxLapHit < self.race.lapCount:
            self.timeLabels[self.maxLapHit][0]['text'] = "%d'" % minutes
            self.timeLabels[self.maxLapHit][1]['text'] = "%s%d''" % (padding, seconds)
            self.timeLabels[self.maxLapHit][2]['text'] = '%s' % fraction
        if self.race.wrongWay and not self.wrongWaySeq.isPlaying():
            self.wrongWaySeq.loop()
        elif not self.race.wrongWay and self.wrongWaySeq.isPlaying():
            self.wrongWaySeq.finish()
开发者ID:Kawaiikat14,项目名称:Toontown-2-Revised,代码行数:86,代码来源:RaceGUI.py

示例3: __init__


#.........这里部分代码省略.........
        self.directObjList.append(self.closeButton)
        self.raceTimeDelta = 0
        self.raceModeReady = False
        self.resultModeReady = False
        self.gagCycleSound = base.loadSfx('phase_3.5/audio/sfx/tick_counter.ogg')
        if hasattr(self.gagCycleSound, 'setPlayRate'):
            self.gagCycleSound.setPlayRate(0.2)
        self.gagCycleSound.setLoop(1)
        self.gagAcquireSound = base.loadSfx('phase_6/audio/sfx/SZ_MM_gliss.ogg')
        self.disable()
        return

    def initRaceMode(self):
        self.mapScene = base.a2dTopRight.attachNewNode('MapScene')
        self.mapScene.setPos(-0.2, 0, -0.2)
        self.mapScene.setScale(0.25, 0.001, 0.25)
        maxT = self.race.curve.getMaxT()
        pt = Vec3(0, 0, 0)
        ls = LineSegs('MapLines')
        ls.setColor(1, 1, 1, 1)
        ls.setThickness(2)
        for x in xrange(101):
            self.race.curve.getPoint(x / 100.0 * maxT, pt)
            if x == 0:
                ls.moveTo(pt[0], pt[1], pt[2])
            else:
                ls.drawTo(pt[0], pt[1], pt[2])

        self.mapLines = self.mapScene.attachNewNode(ls.create())
        self.mapLines.setScale(0.00025 * RaceGlobals.TrackDict[self.race.trackId][6])
        self.mapLines.setP(90)
        self.faceStartPos = Vec3(-0.8, 0, 0.93)
        self.faceEndPos = Vec3(0.8, 0, 0.93)
        self.placeLabelNum = DirectLabel(relief=None, pos=TTLocalizer.RGUIplaceLabelNumPos, text='1', text_scale=0.35, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.placeLabelNum.reparentTo(base.a2dBottomLeft)
        self.directObjList.append(self.placeLabelNum)
        self.placeLabelStr = DirectLabel(relief=None, pos=TTLocalizer.RGUIplaceLabelStrPos, text=TTLocalizer.KartRace_FirstSuffix, text_scale=0.1, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.placeLabelStr.reparentTo(base.a2dBottomLeft)
        self.directObjList.append(self.placeLabelStr)
        self.lapLabel = DirectLabel(relief=None, pos=(-0.22, 0, -0.5), text='1/' + str(self.race.lapCount), text_scale=0.1, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.lapLabel.reparentTo(base.a2dTopRight)
        self.directObjList.append(self.lapLabel)
        self.photoFinishLabel = DirectLabel(relief=None, pos=(0, 0, -0.1), text=TTLocalizer.KartRace_PhotoFinish, text_scale=TTLocalizer.RGUIphotoFinish, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.photoFinishLabel.hide()
        self.directObjList.append(self.photoFinishLabel)
        self.wrongWayLabel = DirectLabel(relief=None, pos=(-0.22, 0, -0.2), text=TTLocalizer.KartRace_WrongWay, text_scale=0.1, text_fg=(0.95, 0, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.wrongWayLabel.reparentTo(base.a2dTopRight)
        self.directObjList.append(self.wrongWayLabel)
        self.wrongWayLabel.setColorScale(Vec4(1, 1, 1, 0))
        self.wrongWaySeq = Sequence(self.wrongWayLabel.colorScaleInterval(0.25, colorScale=Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0)), self.wrongWayLabel.colorScaleInterval(0.25, colorScale=Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1)))
        interpolateFacePos = lambda x: self.faceStartPos * (1.0 - x) + self.faceEndPos * x
        self.timeLabels = []
        for x in xrange(self.race.lapCount):
            minLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] - 0.06, 0, 0.84), text="0'", text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
            minLabel.reparentTo(self.raceModeRoot)
            self.directObjList.append(minLabel)
            secLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] + 0.06, 0, 0.84), text="00''", text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
            secLabel.reparentTo(self.raceModeRoot)
            self.directObjList.append(secLabel)
            fractionLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] + 0.14, 0, 0.84), text='00', text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
            fractionLabel.reparentTo(self.raceModeRoot)
            self.directObjList.append(fractionLabel)
            self.timeLabels.append((minLabel, secLabel, fractionLabel))

        self.cardMaker.reset()
        self.cardMaker.setName('GagIndicator')
开发者ID:Kawaiikat14,项目名称:Toontown-2-Revised,代码行数:67,代码来源:RaceGUI.py

示例4: initRaceMode

    def initRaceMode(self):
        self.mapScene = base.a2dTopRight.attachNewNode('MapScene')
        self.mapScene.setPos(-0.2, 0, -0.2)
        self.mapScene.setScale(0.25, 0.001, 0.25)
        maxT = self.race.curve.getMaxT()
        pt = Vec3(0, 0, 0)
        ls = LineSegs('MapLines')
        ls.setColor(1, 1, 1, 1)
        ls.setThickness(2)
        for x in xrange(101):
            self.race.curve.getPoint(x / 100.0 * maxT, pt)
            if x == 0:
                ls.moveTo(pt[0], pt[1], pt[2])
            else:
                ls.drawTo(pt[0], pt[1], pt[2])

        self.mapLines = self.mapScene.attachNewNode(ls.create())
        self.mapLines.setScale(0.00025 * RaceGlobals.TrackDict[self.race.trackId][6])
        self.mapLines.setP(90)
        self.faceStartPos = Vec3(-0.8, 0, 0.93)
        self.faceEndPos = Vec3(0.8, 0, 0.93)
        self.placeLabelNum = DirectLabel(relief=None, pos=TTLocalizer.RGUIplaceLabelNumPos, text='1', text_scale=0.35, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.placeLabelNum.reparentTo(base.a2dBottomLeft)
        self.directObjList.append(self.placeLabelNum)
        self.placeLabelStr = DirectLabel(relief=None, pos=TTLocalizer.RGUIplaceLabelStrPos, text=TTLocalizer.KartRace_FirstSuffix, text_scale=0.1, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.placeLabelStr.reparentTo(base.a2dBottomLeft)
        self.directObjList.append(self.placeLabelStr)
        self.lapLabel = DirectLabel(relief=None, pos=(-0.22, 0, -0.5), text='1/' + str(self.race.lapCount), text_scale=0.1, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.lapLabel.reparentTo(base.a2dTopRight)
        self.directObjList.append(self.lapLabel)
        self.photoFinishLabel = DirectLabel(relief=None, pos=(0, 0, -0.1), text=TTLocalizer.KartRace_PhotoFinish, text_scale=TTLocalizer.RGUIphotoFinish, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.photoFinishLabel.hide()
        self.directObjList.append(self.photoFinishLabel)
        self.wrongWayLabel = DirectLabel(relief=None, pos=(-0.22, 0, -0.2), text=TTLocalizer.KartRace_WrongWay, text_scale=0.1, text_fg=(0.95, 0, 0, 1), text_font=ToontownGlobals.getSignFont())
        self.wrongWayLabel.reparentTo(base.a2dTopRight)
        self.directObjList.append(self.wrongWayLabel)
        self.wrongWayLabel.setColorScale(Vec4(1, 1, 1, 0))
        self.wrongWaySeq = Sequence(self.wrongWayLabel.colorScaleInterval(0.25, colorScale=Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0)), self.wrongWayLabel.colorScaleInterval(0.25, colorScale=Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1)))
        interpolateFacePos = lambda x: self.faceStartPos * (1.0 - x) + self.faceEndPos * x
        self.timeLabels = []
        for x in xrange(self.race.lapCount):
            minLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] - 0.06, 0, 0.84), text="0'", text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
            minLabel.reparentTo(self.raceModeRoot)
            self.directObjList.append(minLabel)
            secLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] + 0.06, 0, 0.84), text="00''", text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
            secLabel.reparentTo(self.raceModeRoot)
            self.directObjList.append(secLabel)
            fractionLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] + 0.14, 0, 0.84), text='00', text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
            fractionLabel.reparentTo(self.raceModeRoot)
            self.directObjList.append(fractionLabel)
            self.timeLabels.append((minLabel, secLabel, fractionLabel))

        self.cardMaker.reset()
        self.cardMaker.setName('GagIndicator')
        self.cardMaker.setFrame(-0.5, 0.5, -0.5, 0.5)
        self.cardMaker.setColor(1, 1, 1, 1)
        self.gagPanel = DirectFrame(parent=base.a2dBottomLeft, relief=None, image=loader.loadModel('phase_6/models/karting/gag_panel'), image_scale=0.25, pos=(0.2, 0, 0.55))
        self.directObjList.append(self.gagPanel)
        self.gag = self.gagPanel.attachNewNode('gag')
        self.gag.setScale(0.2)
        for gag in self.gagTextures:
            gag.reparentTo(self.gag)
            gag.hide()

        self.cardMaker.reset()
        self.cardMaker.setName('RaceProgressLine')
        self.cardMaker.setFrame(-0.5, 0.5, -0.5, 0.5)
        line = self.raceModeRoot.attachNewNode(self.cardMaker.generate())
        line.setScale(self.faceEndPos[0] - self.faceStartPos[0], 1, 0.01)
        line.setPos(0, 0, self.faceStartPos[2])
        self.cardMaker.setName('RaceProgressLineHash')
        for n in xrange(self.race.lapCount + 1):
            hash = self.raceModeRoot.attachNewNode(self.cardMaker.generate())
            hash.setScale(line.getScale()[2], 1, line.getScale()[2] * 5)
            t = float(n) / self.race.lapCount
            hash.setPos(self.faceStartPos[0] * (1 - t) + self.faceEndPos[0] * t, self.faceStartPos[1], self.faceStartPos[2])

        self.raceModeReady = True
        self.disable()
        return
开发者ID:Kawaiikat14,项目名称:Toontown-2-Revised,代码行数:80,代码来源:RaceGUI.py

示例5: enterWaiting

 def enterWaiting(self):
     self.waitingLabel = DirectLabel()
     self.waitingLabel['text'] = TTLocalizer.BuildingWaitingForVictors
     self.waitingLabel.setScale(TTLocalizer.DRenterWaiting)
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:4,代码来源:DistributedRace.py

示例6: DistributedRace


#.........这里部分代码省略.........

    def exitPrep(self):
        pass

    def enterTutorial(self):
        self.notify.debug('entering Tutorial State')
        base.loader.endBulkLoad('atRace')
        self.localKart.setPosHpr(self.myPos[0], self.myPos[1] + self.spin)
        base.transitions.irisIn()
        self.rulesDoneEvent = 'finishedRules'
        self.accept(self.rulesDoneEvent, self.handleRulesDone)
        self.rulesPanel = MinigameRulesPanel.MinigameRulesPanel('RacingRulesPanel', self.getTitle(), self.getInstructions(), self.rulesDoneEvent, 10)
        self.rulesPanel.load()
        self.rulesPanel.frame.setPos(0, 0, -0.6667)
        self.rulesPanel.enter()

    def exitTutorial(self):
        self.ignore(self.rulesDoneEvent)
        self.rulesPanel.exit()
        self.rulesPanel.unload()
        del self.rulesPanel

    def getTitle(self):
        return TTLocalizer.KartRace_TitleInfo

    def getInstructions(self):
        return TTLocalizer.KartRace_TrackInfo[self.trackId]

    def handleRulesDone(self):
        self.doneBarrier('readRules')
        self.fsm.request('waiting')

    def enterWaiting(self):
        self.waitingLabel = DirectLabel()
        self.waitingLabel['text'] = TTLocalizer.BuildingWaitingForVictors
        self.waitingLabel.setScale(TTLocalizer.DRenterWaiting)

    def exitWaiting(self):
        self.waitingLabel.removeNode()

    def enterStart(self):
        waitTime = self.baseTime - globalClock.getFrameTime()
        taskName = 'enableRaceModeLater'
        taskMgr.doMethodLater(1, self.gui.enableRaceMode, taskName, extraArgs=[])
        self.miscTaskNames.append(taskName)
        for i in self.avIds:
            self.gui.racerEntered(i)

        self.startCountdownClock(waitTime, 0)
        taskMgr.doMethodLater(waitTime, self.fsm.request, 'goToRacing', extraArgs=['racing'])

    def exitStart(self):
        pass

    def enterRacing(self):
        self.localKart.setInput(1)
        self.gui.setTimerEnabled(True)
        self.raceTask = taskMgr.add(self.raceWatcher, 'raceWatcher')

    def exitRacing(self):
        pass

    def raceWatcher(self, task):
        kart = base.cr.doId2do.get(self.kartMap.get(localAvatar.doId, None), None)
        if self.localKart.amIClampingPosition():
            self.notify.debug('teleporting kart %d back to main track' % localAvatar.doId)
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:67,代码来源:DistributedRace.py

示例7: enterWaiting

 def enterWaiting(self):
     self.waitingLabel = DirectLabel()
     self.waitingLabel["text"] = TTLocalizer.WaitingForOtherToons
     self.waitingLabel.setScale(TTLocalizer.DRenterWaiting)
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:4,代码来源:DistributedRace.py

示例8: MiniScoreItemGui

class MiniScoreItemGui(DirectFrame.DirectFrame):
    Width = PiratesGuiGlobals.PVPPanelWidth - PiratesGuiGlobals.GridSize
    Height = 0.055
    
    def __init__(self, scoreValue, parent = None, world = None, itemColorScale = None, blink = False, **kw):
        optiondefs = (('state', DGG.NORMAL, None), ('frameColor', (0, 0, 0, 0.0), None), ('borderWidth', PiratesGuiGlobals.BorderWidth, None), ('frameSize', (0.0, MiniScoreItemGui.Width, 0.0, MiniScoreItemGui.Height), None))
        self.defineoptions(kw, optiondefs)
        DirectFrame.DirectFrame.__init__(self, parent)
        self.initialiseoptions(MiniScoreItemGui)
        self.scoreValue = scoreValue
        self.world = world
        self.itemColorScale = itemColorScale
        self.blink = blink
        self.scaleSeq = None
        self._createIface()

    
    def destroy(self):
        self._destroyIface()
        DirectFrame.DirectFrame.destroy(self)
        del self.scoreValue
        self.ignoreAll()

    
    def _createIface(self):
        textFg = PiratesGuiGlobals.TextFG1
        if self.world != None:
            scoreText = self.world.getScoreText(self.scoreValue)
        else:
            scoreText = ''
        self.descText = DirectLabel(parent = self, relief = None, text = scoreText, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = textFg, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.040000000000000001, 0, 0.014999999999999999))
        if self.itemColorScale:
            self.colorLabel(self.itemColorScale)
        
        if self.blink:
            textPos = self.descText['text_pos']
            textPosX = textPos[0]
            textPosY = textPos[1]
            self.scaleSeq = Parallel(Sequence(LerpFunctionInterval(self.descText.setScale, duration = 0.20000000000000001, toData = 1.05, fromData = 1.0, blendType = 'easeInOut'), LerpFunctionInterval(self.descText.setScale, duration = 0.69999999999999996, toData = 1.0, fromData = 1.05, blendType = 'easeInOut')), Sequence(Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 0, 0, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, (1, 1, 1, 1)), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.moveLabel, (textPosX, textPosY)), Wait(0.050000000000000003), Func(self.colorLabel, PiratesGuiGlobals.TextFG1), Func(self.moveLabel, (textPosX, textPosY))))
            self.scaleSeq.start()
        

    
    def moveLabel(self, xy):
        randX = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        randY = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        self.descText['text_pos'] = (xy[0] + randX, xy[1] + randY)

    
    def colorLabel(self, color):
        self.descText['text_fg'] = color

    
    def shakeItUp(self, .2):
        (x, y, r, g, b, a) = .2
        self.colorLabel((r, g, b, a))
        randX = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        randY = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        self.moveLabel((x + randX, y + randY))
        Wait(0.050000000000000003)
        randX = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        randY = random.random() * 0.0050000000000000001 + 0.0050000000000000001
        self.moveLabel((x + randX, y + randY))
        Wait(0.050000000000000003)

    
    def _destroyIface(self):
        if self.scaleSeq:
            self.scaleSeq.finish()
            self.scaleSeq = None
        
        self.descText.destroy()
        del self.descText
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:73,代码来源:MiniScoreItemGui.py


注:本文中的direct.gui.DirectLabel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。