File: menu_scores.py

package info (click to toggle)
krank 0.7%2Bdfsg2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,092 kB
  • sloc: python: 3,421; sh: 31; makefile: 11
file content (61 lines) | stat: -rw-r--r-- 2,273 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import k
from levels import *
from Part import *
from Effect import *
from Tools import *

def init():
    k.sound.loadTheme('menu')
    k.sound.music('summer.ogg')
    k.world.setBackground('menu-scores')

    # simple player
    k.player.setPos(k.world.rect.center)
    k.player.setTailNum(2)
    
    cx, cy, w, h = k.world.rect.centerx, k.world.rect.centery, k.world.rect.width, k.world.rect.height
    
    drawText("Scores & Stats", (cx, h*2/30), color=(0,0,0))

    lines = [['Total Playing Time', timeString(k.config['totalTime'])]]
    title = ['Easy Levels', 'Hard Levels', 'Extreme Levels', 'Bonus Levels']
    for i in range(3):
        num = i==3 and numBonusLevels or numLevels
        lines.extend([
             0,
             [title[i],        ''],
             ['Time', timeString(k.config['stageTime'][i])],
             ['Solved', "%d/%d (%d)" % (k.config.numSolvedLevels(i+1), num, k.config['totalSolved'][i])]])

    xd = w*0.05
    y = h*6/30
    for i in range(len(lines)):
        if lines[i]:
            y += h/22
            drawText(lines[i][0], (cx+xd, y), size='normal', color=(0,0,0), align='right')
            drawText(lines[i][1], (cx+xd+20, y), size='normal', color=(0,0,0), align='left')
        else:
            y += h/34

    k.particles.add(Switch({ 'text': 'Easy',
                             'align': 'bottom',
                             'action': 'k.level.menuExit("menu_scores1")',
                             'pos': pos(w*1/8, cy-h/4)}))

    k.particles.add(Switch({ 'text': 'Hard',
                             'align': 'bottom',
                             'action': 'k.level.menuExit("menu_scores2")',
                             'pos': pos(w*1/8, cy)}))


    k.particles.add(Switch({ 'text': 'Extreme',
                             'align': 'bottom',
                             'action': 'k.level.menuExit("menu_scores3")',
                             'pos': pos(w*1/8, cy+h/4)}))
        
    k.particles.add(Switch({ 'text': 'Back',
                             'align': 'bottom',
                             'action': 'k.level.menuExit()',
                             'size': 'small', 
                             'pos': pos(cx, h*7/8)}))