-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge.kv
103 lines (93 loc) · 4.18 KB
/
challenge.kv
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#:kivy 1.10
#:import Setting setting.Setting
#:import FadeTransition kivy.uix.screenmanager.FadeTransition
<Challenge@ScreenManager>:
name: '测试一下'
help: '帮助指南'
level: 0
mlevel: 1
achieve: 0
goal: 1
percent: self.achieve / self.goal if self.level != self.mlevel else 1
color: (1, 1 - self.level / (4 * self.mlevel), 1 - self.level / (2 * self.mlevel), 1)
transition: FadeTransition()
_down: True
on_touch_down:
self._down = self.collide_point(*args[1].pos)
on_touch_up:
_up = self.collide_point(*args[1].pos)
self.current = ('info' if self.current == 'help' else 'help') if self._down and _up else self.current
Screen:
name: 'info'
FloatLayout:
color: root.color
canvas:
Color:
rgba: (0.5, 0.5, 0, 1)
Line:
width: 2 * Setting.multiple
rounded_rectangle: (self.x + 2 * Setting.multiple, self.y + 2 * Setting.multiple, self.width - 4 * Setting.multiple, self.height - 4 * Setting.multiple, 20 * Setting.multiple)
Color:
rgba: self.color if self.color else (1, 1, 1, 1)
Line:
cap: 'none'
width: 2 * Setting.multiple
circle: (self.x + 0.5 * self.height, self.y + 0.5 * self.height, 0.3 * self.height)
Label:
pos: (0.2 * root.height, 0.2 * root.height)
size: (0.6 * root.height, 0.6 * root.height)
size_hint: (None, None)
text: str(root.level)
font_size: 40 * Setting.multiple
color: root.color
Label:
pos: (root.height, 0.55 * root.height)
size: self.texture_size
size_hint: (None, None)
text: root.name
font_size: 24 * Setting.multiple
font_name: Setting.font_path
Label:
offset: 0.4 * (root.width - root.height - self.width)
pos: (root.height + self.offset, 0.5 * root.height - 1.25 * self.height)
size: self.texture_size
size_hint: (None, None)
text: '{}/{}'.format(root.achieve, root.goal) if root.level != root.mlevel else 'Max/Max'
font_size: 16 * Setting.multiple
canvas.before:
Color:
rgba: (0, 0.3, 0, 1)
RoundedRectangle:
pos: (self.x - self.offset + 2 * Setting.multiple, self.y + 2 * Setting.multiple) if self.offset else (0, 0)
size: ((root.width - root.height - 20 * Setting.multiple) * root.percent - 4 * Setting.multiple, self.height - 4 * Setting.multiple) if self.offset else (0, 0)
radius: [self.height / 2 - 2 * Setting.multiple]
Color:
rgba: (0.6, 0.6, 0.6, 1)
Line:
width: 2 * Setting.multiple
rounded_rectangle: (self.x - self.offset, self.y, root.width - root.height - 20 * Setting.multiple, self.height, self.height / 2) if self.offset else (0, 0, 0, 0, 0)
Screen:
name: 'help'
FloatLayout:
canvas:
Color:
rgba: (0.5, 0.5, 0, 1)
Line:
width: 2 * Setting.multiple
rounded_rectangle: (self.x + 2 * Setting.multiple, self.y + 2 * Setting.multiple, self.width - 4 * Setting.multiple, self.height - 4 * Setting.multiple, 20 * Setting.multiple)
Label:
text_size: root.size
text: root.help
font_size: 20 * Setting.multiple
font_name: Setting.font_path
halign: 'center'
valign: 'middle'
<ChallengeMenu>:
viewclass: 'Challenge'
data: []
rows: 4
cols: 3
wspace: 10 * Setting.multiple
hspace: 10 * Setting.multiple
wedge: 20 * Setting.multiple
hedge: 40 * Setting.multiple