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


Python Score.returnCombo方法代码示例

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


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

示例1: testgetComboScore

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import returnCombo [as 别名]
 def testgetComboScore(self): 
   'Test if the getComboScore is correct for five instances'
   get1 = Score()
   combo = 20
   get1.getComboScore(combo)
   comboScore1 = 400
   self.assertEqual(get1.returnCombo(),comboScore1)
   get2 = Score()
   combo = 10
   get2.getComboScore(combo)
   comboScore2 = 100
   self.assertEqual(get2.returnCombo(),comboScore2)
   get3 = Score()
   combo = 5
   get3.getComboScore(combo)
   comboScore3 = 30
   self.assertEqual(get3.returnCombo(),comboScore3)
   get4 = Score()
   combo = 3
   get4.getComboScore(combo)
   comboScore4 = 10
   self.assertEqual(get4.returnCombo(),comboScore4)
   get5 = Score()
   combo = 7
   get5.getComboScore(combo)
   comboScore5 = 0
   self.assertEqual(get5.returnCombo(),comboScore5)
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:29,代码来源:test_golfkapall.py

示例2: PlayScreen

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

#.........这里部分代码省略.........

        # 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]) 

            # draw info to screen
            screen.blit(timeLabel, timeLabel.get_rect().move(369,216))
            screen.blit(pointLabel, pointLabel.get_rect().move(369,280))
            screen.blit(bonuspointLabel, bonuspointLabel.get_rect().move(369,305))
            screen.blit(timepointLabel, timepointLabel.get_rect().move(369,330))
            screen.blit(totalpointLabel, totalpointLabel.get_rect().move(369,353))
        
        # check if game is over
        gameover = PlayScreen.gameOver(self, deck, pile, minidecks)

        # if game is over and game status hasn't been checked
        if gameover and self.checkGameStatus:
            play.pauseSong()
            self.displayLoseScreen = True       # request lose screen
            self.finalTime = displayTimeString  # stop and save timer to variable
            self.checkGameStatus = False        # we only need to check game status once in each game
            if self.sound == True:
                    play.gameOver() 

        # if all minidecks are empty and game status hasn't been checked
        elif numberofEmpties == len(minidecks) and self.checkGameStatus:
开发者ID:EliasJonsson,项目名称:Golf-Solitaire,代码行数:70,代码来源:Screens.py


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