Skip to content

Commit b9317a5

Browse files
committed
APWorld Update Stuff
1 parent 7a19d70 commit b9317a5

File tree

4 files changed

+52
-5
lines changed

4 files changed

+52
-5
lines changed

source/archipelago/APEntryState.hx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,23 @@ class APEntryState extends MusicBeatState
474474
return {status: "unsupported", message: "System not supported."};
475475
}
476476

477-
public static function checkAndAlertAPWorld():Void
477+
public static function checkAndAlertAPWorld():Bool
478478
{
479479
var result = checkAPWorld();
480480
if (result.status == "outdated") {
481481
Application.current.window.alert(result.message + "\nPlease update it in the AP Menu.", "APWorld Update Recommended");
482482
}
483+
else if (result.status == "missing") {
484+
Application.current.window.alert(result.message + "\nPlease install it in the AP Menu.", "APWorld Missing");
485+
}
486+
else if (result.status == "error") {
487+
Application.current.window.alert(result.message, "APWorld Error");
488+
}
489+
else if (result.status == "unsupported") {
490+
Application.current.window.alert(result.message + "\nYou cannot use AP on this System.", "Unsupported Error");
491+
}
492+
493+
return result.status == "exact";
483494
}
484495

485496
public static function installAPWorld():Void

source/states/FirstCheckState.hx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class FirstCheckState extends MusicBeatState
114114
trace('versions arent matching!');
115115
MusicBeatState.switchState(new states.OutdatedState());
116116
}
117-
else FlxG.switchState(new states.SplashScreen());
117+
else FlxG.switchState(new APCheckState());
118118
}
119119

120120
http.onError = function(error)
@@ -137,7 +137,41 @@ class FirstCheckState extends MusicBeatState
137137
updateRibbon.alpha = 1;
138138
});
139139

140-
archipelago.APEntryState.checkAndAlertAPWorld();
140+
141+
}
142+
else
143+
{
144+
FlxG.switchState(new states.SplashScreen());
145+
}
146+
}
147+
}
148+
149+
class APCheckState extends MusicBeatState
150+
{
151+
override public function create()
152+
{
153+
super.create();
154+
if (!archipelago.APEntryState.checkAndAlertAPWorld())
155+
{
156+
var update = new haxe.ui.containers.dialogs.MessageBox();
157+
update.title = "Archipelago World";
158+
update.text = "Would you like to install the version of the APWorld for this version of Mixtape Engine?";
159+
update.buttons = haxe.ui.containers.dialogs.Dialog.DialogButton.YES | haxe.ui.containers.dialogs.Dialog.DialogButton.NO;
160+
161+
update.onDialogClosed = function(event:haxe.ui.containers.dialogs.Dialog.DialogEvent)
162+
{
163+
if (event.button == haxe.ui.containers.dialogs.Dialog.DialogButton.YES)
164+
{
165+
archipelago.APEntryState.installAPWorld();
166+
FlxG.switchState(new states.SplashScreen());
167+
}
168+
else
169+
{
170+
FlxG.switchState(new states.SplashScreen());
171+
}
172+
};
173+
174+
update.show();
141175
}
142176
else
143177
{

source/states/OutdatedState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class OutdatedState extends MusicBeatState
5151
FlxG.sound.play(Paths.sound('cancelMenu'));
5252
FlxTween.tween(warnText, {alpha: 0}, 1, {
5353
onComplete: function (twn:FlxTween) {
54-
MusicBeatState.switchState(new What());
54+
MusicBeatState.switchState(new states.FirstCheckState.APCheckState());
5555
}
5656
});
5757
}
5858
}
59-
else MusicBeatState.switchState(new What());
59+
else MusicBeatState.switchState(new states.FirstCheckState.APCheckState());
6060
super.update(elapsed);
6161
}
6262
}

source/states/PlayState.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,6 +2046,8 @@ class PlayState extends MusicBeatState
20462046

20472047
private function generateSong():Void
20482048
{
2049+
2050+
20492051
// FlxG.log.add(ChartParser.parse());
20502052
songSpeed = PlayState.SONG.speed;
20512053
songSpeedType = ClientPrefs.getGameplaySetting('scrolltype');

0 commit comments

Comments
 (0)