-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathStageData.hx
More file actions
71 lines (63 loc) · 1.54 KB
/
StageData.hx
File metadata and controls
71 lines (63 loc) · 1.54 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
package;
import openfl.utils.Assets;
import haxe.Json;
import haxe.format.JsonParser;
import Song;
using StringTools;
typedef StageFile = {
var directory:String;
var defaultZoom:Float;
var isPixelStage:Bool;
var boyfriend:Array<Dynamic>;
var girlfriend:Array<Dynamic>;
var opponent:Array<Dynamic>;
}
class StageData {
public static var forceNextDirectory:String = null;
public static function loadDirectory(SONG:SwagSong) {
var stage:String = '';
if(SONG.stage != null) {
stage = SONG.stage;
} else if(SONG.song != null) {
switch (SONG.song.toLowerCase().replace(' ', '-'))
{
case 'spookeez' | 'south' | 'monster':
stage = 'spooky';
case 'pico' | 'blammed' | 'philly' | 'philly-nice':
stage = 'philly';
case 'milf' | 'satin-panties' | 'high':
stage = 'limo';
case 'cocoa' | 'eggnog':
stage = 'mall';
case 'winter-horrorland':
stage = 'mallEvil';
case 'senpai' | 'roses':
stage = 'school';
case 'thorns':
stage = 'schoolEvil';
default:
stage = 'stage';
}
} else {
stage = 'stage';
}
var stageFile:StageFile = getStageFile(stage);
if(stageFile == null) { //preventing crashes
forceNextDirectory = '';
} else {
forceNextDirectory = stageFile.directory;
}
}
public static function getStageFile(stage:String):StageFile {
var rawJson:String = null;
var path:String = Paths.getPreloadPath('stages/' + stage + '.json');
if(Assets.exists(path)) {
rawJson = Assets.getText(path);
}
else
{
return null;
}
return cast Json.parse(rawJson);
}
}