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


Python TextNode.setWordwrap方法代码示例

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


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

示例1: loadSign

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
 def loadSign(self):
     actNameForSign = self.activityName
     if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox)
     elif self.activityId == PartyGlobals.ActivityIds.PartyDance20:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance)
     self.sign = self.root.attachNewNode('%sSign' % self.activityName)
     self.signModel = self.party.defaultSignModel.copyTo(self.sign)
     self.signFlat = self.signModel.find('**/sign_flat')
     self.signFlatWithNote = self.signModel.find('**/sign_withNote')
     self.signTextLocator = self.signModel.find('**/signText_locator')
     textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign)
     textureNodePath.setPos(0.0, -0.02, 2.2)
     textureNodePath.setScale(2.35)
     textureNodePath.copyTo(self.signFlat)
     textureNodePath.copyTo(self.signFlatWithNote)
     text = TextNode('noteText')
     text.setTextColor(0.2, 0.1, 0.7, 1.0)
     text.setAlign(TextNode.ACenter)
     text.setFont(OTPGlobals.getInterfaceFont())
     text.setWordwrap(10.0)
     text.setText('')
     self.noteText = self.signFlatWithNote.attachNewNode(text)
     self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0)
     self.noteText.setScale(0.2)
     self.signFlatWithNote.stash()
     self.signTextLocator.stash()
开发者ID:nate97,项目名称:src,代码行数:29,代码来源:DistributedPartyActivity.py

