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


Python TextNode.setShadowColor方法代码示例

本文整理汇总了Python中pandac.PandaModules.TextNode.setShadowColor方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setShadowColor方法的具体用法?Python TextNode.setShadowColor怎么用?Python TextNode.setShadowColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandac.PandaModules.TextNode的用法示例。


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

示例1: attachHostNameToSign

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
 def attachHostNameToSign(self, locator):
     if self.hostName == "":
         return
     nameText = TextNode("nameText")
     nameText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
     nameText.setCardDecal(True)
     nameText.setCardColor(1.0, 1.0, 1.0, 0.0)
     r = 232.0 / 255.0
     g = 169.0 / 255.0
     b = 23.0 / 255.0
     nameText.setTextColor(r, g, b, 1)
     nameText.setAlign(nameText.ACenter)
     nameText.setFont(ToontownGlobals.getBuildingNametagFont())
     nameText.setShadowColor(0, 0, 0, 1)
     nameText.setBin("fixed")
     if TTLocalizer.BuildingNametagShadow:
         nameText.setShadow(*TTLocalizer.BuildingNametagShadow)
     nameWordWrap = 11.0
     nameText.setWordwrap(nameWordWrap)
     scaleMult = 0.48
     houseName = self.hostName
     nameText.setText(houseName)
     textWidth = nameText.getWidth()
     xScale = 1.0 * scaleMult
     if textWidth > nameWordWrap:
         xScale = nameWordWrap / textWidth * scaleMult
     sign_origin = locator
     namePlate = sign_origin.attachNewNode(nameText)
     namePlate.setDepthWrite(0)
     namePlate.setPos(0, 0, 0)
     namePlate.setScale(xScale)
开发者ID:XamarinDeveloper,项目名称:src,代码行数:33,代码来源:DistributedParty.py

示例2: AddMessage

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
 def AddMessage(self, prefix, prefixColor, message):
     parent = self.displayFrame.attachNewNode('messageParent')
     
     prefixTextNode = TextNode('prefixMessage')
     prefixTextNode.setText(prefix)
     prefixTextNode.setTextColor(prefixColor)
     prefixTextNode.setShadow(0.05, 0.05)
     prefixTextNode.setShadowColor(Globals.COLOR_BLACK)
     prefixTextNodePath = parent.attachNewNode(prefixTextNode)
     prefixTextNodePath.setScale(Settings.CHAT_HEIGHT)
     
     messageTextNode = TextNode('prefixMessage')
     messageTextNode.setText(message)
     messageTextNode.setTextColor(1, 1, 1, 1)
     messageTextNode.setShadow(0.05, 0.05)
     messageTextNode.setShadowColor(Globals.COLOR_BLACK)
     messageTextNodePath = parent.attachNewNode(messageTextNode)
     messageTextNodePath.setScale(Settings.CHAT_HEIGHT)
     messageTextNodePath.setPos(Vec3(prefixTextNode.calcWidth(prefix) * Settings.CHAT_HEIGHT, 0, 0))
     
     taskMgr.remove('HideMessageLog')
     taskMgr.doMethodLater(ChatBox.MESSAGE_LIFE, self.HideMessageLog, 'HideMessageLog') 
     self.ShowMessageLog()
     
     self.textNodes.append(parent)
     
     if(len(self.textNodes) > ChatBox.MAX_NUM_MESSAGES):
         self.RemoveMessage(self.textNodes[0])
         
     self.RedrawMessages()
开发者ID:czorn,项目名称:Modifire,代码行数:32,代码来源:ChatBox.py

