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


Python GolfGlobals.getHoleName方法代码示例

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


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

示例1: doGolf

# 需要导入模块: from toontown.golf import GolfGlobals [as 别名]
# 或者: from toontown.golf.GolfGlobals import getHoleName [as 别名]
 def doGolf(self, word):
     args = word.split()
     response = None
     if len(args) == 1:
         pass
     1
     if args[1] == 'debugBarrier':
         golfHole = base.cr.doFind('DistributedGolfHole')
         if golfHole:
             if hasattr(golfHole, 'golfBarrier') and not golfHole.golfBarrier.isEmpty():
                 if golfHole.golfBarrier.isHidden():
                     golfHole.golfBarrier.show()
                     response = 'showing golf barrier'
                 else:
                     golfHole.golfBarrier.hide()
                     response = 'hiding golf barrier'
             
         else:
             response = 'no golf hole'
     elif args[1] == 'contact':
         messenger.send('ode toggle contacts')
     elif args[1] == 'power':
         if len(args) > 2:
             base.golfPower = args[2]
             response = 'setting power to %s' % args[2]
         else:
             base.golfPower = None
             response = 'unsetting power'
     elif args[1] == 'heading':
         if len(args) > 2:
             golfHole = base.cr.doFind('DistributedGolfHole')
             if golfHole:
                 golfHole.doMagicWordHeading(args[2])
                 response = 'setting heading to %s' % args[2]
             
         else:
             response = 'need heading parameter'
     elif args[1] == 'list':
         response = ''
         for holeId in GolfGlobals.HoleInfo:
             if holeId < 18:
                 response += '%d: %s\n' % (holeId, GolfGlobals.getHoleName(holeId))
                 continue
         
     elif args[1] == 'list2':
         response = ''
         for holeId in GolfGlobals.HoleInfo:
             if holeId >= 18:
                 response += '%d: %s\n' % (holeId, GolfGlobals.getHoleName(holeId))
                 continue
         
     
     if response:
         self.setMagicWordResponse(response)
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:56,代码来源:ToontownMagicWordManager.py

示例2: doGolf

# 需要导入模块: from toontown.golf import GolfGlobals [as 别名]
# 或者: from toontown.golf.GolfGlobals import getHoleName [as 别名]
    def doGolf(self, word):
        args = word.split()
        response = None
        if len(args) == 1:
            pass
        elif args[1] == "debugBarrier":
            golfHole = base.cr.doFind("DistributedGolfHole")
            if golfHole:
                if hasattr(golfHole, "golfBarrier") and not golfHole.golfBarrier.isEmpty():
                    if golfHole.golfBarrier.isHidden():
                        golfHole.golfBarrier.show()
                        response = "showing golf barrier"
                    else:
                        golfHole.golfBarrier.hide()
                        response = "hiding golf barrier"
            else:
                response = "no golf hole"
        elif args[1] == "contact":
            messenger.send("ode toggle contacts")
        elif args[1] == "power":
            if len(args) > 2:
                base.golfPower = args[2]
                response = "setting power to %s" % args[2]
            else:
                base.golfPower = None
                response = "unsetting power"
        elif args[1] == "heading":
            if len(args) > 2:
                golfHole = base.cr.doFind("DistributedGolfHole")
                if golfHole:
                    golfHole.doMagicWordHeading(args[2])
                    response = "setting heading to %s" % args[2]
            else:
                response = "need heading parameter"
        elif args[1] == "list":
            response = ""
            for holeId in GolfGlobals.HoleInfo:
                if holeId < 18:
                    response += "%d: %s\n" % (holeId, GolfGlobals.getHoleName(holeId))

        elif args[1] == "list2":
            response = ""
            for holeId in GolfGlobals.HoleInfo:
                if holeId >= 18:
                    response += "%d: %s\n" % (holeId, GolfGlobals.getHoleName(holeId))

        if response:
            self.setMagicWordResponse(response)
        return
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:51,代码来源:ToontownMagicWordManager.py

示例3: load

