|
@@ -0,0 +1,85 @@
|
|
1
|
+import FSM
|
|
2
|
+import utils as u
|
|
3
|
+import menus as m
|
|
4
|
+#====================================
|
|
5
|
+
|
|
6
|
+State = type("State", (object,), {})
|
|
7
|
+#====================================
|
|
8
|
+class State(object):
|
|
9
|
+ def __init__(self, FSM):
|
|
10
|
+ self.FSM = FSM
|
|
11
|
+ def Enter(self):
|
|
12
|
+ pass
|
|
13
|
+ def Execute(self):
|
|
14
|
+ pass
|
|
15
|
+ def Exit(self):
|
|
16
|
+ pass
|
|
17
|
+#====================================
|
|
18
|
+class DeleteSound(State):
|
|
19
|
+ def __init__(self,FSM):
|
|
20
|
+ super(DeleteSound, self).__init__(FSM)
|
|
21
|
+
|
|
22
|
+ def Enter(self):
|
|
23
|
+ o = self.FSM.owner
|
|
24
|
+ o.header_text = "Delete Sound"
|
|
25
|
+ o.pub.register("beat", self)
|
|
26
|
+
|
|
27
|
+ if o.keyState[16] > 0 or o.keyState[17] > 0:
|
|
28
|
+ pass
|
|
29
|
+ else:
|
|
30
|
+ u.draw_header(o)
|
|
31
|
+ o.update_display(0)
|
|
32
|
+ self.draw_main(o)
|
|
33
|
+ self.draw_footer(o)
|
|
34
|
+ super(DeleteSound, self).Enter()
|
|
35
|
+
|
|
36
|
+ def Execute(self):
|
|
37
|
+ o = self.FSM.owner
|
|
38
|
+ m.menu1_actions(self, o)
|
|
39
|
+ if o.keyState[16] == 1:
|
|
40
|
+ m.draw_menu1(o)
|
|
41
|
+ o.update_display(0)
|
|
42
|
+ elif o.keyState[16] == 4:
|
|
43
|
+ u.draw_header(o)
|
|
44
|
+ self.draw_main(o)
|
|
45
|
+ self.draw_footer(o)
|
|
46
|
+ o.update_display(0)
|
|
47
|
+
|
|
48
|
+ if o.keyState[0] == 1 or o.keyState[0] == 3 or o.keyState[1] == 1 or o.keyState[1] == 3 or o.keyState[2] == 1 or o.keyState[2] == 3 or o.keyState[3] == 1 or o.keyState[3] == 3:
|
|
49
|
+ u.draw_header(o)
|
|
50
|
+ self.draw_main(o)
|
|
51
|
+ self.draw_footer(o)
|
|
52
|
+ o.update_display(0)
|
|
53
|
+
|
|
54
|
+ if o.keyState[0] == 1 or o.keyState[1] == 1 or o.keyState[2] == 1 or o.keyState[3] == 1:
|
|
55
|
+ o.soundSlots[o.eSound].file = None
|
|
56
|
+ o.soundSlots[o.eSound].volume = 16
|
|
57
|
+ o.soundSlots[o.eSound].pitch = 0
|
|
58
|
+ o.FSM.FSM.ToTransition("toMain")
|
|
59
|
+
|
|
60
|
+ def draw_main(self, o):
|
|
61
|
+ o.center_block("You sure?", o.h2, [0, 0, o.width, o.height], o.light_grey)
|
|
62
|
+
|
|
63
|
+ def draw_footer(self, o):
|
|
64
|
+ _iter = 0
|
|
65
|
+ width = o.width
|
|
66
|
+ xpos = 0
|
|
67
|
+ yposa = 135 - 25
|
|
68
|
+ yposb = 135
|
|
69
|
+ opts = ["Delete Sound"]
|
|
70
|
+ while _iter < 1:
|
|
71
|
+ o.draw.rectangle((xpos, yposa, xpos + width, yposb), outline=0, fill=o.blue)
|
|
72
|
+ if o.keyState[_iter] == 1:
|
|
73
|
+ o.draw.rectangle((xpos, yposa, xpos + width, yposb), outline=0, fill=o.light_grey)
|
|
74
|
+ o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.blue)
|
|
75
|
+ else:
|
|
76
|
+ o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.light_grey)
|
|
77
|
+ xpos += width
|
|
78
|
+ _iter += 1
|
|
79
|
+
|
|
80
|
+ def ReceiveMessage(self, message):
|
|
81
|
+ o = self.FSM.owner
|
|
82
|
+ u.play_seq(o, message)
|
|
83
|
+
|
|
84
|
+ def Exit(self):
|
|
85
|
+ self.FSM.owner.pub.unregister("beat", self)
|