示例3: loadGUI

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
 def loadGUI(self):
     self.gui = loader.loadModel('phase_13/models/parties/trampolineGUI')
     self.gui.reparentTo(base.a2dTopLeft)
     self.gui.setPos(0.115, 0, -1)
     self.gui.hide()
     self.toonIndicator = self.gui.find('**/trampolineGUI_MovingBar')
     jumpLineLocator = self.gui.find('**/jumpLine_locator')
     guiBean = self.gui.find('**/trampolineGUI_GreenJellyBean')
     self.gui.find('**/trampolineGUI_GreenJellyBean').stash()
     self.guiBeans = [ guiBean.instanceUnderNode(jumpLineLocator, self.uniqueName('guiBean%d' % i)) for i in xrange(self.numJellyBeans) ]
     self.guiBeans[-1].setScale(1.5)
     heightTextNode = TextNode(self.uniqueName('TrampolineActivity.heightTextNode'))
     heightTextNode.setFont(ToontownGlobals.getSignFont())
     heightTextNode.setAlign(TextNode.ALeft)
     heightTextNode.setText('0.0')
     heightTextNode.setShadow(0.05, 0.05)
     heightTextNode.setShadowColor(0.0, 0.0, 0.0, 1.0)
     heightTextNode.setTextColor(1.0, 1.0, 1.0, 1.0)
     self.heightText = jumpLineLocator.attachNewNode(heightTextNode)
     self.heightText.setX(0.15)
     self.heightText.setScale(0.1)
     self.heightText.setAlphaScale(0.0)
     self.quitEarlyButtonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
     quitEarlyUp = self.quitEarlyButtonModels.find('**//InventoryButtonUp')
     quitEarlyDown = self.quitEarlyButtonModels.find('**/InventoryButtonDown')
     quitEarlyRollover = self.quitEarlyButtonModels.find('**/InventoryButtonRollover')
     self.quitEarlyButton = DirectButton(parent=base.a2dTopRight, relief=None, text=TTLocalizer.PartyTrampolineQuitEarlyButton, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.7, image=(quitEarlyUp, quitEarlyDown, quitEarlyRollover), image_color=(1, 0, 0, 1), image_scale=(20, 1, 11), pos=(-0.183, 0, -0.4), scale=0.09, command=self.leaveTrampoline)
     self.quitEarlyButton.stash()
     self.flashText = OnscreenText(text='', pos=(0.0, -0.45), scale=0.2, fg=(1.0, 1.0, 0.65, 1.0), align=TextNode.ACenter, font=ToontownGlobals.getSignFont(), mayChange=True)
     self.timer = PartyUtils.getNewToontownTimer()
     self.timer.posInTopRightCorner()
     return
开发者ID:CalebSmith376,项目名称:src,代码行数:34,代码来源:DistributedPartyTrampolineActivity.py

示例4: load

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
 def load(self, loadModels = 1, arenaModel = 'partyCatchTree'):
     self.notify.info('load()')
     DistributedPartyCatchActivity.notify.debug('PartyCatch: load')
     self.activityFSM = CatchActivityFSM(self)
     self.defineConstants()
     self.treesAndFence = loader.loadModel('phase_13/models/parties/%s' % arenaModel)
     self.treesAndFence.setScale(0.9)
     self.treesAndFence.find('**/fence_floor').setPos(0.0, 0.0, 0.1)
     self.treesAndFence.reparentTo(self.root)
     ground = self.treesAndFence.find('**/groundPlane')
     ground.setBin('ground', 1)
     DistributedPartyActivity.load(self)
     exitText = TextNode('PartyCatchExitText')
     exitText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
     exitText.setCardDecal(True)
     exitText.setCardColor(1.0, 1.0, 1.0, 0.0)
     exitText.setText(TTLocalizer.PartyCatchActivityExit)
     exitText.setTextColor(0.0, 8.0, 0.0, 0.9)
     exitText.setAlign(exitText.ACenter)
     exitText.setFont(ToontownGlobals.getBuildingNametagFont())
     exitText.setShadowColor(0, 0, 0, 1)
     exitText.setBin('fixed')
     if TTLocalizer.BuildingNametagShadow:
         exitText.setShadow(*TTLocalizer.BuildingNametagShadow)
     exitTextLoc = self.treesAndFence.find('**/loc_exitSignText')
     exitTextNp = exitTextLoc.attachNewNode(exitText)
     exitTextNp.setDepthWrite(0)
     exitTextNp.setScale(4)
     exitTextNp.setZ(-.5)
     self.sign.reparentTo(self.treesAndFence.find('**/loc_eventSign'))
     self.sign.wrtReparentTo(self.root)
     self.avatarNodePath = NodePath('PartyCatchAvatarNodePath')
     self.avatarNodePath.reparentTo(self.root)
     self._avatarNodePathParentToken = 3
     base.cr.parentMgr.registerParent(self._avatarNodePathParentToken, self.avatarNodePath)
     self.toonSDs = {}
     self.dropShadow = loader.loadModelOnce('phase_3/models/props/drop_shadow')
     self.dropObjModels = {}
     if loadModels:
         self.__loadDropModels()
     self.sndGoodCatch = base.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
     self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
     self.sndAnvilLand = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.ogg')
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.ogg')
     self.__textGen = TextNode('partyCatchActivity')
     self.__textGen.setFont(ToontownGlobals.getSignFont())
     self.__textGen.setAlign(TextNode.ACenter)
     self.activityFSM.request('Idle')
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:50,代码来源:DistributedPartyCatchActivity.py