# 需要导入模块: from toontown.golf import GolfGlobals [as 别名]
# 或者: from toontown.golf.GolfGlobals import getHoleName [as 别名]
 def load(self):
     self.gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
     self.listXorigin = -0.5
     self.listFrameSizeX = 1.5
     self.listZorigin = -0.90000000000000002
     self.listFrameSizeZ = 1.04
     self.arrowButtonScale = 1.3
     self.itemFrameXorigin = -0.23699999999999999
     self.itemFrameZorigin = 0.36499999999999999
     self.labelXstart = self.itemFrameXorigin + 0.29299999999999998
     self.scrollList = DirectScrolledList(parent = self, relief = None, pos = (0, 0, 0), incButton_image = (self.gui.find('**/FndsLst_ScrollUp'), self.gui.find('**/FndsLst_ScrollDN'), self.gui.find('**/FndsLst_ScrollUp_Rllvr'), self.gui.find('**/FndsLst_ScrollUp')), incButton_relief = None, incButton_scale = (self.arrowButtonScale, self.arrowButtonScale, -(self.arrowButtonScale)), incButton_pos = (self.labelXstart, 0, self.itemFrameZorigin - 0.999), incButton_image3_color = Vec4(1, 1, 1, 0.20000000000000001), decButton_image = (self.gui.find('**/FndsLst_ScrollUp'), self.gui.find('**/FndsLst_ScrollDN'), self.gui.find('**/FndsLst_ScrollUp_Rllvr'), self.gui.find('**/FndsLst_ScrollUp')), decButton_relief = None, decButton_scale = (self.arrowButtonScale, self.arrowButtonScale, self.arrowButtonScale), decButton_pos = (self.labelXstart, 0, self.itemFrameZorigin + 0.22700000000000001), decButton_image3_color = Vec4(1, 1, 1, 0.20000000000000001), itemFrame_pos = (self.itemFrameXorigin, 0, self.itemFrameZorigin), itemFrame_scale = 1.0, itemFrame_relief = DGG.SUNKEN, itemFrame_frameSize = (self.listXorigin, self.listXorigin + self.listFrameSizeX, self.listZorigin, self.listZorigin + self.listFrameSizeZ), itemFrame_frameColor = (0.84999999999999998, 0.94999999999999996, 1, 1), itemFrame_borderWidth = (0.01, 0.01), numItemsVisible = 12, forceHeight = 0.083000000000000004, items = [])
     for courseId in GolfGlobals.CourseInfo:
         courseName = GolfGlobals.getCourseName(courseId)
         frame = DirectFrame(parent = self.scrollList, relief = None)
         courseNameDisplay = DirectLabel(parent = frame, relief = None, pos = (-0.47499999999999998, 0, 0.050000000000000003), text = courseName, text_align = TextNode.ALeft, text_scale = 0.074999999999999997, text_fg = (0.84999999999999998, 0.64000000000000001, 0.13, 1.0), text_shadow = (0, 0, 0, 1), text_font = ToontownGlobals.getSignFont())
         bestScoreDisplay = DirectLabel(parent = frame, relief = None, pos = (0.90000000000000002, 0, 0.050000000000000003), text = TTLocalizer.KartRace_Unraced, text_scale = 0.059999999999999998, text_fg = (0.0, 0.0, 0.0, 1.0), text_font = ToontownGlobals.getToonFont())
         self.bestDisplayList.append(bestScoreDisplay)
         self.scrollList.addItem(frame)
     
     for holeId in GolfGlobals.HoleInfo:
         holeName = GolfGlobals.getHoleName(holeId)
         frame = DirectFrame(parent = self.scrollList, relief = None)
         holeNameDisplay = DirectLabel(parent = frame, relief = None, pos = (-0.47499999999999998, 0, 0.050000000000000003), text = holeName, text_align = TextNode.ALeft, text_scale = 0.074999999999999997, text_fg = (0.94999999999999996, 0.94999999999999996, 0.0, 1.0), text_shadow = (0, 0, 0, 1), text_font = ToontownGlobals.getSignFont())
         bestScoreDisplay = DirectLabel(parent = frame, relief = None, pos = (0.90000000000000002, 0, 0.050000000000000003), text = TTLocalizer.KartRace_Unraced, text_scale = 0.059999999999999998, text_fg = (0.0, 0.0, 0.0, 1.0), text_font = ToontownGlobals.getToonFont())
         self.bestDisplayList.append(bestScoreDisplay)
         self.scrollList.addItem(frame)