示例2: attachHostNameToSign

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [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:nate97,项目名称:src,代码行数:33,代码来源:DistributedParty.py

示例3: displayText

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
	def displayText(self,text):
		newTextNode = TextNode('text')
		newTextNode.setText(text)
		newTextNode.setAlign(TextNode.ACenter)
		newTextNode.setWordwrap(16.0)
		text_generate = newTextNode.generate()
		newTextNodePath = render.attachNewNode(text_generate)
		newTextNodePath.setPos(0,1000,190)
		newTextNodePath.setScale(30,30,30)
		self.textEffects(newTextNodePath)
		return newTextNodePath
开发者ID:alebruck,项目名称:Dance2Rehab3D,代码行数:13,代码来源:main.py

示例4: load

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
 def load(self):
     from toontown.toonbase import ToontownGlobals
     from panda3d.core import TextNode
     textNode = TextNode('moviedialogue')
     textNode.setTextColor(0, 0, 0, 1)
     textNode.setCardColor(1, 1, 1, 1)
     textNode.setCardAsMargin(0, 0, 0, 0)
     textNode.setCardDecal(True)
     textNode.setWordwrap(27.0)
     textNode.setAlign(TextNode.ACenter)
     textNode.setFont(ToontownGlobals.getToonFont())
     self._dialogueLabel = aspect2d.attachNewNode(textNode)
     self._dialogueLabel.setScale(0.06, 0.06, 0.06)
     self._dialogueLabel.setPos(0.32, 0, -0.75)
     self._dialogueLabel.reparentTo(hidden)
开发者ID:nate97,项目名称:src,代码行数:17,代码来源:CogdoUtil.py

示例5: Text

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
class Text(object):
    
    def __init__(self, parent   = None,
                       nameNode = '',
                       text     = None,
                       align    = 'left',
                       wordwrap = 0,
                       scale    = .05,
                       pos      = (0, 0, 0),
                       cor      = (1, 1, 1, 1)):            
        
        if align == 'center':
            align = TextNode.ACenter
        elif align == 'left':
            align = TextNode.ALeft
        elif align == 'rigth':
            align = TextNode.ARight
        else :
            align = TextNode.ALeft
        
        self.textNode = TextNode(nameNode)
        self.textNode.setTextColor(cor)            
        self.textNode.setAlign(align)
        self.textNode.setText(text)        
                
        self.textNode.setWordwrap(wordwrap)
        
        self.textNodePath = parent.attachNewNode(self.textNode)        
        self.textNodePath.setScale(scale)
        
        height = (scale*self.textNode.getNumRows())
        self.textNodePath.setPos((pos[0], pos[1], pos[2]+height))
            
    def remove(self):
        self.textNodePath.remove()
        
    def billboardEffect(self):
        self.textNodePath.setBillboardAxis()
        self.textNodePath.setBillboardPointWorld()
        self.textNodePath.setBillboardPointEye()
    
    def getScale(self):
        return self.textNodePath.getScale()[0]
    
    def setPos(self, pos):
        self.textNodePath.setPos(pos)                        
开发者ID:avnergoncalves,项目名称:VinerOn,代码行数:48,代码来源:text.py

示例6: __init__

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
    def __init__(self,
                 horzmargin=0.5,        # horizontal margin in characters
                 vertmargin=1,          # vertical margin in charaters
                 width=30,              # width of the text box in characters
                 height=5,              # height of the text box in lines
                 scale=0.05,            # scaling of the text box
                 pos=(-3.1,-0.6),         # position of the upper-left corner inside the aspect2d viewport
                 font='arial.ttf',      # font to use for the text
                 align='left',          # alignment of the text (can be 'left', 'center', or 'right')
                 textcolor=(1,1,1,1),   # (r,g,b,a) text color
                 framecolor=(0,0,0,1),  # (r,g,b,a) frame color
                 *args,**kwargs
                 ): 
        
        """Construct a new TextPresenter."""
        MessagePresenter.__init__(self,*args,**kwargs)

        if align == 'left':
            align = TextNode.ALeft
        elif align == 'right':
            align = TextNode.ARight
        else:
            align = TextNode.ACenter

        text = TextNode('TextPresenter')
        text.setText('\n')
        font = loader.loadFont(font)
        text.setFont(font)
        text.setAlign(align)
        text.setWordwrap(width)
        text.setTextColor(textcolor[0],textcolor[1],textcolor[2],textcolor[3])
        if framecolor[3] > 0:
            text.setCardColor(framecolor[0],framecolor[1],framecolor[2],framecolor[3])
            text.setCardActual(-horzmargin,width+horzmargin,-(height+vertmargin),vertmargin)
        self.text = text
        self.text_nodepath = aspect2d.attachNewNode(text)
        self.text_nodepath.setScale(scale)        
        self.pos = pos        
        self.textcolor = textcolor
        pos = self.pos
        self.text_nodepath.setPos(pos[0],0,pos[1])
开发者ID:sccn,项目名称:SNAP,代码行数:43,代码来源:TextPresenter.py

示例7: WhisperPopup

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
class WhisperPopup(Clickable2d, MarginVisible):
    CONTENTS_SCALE = 0.25

    TEXT_MAX_ROWS = 6
    TEXT_WORD_WRAP = 8

    QUIT_BUTTON_SHIFT = (0.42, 0, 0.42)

    WHISPER_TIMEOUT_MIN = 10
    WHISPER_TIMEOUT_MAX = 20

    def __init__(self, text, font, whisperType, timeout=None):
        Clickable2d.__init__(self, 'WhisperPopup')
        MarginVisible.__init__(self)

        self.text = text
        self.font = font
        self.whisperType = whisperType
        if timeout is None:
            self.timeout = len(text) * 0.33
            if self.timeout < self.WHISPER_TIMEOUT_MIN:
                self.timeout = self.WHISPER_TIMEOUT_MIN
            elif self.timeout > self.WHISPER_TIMEOUT_MAX:
                self.timeout = self.WHISPER_TIMEOUT_MAX
        else:
            self.timeout = timeout

        self.active = False

        self.senderName = ''
        self.fromId = 0
        self.isPlayer = 0

        self.contents.setScale(self.CONTENTS_SCALE)

        self.whisperColor = ChatGlobals.WhisperColors[self.whisperType]

        self.textNode = TextNode('text')
        self.textNode.setWordwrap(self.TEXT_WORD_WRAP)
        self.textNode.setTextColor(self.whisperColor[PGButton.SInactive][0])
        self.textNode.setFont(self.font)
        self.textNode.setText(self.text)

        self.chatBalloon = None
        self.quitButton = None

        self.timeoutTaskName = self.getUniqueName() + '-timeout'
        self.timeoutTask = None

        self.quitEvent = self.getUniqueName() + '-quit'
        self.accept(self.quitEvent, self.destroy)

        self.setPriority(MarginGlobals.MP_high)
        self.setVisible(True)

        self.update()

        self.accept('MarginVisible-update', self.update)

    def destroy(self):
        self.ignoreAll()

        if self.timeoutTask is not None:
            taskMgr.remove(self.timeoutTask)
            self.timeoutTask = None

        if self.chatBalloon is not None:
            self.chatBalloon.removeNode()
            self.chatBalloon = None

        if self.quitButton is not None:
            self.quitButton.destroy()
            self.quitButton = None

        self.textNode = None

        Clickable2d.destroy(self)

    def getUniqueName(self):
        return 'WhisperPopup-' + str(id(self))

    def update(self):
        if self.chatBalloon is not None:
            self.chatBalloon.removeNode()
            self.chatBalloon = None

        if self.quitButton is not None:
            self.quitButton.destroy()
            self.quitButton = None

        self.contents.node().removeAllChildren()

        self.draw()

        if self.cell is not None:
            # We're in the margin display. Reposition our content, and update
            # the click region:
            self.reposition()
            self.updateClickRegion()
        else:
#.........这里部分代码省略.........
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:103,代码来源:WhisperPopup.py

示例8: LegendaryTellGUI

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
class LegendaryTellGUI(GuiPanel.GuiPanel):
    
    def __init__(self, w, h, locationId = LocationIds.PORT_ROYAL_ISLAND):
        GuiPanel.GuiPanel.__init__(self, '', w, h, True)
        self.card = loader.loadModel('models/gui/pir_m_gui_fsh_legendaryScreen')
        self.storyImageCard = loader.loadModel('models/minigames/pir_m_gam_fsh_legendaryGui')
        self.UICompoments = { }
        self.setPos(-1.1499999999999999, 0.0, -0.59999999999999998)
        self['geom'] = self.card.find('**/background')
        self['geom_pos'] = (0.57999999999999996, 0.0, 0.63)
        self['geom_scale'] = (0.94999999999999996, 0.0, 0.84999999999999998)
        self.coinImage = OnscreenImage(parent = self, image = self.card.find('**/coin'), scale = 0.90000000000000002, hpr = (0, 0, 0), pos = (0.84999999999999998, 0, 0.84999999999999998))
        self.titleTextNode = TextNode('legendPanelTitle')
        self.titleTextNode.setText(PLocalizer.LegendSelectionGui['panelTitle'])
        self.titleTextNode.setFont(PiratesGlobals.getPirateFont())
        self.titleTextNode.setTextColor(0.87, 0.81999999999999995, 0.54000000000000004, 0.90000000000000002)
        self.titleTextNodePath = NodePath(self.titleTextNode)
        self.titleTextNodePath.setPos(0.65000000000000002, 0.0, 1.2)
        self.titleTextNodePath.setScale(0.070000000000000007)
        self.titleTextNodePath.reparentTo(self)
        self.introTextNode = TextNode('legendaryIntroTextNode')
        self.introTextNode.setText(PLocalizer.LegendSelectionGui['legendIntro'])
        self.introTextNode.setWordwrap(14.0)
        self.introTextNode.setTextColor(0.90000000000000002, 0.80000000000000004, 0.46999999999999997, 0.90000000000000002)
        self.introTextNodePath = NodePath(self.introTextNode)
        self.introTextNodePath.setPos(0.59999999999999998, 0.0, 0.5)
        self.introTextNodePath.setScale(0.042000000000000003)
        self.introTextNodePath.reparentTo(self)
        self.buttonRootNode = NodePath('button_RootNode')
        self.buttonRootNode.reparentTo(self)
        self.buttonRootNode.setPos(-0.080000000000000002, 0.0, 1.1499999999999999)
        self.iconCard = loader.loadModel('models/gui/treasure_gui')
        self.legendSelectionButtons = { }
        btnGeom = (self.card.find('**/fishButton/idle'), self.card.find('**/fishButton/idle'), self.card.find('**/fishButton/over'))
        for i in range(len(FishingGlobals.legendaryFishData)):
            fishName = FishingGlobals.legendaryFishData[i]['name']
            fishId = FishingGlobals.legendaryFishData[i]['id']
            assetsKey = CollectionMap.Assets[fishId]
            pos_x = 0.29999999999999999
            pos_z = 0.0 - i * 0.25
            button = GuiButton(parent = self.buttonRootNode, text = (fishName, fishName, fishName, fishName), text0_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text1_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text2_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text3_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text_scale = 0.035000000000000003, text_pos = (0.037999999999999999, -0.0050000000000000001), pos = (pos_x, 0, pos_z), hpr = (0, 0, 0), scale = 1.5, image = btnGeom, image_pos = (0, 0, 0), image_scale = 0.69999999999999996, sortOrder = 2, command = self.buttonClickHandle, extraArgs = [
                fishId,
                assetsKey,
                locationId])
            button.icon = OnscreenImage(parent = button, image = self.iconCard.find('**/%s*' % assetsKey), scale = 0.34999999999999998, hpr = (0, 0, 0), pos = (-0.123, 0, 0.0050000000000000001))
        
        self.legendPanel = GuiPanel.GuiPanel('', 2.6000000000000001, 1.8999999999999999, True)
        self.legendPanel.setPos(-1.3, 0.0, -0.94999999999999996)
        self.legendPanel.background = OnscreenImage(parent = self.legendPanel, scale = (2.3999999999999999, 0, 1.8), image = self.storyImageCard.find('**/pir_t_gui_fsh_posterBackground'), hpr = (0, 0, 0), pos = (1.3, 0, 0.94999999999999996))
        self.legendPanel.storyImage = OnscreenImage(parent = self.legendPanel, scale = 1, image = self.card.find('**/coin'), hpr = (0, 0, 0), pos = (1.8, 0, 1))
        self.storyTextNode = TextNode('storyTextNode')
        self.storyTextNode.setText('')
        self.storyTextNode.setWordwrap(19.0)
        self.storyTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
        self.storyTextNodePath = NodePath(self.storyTextNode)
        self.storyTextNodePath.setPos(0.33000000000000002, 0.0, 1.6699999999999999)
        self.storyTextNodePath.setScale(0.050000000000000003)
        self.storyTextNodePath.reparentTo(self.legendPanel)
        self.callBack = None
        self.legendPanel.hide()

    
    def destroy(self):
        self.legendPanel.destroy()
        GuiPanel.GuiPanel.destroy(self)

    
    def buttonClickHandle(self, fishId, imgKey, locationId):
        result = imgKey.split('_')
        temp = str(result[1]).capitalize()
        imgName = 'pir_t_gui_fsh_poster%s' % temp
        self.legendPanel.storyImage.setImage(self.storyImageCard.find('**/%s*' % imgName))
        self.storyTextNode.setText(PLocalizer.LegendSelectionGui['shortStory'][fishId][locationId])
        self.legendPanel.show()

    
    def setCallBack(self, callback):
        self.callBack = callback

    
    def closePanel(self):
        GuiPanel.GuiPanel.closePanel(self)
        if self.callBack is not None:
            self.callBack()
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:86,代码来源:LegendaryTellGUI.py

示例9: PartyPlanner

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]