示例5: __init__

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
 def __init__(self, name, parent, pos = (0.0, 0.0, -0.5), scale = 0.09, color = (1.0, 1.0, 0, 1), sfx = None):
     self.color = color
     self._displaySfx = sfx
     textNode = TextNode('messageLabel.' + name)
     textNode.setTextColor(self.color)
     textNode.setAlign(TextNode.ACenter)
     textNode.setFont(ToontownGlobals.getSignFont())
     textNode.setShadow(0.06, 0.06)
     textNode.setShadowColor(0.5, 0.5, 0.5, 1.0)
     self.pos = pos
     self.scale = scale
     self.messageLabel = parent.attachNewNode(textNode)
     self.messageLabel.setPos(self.pos)
     self.messageLabel.setScale(self.scale)
     self.messageLabel.stash()
     self.transitionInterval = Sequence(name='%s.transitionInterval' % self.__class__.__name__)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:18,代码来源:CogdoGameMessageDisplay.py

示例6: Tooltip

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
class Tooltip(object):
    '''
    classdocs
    '''

    def __init__(self, ywn):
        '''
        Constructor
        '''
        
        self.ywn = ywn
        
        self.tooltip = TextNode('Tooltip')
        self.tooltip.setText("Every day in every way I'm getting better and better.")
        self.tooltip.setTextColor(1, 0.5, 0.5, 1)
        self.tooltip.setShadow(0.05, 0.05)
        self.tooltip.setShadowColor(0, 0, 0, 1)
        self.tooltipNodePath = self.ywn.aspect2d.attachNewNode(self.tooltip)
        self.tooltipNodePath.setScale(0.07)
        self.tooltipNodePath.setPos(-1,0,0.9)
        
        self.ywn.taskMgr.add(self.taskMouseTooltip, 'taskMouseToolip')
        
    def setText(self, text):
        
        self.tooltip.setText(text)
        
    def clearText(self):
        
        self.tooltip.clearText()
        
    def taskMouseTooltip(self, task):
        
        self.tooltipNodePath.setPos(self.ywn.mouseWatcher.currentPosition.x * self.ywn.getAspectRatio(), 0, self.ywn.mouseWatcher.currentPosition.y)
        
        return task.cont
开发者ID:sambarza,项目名称:bo,代码行数:38,代码来源:Tooltip.py

示例7: AddMessage

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
 def AddMessage(self, victimName, attackerName, itemName, attackerColor = Globals.COLOR_WHITE, victimColor = Globals.COLOR_WHITE):
     parent = self.displayFrame.attachNewNode('messageParent')
     
     attackerTextNode = TextNode('attackerTextNode')
     attackerTextNode.setText(attackerName)
     attackerTextNode.setTextColor(attackerColor)
     attackerTextNode.setShadow(0.05, 0.05)
     attackerTextNode.setShadowColor(Globals.COLOR_BLACK)
     attackerTextNodePath = parent.attachNewNode(attackerTextNode)
     attackerTextNodePath.setScale(Settings.CHAT_HEIGHT)
     attackerTextNodePath.setPos(Vec3(-attackerTextNode.calcWidth('%s [%s] %s' % (attackerName, itemName, victimName)) * Settings.CHAT_HEIGHT, 0, 0))
     
     itemNameTextNode = TextNode('itemNameTextNode')
     itemNameTextNode.setText('[%s]' % (itemName))
     itemNameTextNode.setTextColor(Globals.COLOR_WHITE)
     itemNameTextNode.setShadow(0.05, 0.05)
     itemNameTextNode.setShadowColor(Globals.COLOR_BLACK)
     itemNameTextNodePath = parent.attachNewNode(itemNameTextNode)
     itemNameTextNodePath.setScale(Settings.CHAT_HEIGHT)
     itemNameTextNodePath.setPos(Vec3(-attackerTextNode.calcWidth('[%s] %s' % (itemName, victimName)) * Settings.CHAT_HEIGHT, 0, 0))
     
     victimTextNode = TextNode('prefixMessage')
     victimTextNode.setText(victimName)
     victimTextNode.setTextColor(victimColor)
     victimTextNode.setShadow(0.05, 0.05)
     victimTextNode.setShadowColor(Globals.COLOR_BLACK)
     victimTextNodePath = parent.attachNewNode(victimTextNode)
     victimTextNodePath.setScale(Settings.CHAT_HEIGHT)
     victimTextNodePath.setPos(Vec3(-attackerTextNode.calcWidth(victimName) * Settings.CHAT_HEIGHT, 0, 0))
     
     taskMgr.remove('HideMessageLog')
     taskMgr.doMethodLater(DeathNotifications.MESSAGE_LIFE, self.RemoveMessage, 'RemoveMessage', extraArgs = [parent]) 
             
     self.textNodes.append(parent)
     
     if(len(self.textNodes) > DeathNotifications.MAX_NUM_MESSAGES):
         self.RemoveMessage(self.textNodes[0])
         
     self.RedrawMessages()