开发者ID:OldToontown,项目名称:OldToontown,代码行数:28,代码来源:GolfPage.py

示例4: setup

# 需要导入模块: from toontown.golf import GolfGlobals [as 别名]
# 或者: from toontown.golf.GolfGlobals import getHoleName [as 别名]
    def setup(self):
        self.scoreboard = DirectFrame(parent=aspect2d, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1.9, 1, 1.05), pos=(0, 0, 0.375))
        self.lines = LineSegs()
        self.lines.setColor(0, 0, 0, 1)
        self.lines.setThickness(2)
        guiModel = loader.loadModel('phase_6/models/golf/golf_gui')
        highlight = loader.loadModel('phase_6/models/golf/headPanel')
        self.maximizeB = DirectButton(parent=base.a2dBottomRight, pos=(-0.15, 0, 0.15), relief=None, state=DGG.NORMAL, image=(guiModel.find('**/score_card_icon'), guiModel.find('**/score_card_icon_rollover'), guiModel.find('**/score_card_icon_rollover')), image_scale=(0.2, 1, 0.2), command=self.showBoard)
        self.vertOffset = 0.13
        self.playaTop = 0.12
        horzOffset = 0.12
        holeTop = 0.3
        self.vCenter = 0.025
        totScore = 0
        totPar = 0
        self.lineVStart = -0.465
        self.lineHStart = 0.17
        self.lineHorOffset = 0.13
        self.lineVertOffset = 0.125
        self.lineVCenter = 0.025
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        self.minimizeB = DirectButton(parent=self.scoreboard, pos=(0, 0, self.lineHStart - 0.59), relief=None, state=DGG.NORMAL, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), image_scale=(1, 1, 1), command=self.hideBoard, extraArgs=[None])
        self.exitCourseB = DirectButton(parent=self.scoreboard, pos=(0, 0, self.lineHStart - 0.59), relief=None, state=DGG.NORMAL, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), image_scale=(1, 1, 1), text=TTLocalizer.GolfExitCourse, text_scale=0.04, text_pos=TTLocalizer.GSBexitCourseBPos, command=self.exitCourse)
        self.exitCourseB.hide()
        self.highlightCur = DirectLabel(parent=self.scoreboard, relief=None, pos=(-0.003, 0, 0.038), image=highlight, image_scale=(1.82, 1, 0.135))
        self.titleBar = DirectLabel(parent=self.scoreboard, relief=None, pos=(-0.003, 0, 0.166), color=(0.7, 0.7, 0.7, 0.3), image=highlight, image_scale=(1.82, 1, 0.195))
        self.titleBar.show()
        self.highlightCur.show()
        buttons.removeNode()
        guiModel.removeNode()
        title = GolfGlobals.getCourseName(self.golfCourse.courseId) + ' - ' + GolfGlobals.getHoleName(self.golfCourse.holeIds[self.golfCourse.curHoleIndex])
        self.titleLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(0, 0, holeTop + 0.1), text_align=TextNode.ACenter, text=title, text_scale=TTLocalizer.GSBtitleLabel, text_font=ToontownGlobals.getSignFont(), text_fg=(0, 0.5, 0.125, 1))
        self.playaLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart - 0.23, 0, holeTop), text_align=TextNode.ACenter, text=TTLocalizer.GolfHole, text_font=ToontownGlobals.getMinnieFont(), text_scale=0.05)
        for holeLIndex in xrange(self.golfCourse.numHoles):
            holeLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart + 0.055 + horzOffset * holeLIndex, 0, holeTop), text_align=TextNode.ACenter, text='%s' % (holeLIndex + 1), text_scale=0.05)
            self.holeLabels.append(holeLabel)

        self.totalLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart + 0.1 + horzOffset * 9.5, 0, holeTop), text_align=TextNode.ACenter, text=TTLocalizer.GolfTotal, text_font=ToontownGlobals.getMinnieFont(), text_scale=0.05)
        self.parTitleLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart - 0.23, 0, holeTop - 0.1), text_align=TextNode.ACenter, text=TTLocalizer.GolfPar, text_font=ToontownGlobals.getMinnieFont(), text_scale=0.05)
        for parHoleIndex in xrange(self.golfCourse.numHoles):
            parLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart + 0.055 + horzOffset * parHoleIndex, 0, holeTop - 0.1), text_align=TextNode.ACenter, text='%s' % GolfGlobals.HoleInfo[self.golfCourse.holeIds[parHoleIndex]]['par'], text_scale=0.05, text_wordwrap=10)
            totPar = totPar + GolfGlobals.HoleInfo[self.golfCourse.holeIds[parHoleIndex]]['par']
            self.parLabels.append(parLabel)

        parLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart + 0.1 + horzOffset * 9.5, 0, holeTop - 0.1), text_align=TextNode.ACenter, text='%s' % totPar, text_scale=0.05, text_wordwrap=10)
        self.parLabels.append(parLabel)
        vert = 0.0
        self.numPlayas = len(self.golfCourse.avIdList)
        for playaIndex in xrange(self.numPlayas):
            name = TTLocalizer.GolfUnknownPlayer
            av = base.cr.doId2do.get(self.golfCourse.avIdList[playaIndex])
            if av:
                name = av.getName()
            playaLabel = DirectLabel(parent=self.scoreboard, relief=None, text_align=TextNode.ACenter, text=name, text_scale=0.05, text_wordwrap=9)
            self.playaTags.append(playaLabel)
            textN = playaLabel.component(playaLabel.components()[0])
            if type(textN) == OnscreenText:
                try:
                    if textN.textNode.getWordwrappedWtext() != name:
                        vert = self.playaTop - self.vertOffset * playaIndex
                    else:
                        vert = self.playaTop - self.vertOffset * playaIndex - self.vCenter
                except:
                    vert = self.playaTop - self.vertOffset * playaIndex

            self.playaTags[playaIndex].setPos(self.lineVStart - 0.23, 0, vert)
            self.notify.debug('self.text height = %f' % self.playaTags[playaIndex].getHeight())
            holeIndex = 0
            for holeIndex in xrange(self.golfCourse.numHoles):
                holeLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart + 0.055 + horzOffset * holeIndex, 0, self.playaTop - self.vertOffset * playaIndex - self.vCenter), text_align=TextNode.ACenter, text='-', text_scale=0.05, text_wordwrap=10)
                self.scoreTags.append(holeLabel)

            holeLabel = DirectLabel(parent=self.scoreboard, relief=None, pos=(self.lineVStart + 0.1 + horzOffset * 9.5, 0, self.playaTop - self.vertOffset * playaIndex - self.vCenter), text_align=TextNode.ACenter, text='-', text_scale=0.05, text_wordwrap=10)
            self.totalTags.append(holeLabel)

        self.lines.moveTo(self.lineVStart - 0.45, 0, self.lineHStart + 0.19)
        self.lines.drawTo(self.lineVStart + 11 * self.lineVertOffset, 0, self.lineHStart + 0.19)
        self.lines.moveTo(self.lineVStart - 0.45, 0, self.lineHStart + 0.09)
        self.lines.drawTo(self.lineVStart + 11 * self.lineVertOffset, 0, self.lineHStart + 0.09)
        self.lines.moveTo(self.lineVStart - 0.45, 0, self.lineHStart)
        self.lines.drawTo(self.lineVStart + 11 * self.lineVertOffset, 0, self.lineHStart)
        self.lines.moveTo(self.lineVStart - 0.45, 0, self.lineHStart + 0.19)
        self.lines.drawTo(self.lineVStart - 0.45, 0, self.lineHStart - 4 * 0.13)
        self.lines.moveTo(self.lineVStart, 0, self.lineHStart + 0.19)
        self.lines.drawTo(self.lineVStart, 0, self.lineHStart - 4 * 0.13)
        for x in xrange(4):
            self.lines.moveTo(self.lineVStart - 0.45, 0, self.lineHStart - (x + 1) * self.lineHorOffset)
            self.lines.drawTo(self.lineVStart + 11 * self.lineVertOffset + 0.005, 0, self.lineHStart - (x + 1) * self.lineHorOffset)

        for y in xrange(10):
            self.lines.moveTo(self.lineVStart + y * self.lineVertOffset, 0, self.lineHStart + 0.19)
            self.lines.drawTo(self.lineVStart + y * self.lineVertOffset, 0, self.lineHStart - 4 * 0.13)

        self.lines.moveTo(self.lineVStart + 11 * self.lineVertOffset, 0, self.lineHStart + 0.19)
        self.lines.drawTo(self.lineVStart + 11 * self.lineVertOffset, 0, self.lineHStart - 4 * 0.13)
        self.scoreboard.attachNewNode(self.lines.create())
        self.hide()
        return
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:100,代码来源:GolfScoreBoard.py