#.........这里部分代码省略.........
    def __exitPublic(self, mouseEvent):
        self.publicDescriptionLabel.stash()

    def __doTogglePublicPrivate(self):
        if self.isPrivate:
            self.isPrivate = False
            self.privateButton['state'] = DirectGuiGlobals.NORMAL
            self.publicButton['state'] = DirectGuiGlobals.DISABLED
        else:
            self.isPrivate = True
            self.privateButton['state'] = DirectGuiGlobals.DISABLED
            self.publicButton['state'] = DirectGuiGlobals.NORMAL

    def _createPartyEditorPage(self):
        page = DirectFrame(self.frame)
        page.setName('PartyPlannerEditorPage')
        self.LayoutTitleLabel = DirectLabel(parent=page, relief=None, text=TTLocalizer.PartyPlannerEditorTitle, pos=self.gui.find('**/title_locator').getPos() + Point3(0.0, 0.0, 0.075), scale=self.titleScale)
        self.costLabel = DirectLabel(parent=page, pos=(-0.74, 0.0, 0.17), relief=None, text=TTLocalizer.PartyPlannerTotalCost % 0, text_align=TextNode.ACenter, scale=TTLocalizer.PPcostLabel, textMayChange=True)
        self.partyGridBackground = DirectFrame(parent=page, relief=None, geom=self.gui.find('**/partyGrid_flat'))
        self.partyGroundsLabel = DirectLabel(parent=page, relief=None, text=TTLocalizer.PartyPlannerPartyGrounds, text_font=ToontownGlobals.getSignFont(), text_fg=VBase4(1.0, 0.0, 0.0, 1.0), text_scale=TTLocalizer.PPpartyGroundsLabel, pos=self.gui.find('**/step_05_partyGrounds_text_locator').getPos(), scale=0.1)
        self.activityBackground = DirectFrame(parent=page, relief=None, geom=self.gui.find('**/activitiesDecorations_flat1'), pos=(0.0, 0.0, 0.04))
        pos = self.gui.find('**/step_05_instructions_locator').getPos()
        self.instructionLabel = DirectLabel(parent=page, relief=None, text=' ', text_pos=(pos[0], pos[2]), text_scale=TTLocalizer.PPinstructionLabel, textMayChange=True, geom=self.gui.find('**/instructions_flat'))
        self.elementTitleLabel = DirectLabel(parent=page, relief=None, text=' ', pos=self.gui.find('**/step_05_activitiesName_text_locator').getPos() + Point3(0.0, 0.0, 0.04), text_scale=TTLocalizer.PPelementTitleLabel, textMayChange=True)
        self.elementPriceNode = TextNode('ElementPrice')
        self.elementPriceNode.setAlign(TextNode.ALeft)
        self.elementPriceNode.setTextColor(0.0, 0.0, 0.0, 1.0)
        self.elementPriceNode.setFont(ToontownGlobals.getToonFont())
        self.elementPrice = page.attachNewNode(self.elementPriceNode)
        self.elementPrice.setScale(TTLocalizer.PPelementPriceNode)
        self.elementPrice.setPos(self.gui.find('**/step_05_activityPrice_text_locator').getPos() + Point3(-0.02, 0.0, 0.04))
        self.elementDescriptionNode = TextNode('ElementDescription')
        self.elementDescriptionNode.setAlign(TextNode.ACenter)
        self.elementDescriptionNode.setWordwrap(8)
        self.elementDescriptionNode.setFont(ToontownGlobals.getToonFont())
        self.elementDescriptionNode.setTextColor(0.0, 0.0, 0.0, 1.0)
        self.elementDescription = page.attachNewNode(self.elementDescriptionNode)
        self.elementDescription.setScale(TTLocalizer.PPelementDescription)
        self.elementDescription.setPos(self.gui.find('**/step_05_activityDescription_text_locator').getPos() + Point3(0.0, 0.0, 0.04))
        self.totalMoney = base.localAvatar.getTotalMoney()
        catalogGui = loader.loadModel('phase_5.5/models/gui/catalog_gui')
        self.beanBank = DirectLabel(parent=page, relief=None, text=str(self.totalMoney), text_align=TextNode.ARight, text_scale=0.075, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.495, -0.53), text_font=ToontownGlobals.getSignFont(), textMayChange=True, image=catalogGui.find('**/bean_bank'), image_scale=(0.65, 0.65, 0.65), scale=0.9, pos=(-0.75, 0.0, 0.6))
        catalogGui.removeNode()
        del catalogGui
        self.accept(localAvatar.uniqueName('moneyChange'), self.__moneyChange)
        self.accept(localAvatar.uniqueName('bankMoneyChange'), self.__moneyChange)
        self.partyEditor = PartyEditor(self, page)
        self.partyEditor.request('Hidden')
        pos = self.gui.find('**/step_05_add_text_locator').getPos()
        self.elementBuyButton = DirectButton(parent=page, relief=None, text=TTLocalizer.PartyPlannerBuy, text_pos=(pos[0], pos[2]), text_scale=TTLocalizer.PPelementBuyButton, geom=(self.gui.find('**/add_up'), self.gui.find('**/add_down'), self.gui.find('**/add_rollover')), geom3_color=VBase4(0.5, 0.5, 0.5, 1.0), textMayChange=True, pos=(0.0, 0.0, 0.04), command=self.partyEditor.buyCurrentElement)
        self.okWithPartyGroundsLayoutEvent = 'okWithPartyGroundsLayoutEvent'
        self.accept(self.okWithPartyGroundsLayoutEvent, self.okWithPartyGroundsLayout)
        self.okWithGroundsGui = TTDialog.TTGlobalDialog(dialogName=self.uniqueName('PartyEditorOkGui'), doneEvent=self.okWithPartyGroundsLayoutEvent, message=TTLocalizer.PartyPlannerOkWithGroundsLayout, style=TTDialog.YesNo, okButtonText=OTPLocalizer.DialogYes, cancelButtonText=OTPLocalizer.DialogNo)
        self.okWithGroundsGui.doneStatus = ''
        self.okWithGroundsGui.hide()
        return page

    def okWithPartyGroundsLayout(self):
        self.okWithGroundsGui.hide()
        if self.okWithGroundsGui.doneStatus == 'ok':
            self.__nextItem()

    def setNextButtonState(self, enabled):
        if enabled:
            self.nextButton['state'] = DirectGuiGlobals.NORMAL
            self.nextButton.show()