开发者ID:czorn,项目名称:Modifire,代码行数:41,代码来源:DeathNotifications.py

示例8: load

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
    def load(self, loadModels = 1, arenaModel = 'partyCatchTree'):
        self.notify.info('load()')
        DistributedPartyCatchActivity.notify.debug('PartyCatch: load')
        self.activityFSM = CatchActivityFSM(self)
        if __dev__:
            for o in xrange(3):
                print {0: 'SPOTS PER PLAYER',
                 1: 'DROPS PER MINUTE PER SPOT DURING NORMAL DROP PERIOD',
                 2: 'DROPS PER MINUTE PER PLAYER DURING NORMAL DROP PERIOD'}[o]
                for i in xrange(1, self.FallRateCap_Players + 10):
                    self.defineConstants(forceNumPlayers=i)
                    numDropLocations = self.DropRows * self.DropColumns
                    numDropsPerMin = 60.0 / self.DropPeriod
                    if o == 0:
                        spotsPerPlayer = numDropLocations / float(i)
                        print '%2d PLAYERS: %s' % (i, spotsPerPlayer)
                    elif o == 1:
                        numDropsPerMinPerSpot = numDropsPerMin / numDropLocations
                        print '%2d PLAYERS: %s' % (i, numDropsPerMinPerSpot)
                    elif i > 0:
                        numDropsPerMinPerPlayer = numDropsPerMin / i
                        print '%2d PLAYERS: %s' % (i, numDropsPerMinPerPlayer)

        self.defineConstants()
        self.treesAndFence = loader.loadModel('phase_13/models/parties/%s' % arenaModel)
        self.treesAndFence.setScale(0.9)
        self.treesAndFence.find('**/fence_floor').setPos(0.0, 0.0, 0.1)
        self.treesAndFence.reparentTo(self.root)
        ground = self.treesAndFence.find('**/groundPlane')
        ground.setBin('ground', 1)
        DistributedPartyActivity.load(self)
        exitText = TextNode('PartyCatchExitText')
        exitText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
        exitText.setCardDecal(True)
        exitText.setCardColor(1.0, 1.0, 1.0, 0.0)
        exitText.setText(TTLocalizer.PartyCatchActivityExit)
        exitText.setTextColor(0.0, 8.0, 0.0, 0.9)
        exitText.setAlign(exitText.ACenter)
        exitText.setFont(ToontownGlobals.getBuildingNametagFont())
        exitText.setShadowColor(0, 0, 0, 1)
        exitText.setBin('fixed')
        if TTLocalizer.BuildingNametagShadow:
            exitText.setShadow(*TTLocalizer.BuildingNametagShadow)
        exitTextLoc = self.treesAndFence.find('**/loc_exitSignText')
        exitTextNp = exitTextLoc.attachNewNode(exitText)
        exitTextNp.setDepthWrite(0)
        exitTextNp.setScale(4)
        exitTextNp.setZ(-.5)
        self.sign.reparentTo(self.treesAndFence.find('**/loc_eventSign'))
        self.sign.wrtReparentTo(self.root)
        self.avatarNodePath = NodePath('PartyCatchAvatarNodePath')
        self.avatarNodePath.reparentTo(self.root)
        self._avatarNodePathParentToken = 3
        base.cr.parentMgr.registerParent(self._avatarNodePathParentToken, self.avatarNodePath)
        self.toonSDs = {}
        self.dropShadow = loader.loadModelOnce('phase_3/models/props/drop_shadow')
        self.dropObjModels = {}
        if loadModels:
            self.__loadDropModels()
        self.sndGoodCatch = base.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
        self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
        self.sndAnvilLand = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.ogg')
        self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.ogg')
        self.__textGen = TextNode('partyCatchActivity')
        self.__textGen.setFont(ToontownGlobals.getSignFont())
        self.__textGen.setAlign(TextNode.ACenter)
        self.activityFSM.request('Idle')
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:69,代码来源:DistributedPartyCatchActivity.py