示例5: showBoard

# 需要导入模块: from toontown.golf import GolfGlobals [as 别名]
# 或者: from toontown.golf.GolfGlobals import getHoleName [as 别名]
    def showBoard(self, task = None):
        scoreDict = self.golfCourse.scores
        x = 0
        currentGolfer = self.golfCourse.getCurGolfer()
        for playaIndex in xrange(self.numPlayas):
            if self.golfCourse.isGameDone():
                self.playaTags[playaIndex].setColor(0, 0, 0, 1)
            elif currentGolfer == self.golfCourse.avIdList[playaIndex]:
                self.highlightCur.setColor(*GolfGlobals.PlayerColors[playaIndex])
                self.highlightCur.setAlphaScale(0.4)
                self.highlightCur.setPos(-0.003, 0, 0.038 - playaIndex * (self.lineVertOffset + 0.005))
                self.highlightCur.show()
            else:
                self.playaTags[playaIndex].setColor(0, 0, 0, 1)

        for avId in self.avIdList:
            holeIndex = 0
            totScore = 0
            playerExited = False
            for y in xrange(len(self.golfCourse.exitedAvIdList)):
                if self.golfCourse.exitedAvIdList[y] == avId:
                    self.playaTags[x].setColor(0.7, 0.7, 0.7, 1)
                    holeIndex = 0
                    for holeIndex in xrange(self.golfCourse.numHoles):
                        self.getScoreLabel(self.avIdList[x], holeIndex).setColor(0.7, 0.7, 0.7, 1)

                    self.totalTags[x].setColor(0.7, 0.7, 0.7, 1)
                    playerExited = True

            if playerExited == False:
                for holeIndex in xrange(self.golfCourse.numHoles):
                    if holeIndex <= self.golfCourse.curHoleIndex:
                        self.getScoreLabel(avId, holeIndex)['text'] = '%s' % scoreDict[avId][holeIndex]
                        totScore = totScore + scoreDict[avId][holeIndex]
                        if self.golfCourse.isGameDone() == False:
                            if holeIndex == self.golfCourse.curHoleIndex:
                                self.getScoreLabel(avId, holeIndex).setColor(1, 0, 0, 1)
                                self.holeLabels[holeIndex].setColor(1, 0, 0, 1)
                                self.parLabels[holeIndex].setColor(1, 0, 0, 1)
                                title = GolfGlobals.getCourseName(self.golfCourse.courseId) + ' - ' + GolfGlobals.getHoleName(self.golfCourse.holeIds[self.golfCourse.curHoleIndex])
                                self.titleLabel['text'] = title
                            else:
                                self.getScoreLabel(avId, holeIndex).setColor(0, 0, 0, 1)
                                self.holeLabels[holeIndex].setColor(0, 0, 0, 1)
                                self.parLabels[holeIndex].setColor(0, 0, 0, 1)

                self.totalTags[x]['text'] = '%s' % totScore
            if self.golfCourse.isGameDone():
                self.getScoreLabel(avId, self.golfCourse.numHoles - 1).setColor(0, 0, 0, 1)
                self.totalTags[x].setColor(1, 0, 0, 1)
            x = x + 1

        y = 0
        if self.golfCourse.isGameDone():
            self.parLabels[self.golfCourse.numHoles - 1].setColor(0, 0, 0, 1)
            self.holeLabels[self.golfCourse.numHoles - 1].setColor(0, 0, 0, 1)
            self.parLabels[self.golfCourse.numHoles].setColor(1, 0, 0, 1)
            self.totalLabel.setColor(1, 0, 0, 1)
        self.scoreboard.show()
        self.maximizeB.hide()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:62,代码来源:GolfScoreBoard.py


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