开发者ID:nate97,项目名称:src,代码行数:70,代码来源:PartyPlanner.py

示例10: MessageWriter

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
class MessageWriter(DirectObject):
    def __init__(self):
        # the tasktime the last sign in the textfield was written
        self.lastSign = 0.0
        # the sign that is actually written in the textfield
        self.currentSign = 0
        # the text to write in the textfield
        self.textfieldText = ""
        # stop will be used to check if the writing is finished or
        # somehow else stoped
        self.stop = False
        # the speed new letters are added to the text
        # the time, how long the text is shown after it is fully written
        self.showlength = 4

        # the textfield to put instructions hints and everything else, that
        # should be slowly written on screen and disappear after a short while
        self.textfield = TextNode('textfield')
        self.textfield.clearText()
        self.textfield.setShadow(0.005, 0.005)
        self.textfield.setShadowColor(0, 0, 0, 1)
        self.textfield.setWordwrap(base.a2dRight*2-0.4)
        self.textfield.setCardActual(
            -0.1, base.a2dRight*2-0.3,
            0.1, base.a2dBottom+0.5)
        self.textfield.setCardColor(0,0,0,0.45)
        self.textfield.setFlattenFlags(TextNode.FF_none)
        self.textfield.setTextScale(0.06)
        self.textfieldNodePath = aspect2d.attachNewNode(self.textfield)
        self.textfieldNodePath.setScale(1)
        self.textfieldNodePath.setPos(base.a2dLeft+0.2, 0, -0.4)

        self.hide()

    def show(self):
        self.textfieldNodePath.show()

    def hide(self):
        self.textfield.clearText()
        self.textfieldNodePath.hide()

    def clear(self):
        """Clear the textfield and stop the current written text"""
        self.hide()
        taskMgr.remove("writeText")
        self.stop = False
        self.writeDone = False
        self.currentSign = 0
        self.lastSign = 0.0
        self.textfield.clearText()

    def cleanup(self):
        """Function that should be called to remove and reset the
        message writer"""
        self.clear()
        self.ignore("showMessage")

    def run(self):
        """This function can be called to start the writer task."""
        self.textfield.setFlattenFlags(TextNode.FF_none)
        taskMgr.add(self.__writeText, "writeText", priority=30)

    def setMessageAndShow(self, message):
        """Function to simply add a new message and show it if no other
        message is currently shown"""
        self.clear()
        logging.debug("show message %s" % message)
        self.textfieldText = message
        self.show()
        # start the writer task
        self.run()

    def __writeText(self, task):
        elapsed = globalClock.getDt()
        if(self.stop):
            # text is finished and can be cleared now
            self.clear()
            return task.done

        if self.currentSign == len(self.textfieldText)-1:
            self.textfield.setFlattenFlags(TextNode.FF_dynamic_merge)

        if self.currentSign >= len(self.textfieldText):
            # check if the text is fully written
            if task.time - self.lastSign >= self.showlength:
                # now also check if the time the text should
                # be visible on screen has elapsed
                self.stop = True
                self.textfieldNodePath.flattenStrong()
        elif (task.time - self.lastSign > base.textWriteSpeed) and (not self.stop):
            # write the next letter of the text
            self.textfield.appendText(self.textfieldText[self.currentSign])
            self.currentSign += 1
            self.lastSign = task.time

        return task.cont