示例9: __init__

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
  def __init__( self,
                pos              = ( -.5, .5),
                title            = 'Title',
                curSize          = ( 1, 1),
                maxSize          = ( 1, 1 ),
                minSize          = ( .5, .5 ),
                backgroundColor  = ( 1, 1, 1, 1 ),
                borderColor      = ( 1, 1, 1, 1 ),
                titleColor       = ( 1, 1, 1, 1 ),
                borderSize       = 0.04,
                titleSize        = 0.06,
                closeButton      = False,
                windowParent     = aspect2d,
                preserve         = True,
                preserveWhole      = True,
              ):
    self.preserve = preserve
    self.preserveWhole = preserveWhole
    self.windowParent = windowParent
    self.windowPos = pos
    DirectFrame.__init__( self,
        parent       = windowParent,
        pos          = ( self.windowPos[0], 0, self.windowPos[1] ),
        frameColor  = ( 0, 0, 0, 0 ),
        frameTexture = loader.loadTexture( DIRECTORY+'transparent.png' )
      )
    self.setTransparency(True)
   
    # the title part of the window, drag around to move the window
    self.headerHeight = titleSize
    h = -self.headerHeight
    self.windowHeaderLeft = DirectButton(
        parent       = self,
        frameTexture = DEFAULT_TITLE_GEOM_LEFT,
        frameSize    = ( -.5, .5, -.5, .5 ),
        borderWidth  = ( 0, 0 ),
        relief       = DGG.FLAT,
        frameColor   = titleColor,
      )
    self.windowHeaderCenter = DirectButton(
        parent       = self,
        frameTexture = DEFAULT_TITLE_GEOM_CENTER,
        frameSize    = ( -.5, .5, -.5, .5 ),
        borderWidth  = ( 0, 0 ),
        relief       = DGG.FLAT,
        frameColor   = titleColor,
      )
    if closeButton:
      rightTitleGeom = DEFAULT_TITLE_GEOM_RIGHT_CLOSE
      command = self.destroy
    else:
      rightTitleGeom = DEFAULT_TITLE_GEOM_RIGHT
      command = None
    self.windowHeaderRight = DirectButton(
        parent       = self,
        frameTexture = rightTitleGeom,
        frameSize    = ( -.5, .5, -.5, .5 ),
        borderWidth  = ( 0, 0 ),
        relief       = DGG.FLAT,
        frameColor   = titleColor,
        command      = command
      )
   
    self.windowHeaderLeft.setTransparency(True)
    self.windowHeaderCenter.setTransparency(True)
    self.windowHeaderRight.setTransparency(True)
   
    self.windowHeaderLeft.bind( DGG.B1PRESS, self.startWindowDrag )
    self.windowHeaderCenter.bind( DGG.B1PRESS, self.startWindowDrag )
    self.windowHeaderRight.bind( DGG.B1PRESS, self.startWindowDrag )
   
    # this is not handled correctly, if a window is dragged which has been
    # created before another it will not be released
    # check the bugfixed startWindowDrag function
    #self.windowHeader.bind(DGG.B1RELEASE,self.stopWindowDrag)
   
    text = TextNode('WindowTitleTextNode')
    text.setText(title)
    text.setAlign(TextNode.ACenter)
    text.setTextColor( 0, 0, 0, 1 )
    text.setShadow(0.05, 0.05)
    text.setShadowColor( 1, 1, 1, 1 )
    self.textNodePath = self.attachNewNode(text)
    self.textNodePath.setScale(self.headerHeight*0.8)
   
    # the content part of the window, put stuff beneath
    # contentWindow.getCanvas() to put it into it
    self.maxVirtualSize = maxSize
    self.minVirtualSize = minSize
    self.resizeSize     = borderSize
    self.contentWindow = DirectScrolledFrame(
        parent                                  = self,
        pos                                     = ( 0, 0, -self.headerHeight ),
        canvasSize                              = ( 0, self.maxVirtualSize[0], 0, self.maxVirtualSize[1] ),
        frameColor                              = ( 0, 0, 0, 0), # defines the background color of the resize-button
        relief                                  = DGG.FLAT,
        borderWidth                             = (0, 0),
        verticalScroll_frameSize                = [0, self.resizeSize, 0, 1],
        horizontalScroll_frameSize              = [0, 1, 0, self.resizeSize],
       
#.........这里部分代码省略.........
开发者ID:croxis,项目名称:apollo,代码行数:103,代码来源:DirectWindow.py

示例10: __init__

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]

