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


Python Score.getSumScore方法代码示例

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


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

示例1: testgetSumScore

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import getSumScore [as 别名]
 def testgetSumScore(self):
   'Test if the getSumScore function is correct'
   get1 = Score()
   get2 = Score()
   get1.normalScore = 300
   get1.finishScore = 200
   get1.comboScore = 100
   get1.timeScore = 0
   normalScore = 400
   finishScore = 300
   comboScore = 100
   timeScore = 1000
   get2.normalScore = normalScore
   get2.finishScore = finishScore
   get2.comboScore = comboScore
   get2.timeScore = timeScore
   finish1 = 1
   finish2 = 0
   self.assertEqual(get1.getSumScore(finish2),(get1.normalScore+get1.comboScore))
   self.assertEqual(get2.getSumScore(finish1),(timeScore+normalScore+finishScore+comboScore))
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:22,代码来源:test_golfkapall.py

示例2: PlayScreen

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import getSumScore [as 别名]

#.........这里部分代码省略.........
                        play.select() 

            # draw the menu 
            screen.blit(self.menubg[IMG], self.menubg[RECT])
            screen.blit(self.playOn[IMG], self.playOn[RECT])
            screen.blit(self.playAgain[IMG], self.playAgain[RECT])
            screen.blit(self.stopGame[IMG], self.stopGame[RECT])

        # draw pause button
        screen.blit(self.pause[IMG], self.pause[RECT])

        # Update score
        self.currentScore = self.largefont.render('Stig: ' + str(self.score.returnScore()), 1, (255,255,255))
        screen.blit(self.currentScore, self.currentScoreRect)

        # Update time
        if self.displayMenu:
            displayTimeString = str(self.pauseTime - self.startTime)
        else:
            displayTimeString = str(pygame.time.get_ticks() - self.startTime)
        displayTimeString = displayTimeString[:-3]

        # write time to screen
        self.displayTime = self.largefont.render('Klukka: ' + displayTimeString, 1, (255,255,255))
        screen.blit(self.displayTime, self.displayTimeRect)

        # check if we are in 'game finished' mode
        if self.displayLoseScreen or self.displayWinScreen:

            '''
            TODO: Highscore registration screen
            '''
            if isPressed:
                if self.highscore.parseHighscores(self.score.getSumScore(self.gameResults)):
                    self.displayWinScreen = False
                    self.displayLoseScreen = False
                    self.displayRegister = True
                else:
                    currentScreenIndex = STARTSCREEN
                    startover = True

            color = (192, 57, 43)
            if self.displayLoseScreen:
                # if game was lost set color theme to red
                color = (192, 57, 43)
                self.gameResults = False
            elif self.displayWinScreen:
                # if game was won set color theme to green
                color = (49, 182, 144) 
                self.gameResults = True

            # create drawable objects for score and time. Score info is requested from model
            timeLabel = self.smallfont.render(str(self.finalTime) , 1, color)
            pointLabel = self.smallfont.render(str(self.score.returnNormalScore()), 1, color)
            bonuspointLabel = self.smallfont.render(str(self.score.returnCombo()), 1, color)
            timepointLabel = self.smallfont.render(str(self.score.getTimeScore(int(self.finalTime), self.gameResults)), 1, color)
            totalpointLabel = self.largefont.render(str(self.score.getSumScore(self.gameResults)), 1, color)

            # if lose screen draw lose screen
            if self.displayLoseScreen:
                screen.blit(self.endscreen[IMG], self.endscreen[RECT])

            # if win screen draw win screen
            elif self.displayWinScreen:
                screen.blit(self.winscreen[IMG], self.winscreen[RECT]) 
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:69,代码来源:Screens.py


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