开发者ID:grimfang,项目名称:owp_ajaw,代码行数:98,代码来源:textfield.py

示例11: __init__

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
class Nametag:
    TEXT_WORD_WRAP = 8
    TEXT_Y_OFFSET = -0.05

    CHAT_TEXT_WORD_WRAP = 12

    PANEL_X_PADDING = 0.2
    PANEL_Z_PADDING = 0.2

    CHAT_BALLOON_ALPHA = 1

    def __init__(self):
        self.avatar = None

        self.panel = None
        self.icon = None
        self.chatBalloon = None

        self.chatButton = NametagGlobals.noButton
        self.chatReversed = False

        self.font = None
        self.chatFont = None

        self.chatType = NametagGlobals.CHAT
        self.chatBalloonType = NametagGlobals.CHAT_BALLOON

        self.nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNormal]
        self.arrowColor = NametagGlobals.NametagColors[NametagGlobals.CCNormal]
        self.chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNormal]
        self.speedChatColor = self.chatColor[0][1]

        self.nametagHidden = False
        self.chatHidden = False
        self.thoughtHidden = False

        # Create our TextNodes:
        self.textNode = TextNode('text')
        self.textNode.setWordwrap(self.TEXT_WORD_WRAP)
        self.textNode.setAlign(TextNode.ACenter)

        self.chatTextNode = TextNode('chatText')
        self.chatTextNode.setWordwrap(self.CHAT_TEXT_WORD_WRAP)
        self.chatTextNode.setGlyphScale(ChatBalloon.TEXT_GLYPH_SCALE)
        self.chatTextNode.setGlyphShift(ChatBalloon.TEXT_GLYPH_SHIFT)

        # Add the tick task:
        self.tickTaskName = self.getUniqueName() + '-tick'
        self.tickTask = taskMgr.add(self.tick, self.tickTaskName, sort=45)

    def destroy(self):
        if self.tickTask is not None:
            taskMgr.remove(self.tickTask)
            self.tickTask = None

        self.chatTextNode = None
        self.textNode = None

        self.chatFont = None
        self.font = None

        self.chatButton = NametagGlobals.noButton

        if self.chatBalloon is not None:
            self.chatBalloon.removeNode()
            self.chatBalloon = None

        if self.icon is not None:
            self.icon.removeAllChildren()
            self.icon = None

        if self.panel is not None:
            self.panel.removeNode()
            self.panel = None

        self.avatar = None

    def getUniqueName(self):
        return 'Nametag-' + str(id(self))

    def getChatBalloonModel(self):
        pass  # Inheritors should override this method.

    def getChatBalloonWidth(self):
        pass  # Inheritors should override this method.

    def getChatBalloonHeight(self):
        pass  # Inheritors should override this method.

    def tick(self, task):
        return Task.done  # Inheritors should override this method.

    def updateClickRegion(self):
        pass  # Inheritors should override this method.

    def drawChatBalloon(self, model, modelWidth, modelHeight):
        pass  # Inheritors should override this method.

    def drawNametag(self):
        pass  # Inheritors should override this method.