#.........这里部分代码省略.........
   self.parentWindow = DirectFrame(
     parent=self.parent, pos=(self.windowPos[0], 0, self.windowPos[1]),
     #frameSize=# is defined in resize
     scale=(1, 1, -1),
     frameColor=bgColor,
     borderWidth=(0, 0), relief=DGG.FLAT, sortOrder=1, )
   
   # header of the window (drag&drop with it)
   # the title part of the window, drag around to move the window
   self.headerParent = DirectButton(
       parent=self.parentWindow, pos=(0, 0, 0), 
       #frameSize=# is defined in resize
       scale=(1, 1, self.dragbarSize),
       frameColor=(1, 1, 1, 1), 
       borderWidth=(0, 0), relief=DGG.FLAT, )
   self.headerParent.bind(DGG.B1PRESS,self.startWindowDrag)
   # images in the headerParent
   self.headerCenter = DirectFrame(
       parent=self.headerParent, pos=(0, 0, 1),
       #frameSize=# is defined in resize
       scale=(1,1,-1),
       frameColor=windowColors[1], frameTexture=windowBorderTextures[1],
       borderWidth=(0, 0), relief=DGG.FLAT, )
   self.headerLeft = DirectFrame(
       parent=self.headerParent, pos=(0, 0, 1),
       frameSize=(0, self.dragbarSize, 0, 1), scale=(1,1,-1),
       frameColor=windowColors[0], frameTexture=windowBorderTextures[0],
       borderWidth=(0, 0), relief=DGG.FLAT, )
   # collapse button
   self.headerRight = DirectButton(
       parent=self.headerParent, #pos=# is defined in resize
       frameSize=(0, self.dragbarSize, 0, 1), scale=(1,1,-1),
       frameColor=windowColors[2], #frameTexture=windowBorderTextures[2],
       borderWidth=(0, 0), relief=DGG.FLAT,
       command=self.toggleCollapsed,
       geom=windowBorderGeoms[0], geom_scale=(self.dragbarSize,1,1) )
   # the resize button of the window
   self.resizeButton = DirectButton(
       parent=self.parentWindow, pos=(1-self.dragbarSize, 0, 1),
       frameSize=(0, 1, 0, 1), scale=(self.dragbarSize,1,-self.dragbarSize),
       frameColor=windowColors[3], frameTexture=windowBorderTextures[3],
       borderWidth=(0, 0), relief=DGG.FLAT, sortOrder=1, )
   self.resizeButton.bind(DGG.B1PRESS,self.startResizeDrag)
   # text in the center of the window
   text = TextNode('WindowTitleTextNode')
   text.setText(title)
   text.setAlign(TextNode.ACenter)
   text.setTextColor( 0, 0, 0, 1 )
   text.setShadow(0.05, 0.05)
   text.setShadowColor( 1, 1, 1, 1 )
   self.textNodePath = self.headerCenter.attachNewNode(text)
   self.textNodePath.setPos(.5,0,.3)
   self.textNodePath.setScale(0.8*self.dragbarSize,1,0.8)
   
   if Y_INVERTED:
     scale = (1,1,-1)
   else:
     scale = (1,1,1)
   # the content part of the window, put stuff beneath
   # contentWindow.getCanvas() to put it into it
   self.contentWindow = DirectScrolledFrame(
       parent       = self.parentWindow,
       #pos          = # is defined in resize
       scale        = scale,
       canvasSize   = (0,self.virtualSize[0],0,self.virtualSize[1]),
       frameColor   = buttonColor,
       relief       = DGG.RAISED,
       borderWidth  = (0,0),
       verticalScroll_frameSize                = [0,self.dragbarSize,0,1],
       verticalScroll_frameTexture             = loader.loadTexture( 'rightBorder.png' ),
       verticalScroll_incButton_frameTexture   = loader.loadTexture( 'scrollDown.png' ),
       verticalScroll_decButton_frameTexture   = loader.loadTexture( 'scrollDown.png' ),
       verticalScroll_thumb_frameTexture       = loader.loadTexture( 'scrollBar.png' ),
       horizontalScroll_frameSize              = [0,1,0,self.dragbarSize],
       horizontalScroll_frameTexture           = loader.loadTexture( 'bottomBorder.png' ),
       horizontalScroll_incButton_frameTexture = loader.loadTexture( 'scrollDown.png' ),
       horizontalScroll_decButton_frameTexture = loader.loadTexture( 'scrollDown.png' ),
       horizontalScroll_thumb_frameTexture     = loader.loadTexture( 'scrollBar.png' ),
     )
   # child we attach should be inside the window
   DirectFrame.__init__( self,
       parent       = self.contentWindow.getCanvas(),
       pos          = (0,0,self.virtualSize[1]),
       scale        = (1,1,1),
       frameSize    = ( 0, self.virtualSize[0]+2*self.borderSize, 0, self.virtualSize[1] ),
       #frameColor   = (0,0,0,1),
       relief       = DGG.RIDGE,
       borderWidth  = (0,0),
       )
   self.initialiseoptions(DirectWindow)
   
   # offset then clicking on the resize button from the mouse to the resizebutton
   # position, required to calculate the position / scaling
   self.offset = None
   self.resizeButtonTaskName = "resizeTask-%s" % str(hash(self))
   
   # do sizing of the window to virtualSize
   #self.resize( self.virtualSize[0]+2*self.borderSize
   #           , self.virtualSize[1]+self.dragbarSize+2*self.borderSize )
   self.resize(10,10)
