本文整理汇总了Python中direct.gui.DirectLabel.setColorScale方法的典型用法代码示例。如果您正苦于以下问题:Python DirectLabel.setColorScale方法的具体用法?Python DirectLabel.setColorScale怎么用?Python DirectLabel.setColorScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectLabel
的用法示例。
在下文中一共展示了DirectLabel.setColorScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from direct.gui import DirectLabel [as 别名]
# 或者: from direct.gui.DirectLabel import setColorScale [as 别名]
#.........这里部分代码省略.........
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)