#.........这里部分代码省略.........
开发者ID:nate97,项目名称:src,代码行数:103,代码来源:Nametag.py

示例12: __init__

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setWordwrap [as 别名]
class LegendaryFishingGameGUI:
    
    def __init__(self, gameObject = None):
        base.loadingScreen.beginStep('LegendaryGameGUI', 4, 20)
        self.gameObject = gameObject
        self.guiImage = loader.loadModel('models/minigames/pir_m_gam_fsh_legendaryGui')
        self.UICompoments = { }
        self.uiBaseNode = NodePath('baseNode')
        self.uiBaseNode.reparentTo(aspect2d)
        self.uiBaseNode.show()
        self.leftBaseNode = NodePath('leftBaseNode')
        self.leftBaseNode.reparentTo(base.a2dLeftCenter)
        self.leftBaseNode.show()
        self.fishActor = None
        self.actorAnim = { }
        self.scaleSize = {
            InventoryType.Collection_Set11_Part1: 0.059999999999999998,
            InventoryType.Collection_Set11_Part2: 0.055,
            InventoryType.Collection_Set11_Part3: 0.12,
            InventoryType.Collection_Set11_Part4: 0.086999999999999994,
            InventoryType.Collection_Set11_Part5: 0.080000000000000002 }
        self.meterFrame = DirectFrame(parent = self.leftBaseNode, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.0, 0.0), frameColor = (1.0, 1.0, 1.0, 0.0), relief = None, state = DGG.DISABLED, pos = (1.0, 0.0, -0.45000000000000001), hpr = (0, 0, 0), scale = (1.3, 0.0, 1.3), image = self.guiImage.find('**/pir_t_gui_fsh_meter'), image_scale = (0.20000000000000001, 0.0, 0.80000000000000004), image_pos = (0, 0, 0), text = '', textMayChange = 1, text_scale = PiratesGuiGlobals.TextScaleTitleLarge, text_pos = (-0.55000000000000004, 0.10000000000000001), text_shadow = PiratesGuiGlobals.TextShadow)
        self.UICompoments['meterFrame'] = self.meterFrame
        self.fishingRod = DirectFrame(parent = self.meterFrame, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.0, 0.0), relief = None, state = DGG.DISABLED, pos = FishingGlobals.fishingRodScreenPosition, image = self.guiImage.find('**/pir_t_gui_fsh_fullRod'), image_scale = (1.0, 0.0, 0.125), image_pos = (0.20000000000000001, 0, 0))
        self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)
        self.UICompoments['fishingRod'] = self.fishingRod
        base.loadingScreen.tick()
        self.fishingHandleBaseFrame = DirectFrame(parent = self.uiBaseNode, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.5, 1.5), frameColor = (1.0, 1.0, 1.0, 0.0), relief = None, state = DGG.DISABLED, pos = (0.0, 0.0, 0.0), hpr = (0, 0, 0), scale = (0.71999999999999997, 0.0, 0.71999999999999997), image = self.guiImage.find('**/pir_t_gui_fsh_partialRod'), image_scale = (3.7999999999999998, 0.0, 1.8999999999999999), image_pos = (0, 0, 0), image_hpr = (0.0, 0.0, 0))
        self.fishingHandleBaseFrame.hide()
        self.UICompoments['fishingHandleBaseFrame'] = self.fishingHandleBaseFrame
        self.fishingHandle = DirectFrame(parent = self.fishingHandleBaseFrame, frameSize = (-0.080000000000000002, 0.080000000000000002, -0.20000000000000001, 0.20000000000000001), relief = None, state = DGG.DISABLED, pos = (-0.10000000000000001, 0.0, -0.050000000000000003), hpr = (0, 0, 0), image = self.guiImage.find('**/pir_t_gui_fsh_handleArm'), image_scale = (1.0, 0.0, 1.0), image_pos = (-0.042000000000000003, 0, -0.115), image_hpr = (0.0, 0.0, 0))
        self.UICompoments['fishingHandle'] = self.fishingHandle
        self.arrowImage = DirectFrame(parent = self.fishingHandleBaseFrame, frameSize = (-0.40000000000000002, 0.40000000000000002, -0.40000000000000002, 0.40000000000000002), relief = None, state = DGG.DISABLED, pos = (0.0, 0.0, 0.0), hpr = (0, 0, 0), scale = (1.2, 0.0, 1.2), image = self.guiImage.find('**/pir_t_gui_fsh_arrow'), image_scale = (1.0, 0.0, 1.0), image_pos = (0.0, 0, 0.0), image_hpr = (0.0, 0.0, 0.0))
        self.arrowImage.hide()
        self.UICompoments['arrowImage'] = self.arrowImage
        btnGeom = (self.guiImage.find('**/pir_t_gui_fsh_handle'), self.guiImage.find('**/pir_t_gui_fsh_handle'), self.guiImage.find('**/pir_t_gui_fsh_handleOn'))
        self.fishingHandleButton = GuiButton(pos = (-0.29999999999999999, 0, -0.55000000000000004), hpr = (0, 0, 0), scale = 0.45000000000000001, image = btnGeom, image_pos = (0, 0, 0), image_scale = 1.0, sortOrder = 2)
        self.fishingHandleButton.bind(DGG.B1PRESS, self.handleButtonClicked)
        self.fishingHandleButton.reparentTo(self.fishingHandle)
        self.UICompoments['fishingHandleButton'] = self.fishingHandleButton
        self.fishingHandleBaseFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.meterFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.lineOneTransitTextNode = TextNode('lineOneTransitText')
        self.lineOneTransitTextNode.setFont(PiratesGlobals.getPirateFont())
        self.lineOneTransitTextNode.setText('')
        self.lineOneTransitTextNode.setAlign(TextNode.ACenter)
        self.lineOneTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
        self.lineOneTransitTextNodePath = NodePath(self.lineOneTransitTextNode)
        self.lineOneTransitTextNodePath.setPos(0.0, 0.0, -0.80000000000000004)
        self.lineOneTransitTextNodePath.setScale(0.34999999999999998, 0.34999999999999998, 0.34999999999999998)
        self.lineOneTransitTextNodePath.reparentTo(self.uiBaseNode)
        self.lineOneTransitTextNodePath.hide()
        self.UICompoments['lineOneTransitText'] = self.lineOneTransitTextNodePath
        self.lineTwoTransitTextNode = TextNode('lineTwoTransitText')
        self.lineTwoTransitTextNode.setFont(PiratesGlobals.getPirateFont())
        self.lineTwoTransitTextNode.setText('')
        self.lineTwoTransitTextNode.setAlign(TextNode.ACenter)
        self.lineTwoTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
        self.lineTwoTransitTextNodePath = NodePath(self.lineTwoTransitTextNode)
        self.lineTwoTransitTextNodePath.setPos(-0.40000000000000002, 0.0, -0.94999999999999996)
        self.lineTwoTransitTextNodePath.setScale(0.12, 0.12, 0.12)
        self.lineTwoTransitTextNodePath.reparentTo(self.uiBaseNode)
        self.lineTwoTransitTextNodePath.hide()
        self.UICompoments['lineTwoTransitText'] = self.lineTwoTransitTextNodePath
        base.loadingScreen.tick()
        self.test_guiImage = loader.loadModel('models/gui/toplevel_gui')
        self.buttonIcon = (self.test_guiImage.find('**/treasure_chest_closed'), self.test_guiImage.find('**/treasure_chest_closed'), self.test_guiImage.find('**/treasure_chest_closed_over'))
        self.winImagePanel = GuiPanel.GuiPanel('', 2.6000000000000001, 1.8999999999999999, True)
        self.winImagePanel.setPos(-1.3, 0.0, -0.94999999999999996)
        self.winImagePanel.reparentTo(self.uiBaseNode)
        self.winImagePanel.background = OnscreenImage(parent = self.winImagePanel, scale = (2.3999999999999999, 0, 1.8), image = self.guiImage.find('**/pir_t_gui_fsh_posterBackground'), hpr = (0, 0, 0), pos = (1.3, 0, 0.94999999999999996))
        self.winImagePanel.setBin('gui-popup', -4)
        self.winTitleTextNode = TextNode('winTitleTextNode')
        self.winTitleTextNode.setText('Congratulations!')
        self.winTitleTextNode.setAlign(TextNode.ACenter)
        self.winTitleTextNode.setFont(PiratesGlobals.getPirateFont())
        self.winTitleTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
        self.winTitleTextNodePath = NodePath(self.winTitleTextNode)
        self.winTitleTextNodePath.setPos(1.3500000000000001, 0.0, 1.6699999999999999)
        self.winTitleTextNodePath.setScale(0.17999999999999999)
        self.winTitleTextNodePath.reparentTo(self.winImagePanel)
        self.wholeStoryTextNode = TextNode('storyTextNode')
        self.wholeStoryTextNode.setText('')
        self.wholeStoryTextNode.setWordwrap(19.0)
        self.wholeStoryTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
        self.wholeStoryTextNodePath = NodePath(self.wholeStoryTextNode)
        self.wholeStoryTextNodePath.setPos(0.33000000000000002, 0.0, 1.6399999999999999)
        self.wholeStoryTextNodePath.setScale(0.050000000000000003)
        self.wholeStoryTextNodePath.reparentTo(self.winImagePanel)
        self.winImagePanel.closeButton['command'] = self.closeDialogGotNextState
        self.winImagePanel.closeButton['extraArgs'] = [
            'winImagePanel',
            'FarewellLegendaryFish',
            False]
        self.UICompoments['winImagePanel'] = self.winImagePanel
        self.winImagePanel.hide()
        self.luiCloseDialogSequence = Sequence()
        self.arrowImageRotationInterval = LerpHprInterval(self.arrowImage, 2.2000000000000002, self.arrowImage.getHpr() + Point3(0.0, 0.0, 280.0), self.arrowImage.getHpr())
        self.luiArrowRotatingSequence = Sequence(Func(self.showGui, [
            'arrowImage']), Parallel(Func(self.arrowImageRotationInterval.start), Wait(2.2000000000000002)), Func(self.hideGui, [
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:LegendaryFishingGameGUI.py


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