-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.py
More file actions
152 lines (139 loc) · 3.91 KB
/
Copy pathMenu.py
File metadata and controls
152 lines (139 loc) · 3.91 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
from getkey import getkey,keys
from subprocess import call
import const
import os
def showStartView():
file = "prelude.mp3"
os.system("afplay " + file)
call('clear')
print("**************************")
print("\n\n\n\n")
print(" Simple RPG ")
print("\n")
print(" press any key to start ")
print("\n\n\n\n")
print("**************************")
return getkey()
def showSaveMenu(saves):
call('clear')
print("**************************")
print("\n\n\n\n")
if checkKey(saves, '1'):
print(" save 1 ")
else:
print(" save 1 no data ")
if checkKey(saves, '2'):
print(" save 2 ")
else:
print(" save 2 no data ")
if checkKey(saves, '3'):
print(" save 3 ")
else:
print(" save 3 no data ")
print(" press b back ")
print("\n\n\n")
print("**************************")
while True:
key = getkey()
if key == '1' or key == '2' or key == '3' or \
key == 'b' or key == 'B':
return key
def showMenu():
call('clear')
print("******** M E N U *********")
print("\n\n\n")
print(" s = Save")
print(" l = Load")
print(" d = delete save")
print(" esc = leave")
print(" b = back")
print("\n\n\n")
print("**************************")
while True:
key = getkey()
if key == keys.ESC or \
key == 's' or key == 'S' or \
key == 'l' or key == 'L' or \
key == 'd' or key == 'D' or \
key == 'b' or key == 'B':
return key
def showSaveSuccess():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n\n")
print(" Save success ")
print("\n\n\n\n\n")
print("**************************")
return getkey()
def showLoadSuccess():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n\n")
print(" Load success ")
print("\n\n\n\n\n")
print("**************************")
return getkey()
def showDeleteSuccess():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n\n")
print(" delete success ")
print("\n\n\n\n\n")
print("**************************")
return getkey()
def showDeleteSuccess():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n\n")
print(" delete success ")
print("\n\n\n\n\n")
print("**************************")
return getkey()
def showDeleteFailed():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n")
print(" delete failed ")
print(" file not exist ")
print(" or no data ")
print("\n\n\n\n\n")
print("**************************")
return getkey()
def showLoadFailed():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n")
print(" Load failed ")
print("\n")
print(" You don't have save Data ")
print("\n\n\n\n")
print("**************************")
return getkey()
def showGameOver():
call('clear')
print("******** M E N U *********")
print("\n\n\n\n")
print(" G A M E O V E R ")
print("\n")
print(" orz ")
print("\n\n\n\n")
print("**************************")
getkey()
call('clear')
def showVictory():
call('clear')
print("**************************")
print("\n\n\n\n")
print(" Victory ")
print("\n")
print(" ㄟ(≧◇≦)ㄏ ")
print("\n\n\n\n")
print("**************************")
# play music
# os.system("afplay " + const.VICTORY_MP3)
return getkey()
def checkKey(dict, key):
if key in dict.keys():
return True
else:
return False