开发者ID:KillerGoldFisch,项目名称:panda3d-editor,代码行数:104,代码来源:directWindow.py

示例11: PlayerName

# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setShadowColor [as 别名]
class PlayerName():
    
    def __init__(self, name, parentNode):
        self.parentNode = parentNode
        
        self.nameTextNode = TextNode('nameTextNode')
        self.nameTextNode.setText(name)
        self.nameTextNode.setTextColor(Globals.COLOR_WHITE)
        self.nameTextNode.setShadow(0.05, 0.05)
        self.nameTextNode.setShadowColor(Globals.COLOR_WHITE)
        self.nameTextNode.set_align(TextNode.ACenter)
        self.nameTextNodeTextPath = aspect2d.attachNewNode(self.nameTextNode)
        self.nameTextNodeTextPath.setScale(Settings.CHAT_HEIGHT)
        
        self.hidden = True
        self.nameTextNodeTextPath.hide()
        self.fadeSeq = Sequence(LerpColorScaleInterval(self.nameTextNodeTextPath, 1, Globals.COLOR_TRANSPARENT),
                                Func(self.nameTextNodeTextPath.hide))
        
        self.reshowOnInView = False
    
    def SetColor(self, color):
        self.nameTextNode.setTextColor(color)
    
    def IsHidden(self):
        return self.hidden
    
    def FadeOut(self):
        #print 'fo'
        if(not self.IsHidden()):
            #print 'really fo'
            self.hidden = True
            self.fadeSeq.start()
            
    def Hide(self):
        self.nameTextNodeTextPath.hide()
        self.hidden = True
    
    def Show(self):
        if(self.IsHidden()):
            if(self.fadeSeq.isPlaying()):
                self.fadeSeq.finish()
                
            self.nameTextNodeTextPath.show()
            self.nameTextNodeTextPath.setColorScale(Globals.COLOR_WHITE)
            self.hidden = False
            #print 'really show'
            
        
    def Update(self):
        self.nameTextNodeTextPath.setPos(Camera.Coord3dTo2d(self.parentNode))
             
        # If the node is visible
        if(base.camNode.isInView(self.parentNode.getPos(base.cam))):
            if(self.IsHidden() and self.reshowOnInView):
                self.Show()
        else:
            if(not self.IsHidden()):
                self.Hide()
                
                
                
                
                
                
开发者ID:czorn,项目名称:Modifire,代码行数:61,代码来源:PlayerName.py


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