-
Notifications
You must be signed in to change notification settings - Fork 0
/
man
executable file
·218 lines (188 loc) · 5.28 KB
/
man
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/usr/bin/env python3
import click
ScreenClasses = [
'ScreenAttract',
'ScreenCredits',
'ScreenEnding',
'ScreenHowToPlay',
'ScreenLogo',
'ScreenMusicScroll',
'ScreenRanking',
'ScreenUnlock',
'ScreenOptionsMaster',
'ScreenPlayerOptions',
'ScreenSongOptions',
'ScreenMiniMenu',
'ScreenNetworkOptions',
'ScreenProfileOptions',
'ScreenSMOnlineLogin',
'ScreenSelectMaster',
'ScreenTitleMenu',
'ScreenSelectDifficulty',
'ScreenSelectMode',
'ScreenSelectStyle',
'ScreenNetSelectBase',
'ScreenNetRoom',
'ScreenNetSelectMusic',
'ScreenGameplay',
'ScreenJukebox',
'ScreenDemonstration',
'ScreenEvaluation',
'ScreenNetEvaluation',
'ScreenArcadeDiagnostics',
'ScreenArcadePatch',
'ScreenArcadeStart',
'ScreenBookkeeping',
'ScreenCenterImage',
'ScreenEdit',
'ScreenEditCoursesMenu',
'ScreenEditMenu',
'ScreenEz2SelectMusic',
'ScreenEz2SelectPlayer',
'ScreenInstructions',
'ScreenMapControllers',
'ScreenNameEntryTraditional',
'ScreenPackages',
'ScreenPlayLights',
'ScreenSelectCharacter',
'ScreenSelectGroup',
'ScreenSelectMusic',
'ScreenSetTime',
'ScreenSplash',
'ScreenTestInput',
'ScreenTestLights',
'ScreenUserPacks',
'ScreenBranch',
'ScreenDebugOverlay',
'ScreenEndlessBreak',
'ScreenExit',
'ScreenExitCommand',
'ScreenGameplayMultiplayer',
'ScreenNameEntry',
'ScreenSaveSync',
'ScreenReloadSongs',
'ScreenSandbox',
'ScreenStage',
'ScreenSyncOverlay',
'ScreenSystemLayer',
'ScreenTest',
'ScreenTestFonts',
'ScreenTestSound',
]
@click.group()
def cli():
"""GIMMICKMAN - The easy way to become MANLY"""
pass
@cli.command()
@click.option('-v',help='Verbose',is_flag=True)
@click.option('--klass',help='Define what kind of screen you wish to make')
@click.option('--name',help='give your Screen a fun name')
@click.option('--append',help='Create Files for a Screen that already exists (does NOT write to metrics.ini)')
def make(klass,name,v,append):
"""Make a new Screen"""
def cecho(str):
if (v):
click.echo(" "+str)
if (not (klass and name)) and (not append):
click.echo('Must give a Class and Name to the screen!')
return
if (not (klass in ScreenClasses)) and (not append):
click.echo('Nice Class idiot')
return
if append:
pre = str(append).removeprefix('Screen')
ScreenName = 'Screen'+pre
else:
pre = str(name).removeprefix('Screen')
ScreenName = 'Screen'+pre
if not append:
metrics = open('metrics.ini','r+')
if metrics:
#adding a newline so it wont become unreadable
metrics.write('\n')
metrics.write('\n')
cecho('Loaded metrics.ini')
ScreenCount = 0
Screens = []
while True:
line = metrics.readline()
if not line:
cecho('Current Screens: '+str(ScreenCount))
break
if line.startswith('[Screen'):
Screens.append(line [1:-2]) #remove the brackets from the name
ScreenCount += 1
if 'Screen'+str(name) in Screens:
print('This Screen already exists!')
return
else:
title = '['+ScreenName+']'
metrics.write(title)
metrics.write('\n')
metrics.write('Class='+klass)
cecho('Created '+title+" with Class "+klass)
metrics.write('\n')
metrics.write('InitCommand=%gimmick.s.'+ScreenName+".Init")
metrics.close()
screenLua = open('./gimmick/screens/'+ScreenName+'.lua','x')
if screenLua:
cecho(ScreenName+"? only lua! 🔥")
Lua = f"""
return {{
Init = function(self) Trace('theme.com') end,
overlay = gimmick.ActorScreen('{ScreenName}', function(self, ctx)
end),
underlay = gimmick.ActorScreen('{ScreenName}', function(self, ctx)
end),
header = gimmick.ActorScreen('{ScreenName}', function(self, ctx)
end),
footer = gimmick.ActorScreen('{ScreenName}', function(self, ctx)
end),
}}
""".lstrip()
screenLua.write(Lua)
screenLua.close()
ScreenParts = [
{ 'type': 'BGAnimations', 'name': 'overlay' },
{ 'type': 'BGAnimations', 'name': 'underlay' },
{ 'type': 'Graphics', 'name': 'header' },
{ 'type': 'Graphics', 'name': 'footer' },
]
for fuck in ScreenParts:
file = open(f"./{fuck['type']}/{ScreenName} {fuck['name']}.xml",'x')
file.write(
"""
<ActorFrame InitCommand="%gimmick.s.{ScreenName}.{fuck}.init"><children>
<Layer File="../actors.xml" InitCommand="%gimmick.s.{ScreenName}.{fuck}.initEnd"/>
</children></ActorFrame>
""".format(ScreenName=ScreenName,fuck=fuck['name']).lstrip()
)
file.close()
cecho(f"Wrote to {ScreenName} {fuck['name']}.xml")
print('')
print('If your Screen Class requires specific parameters in metrics.ini you will have to add them manually!')
@cli.command()
@click.option('-v',help='Verbose',is_flag=True)
#v is just verbose
def list(v):
"""List All Screens currently defined in metrics.ini"""
def cecho(str):
if (v):
click.echo(" "+str)
metrics = open('metrics.ini','r')
count = 0
ScreenCount = 0
while True:
count += 1
# Get next line from file
line = metrics.readline()
# if line is empty
# end of file is reached
if not line:
print('Total Screens: '+str(ScreenCount))
break
if line.startswith('[Screen'):
ScreenCount += 1
print(line.strip())
if __name__ == '__main__':
cli()