fix search

This commit is contained in:
RandomityGuy 2024-06-29 18:07:58 +05:30
parent b4324707f3
commit 0c9db3ea58

View file

@ -1,5 +1,6 @@
package gui; package gui;
import net.NetCommands;
import src.Marbleland; import src.Marbleland;
import h2d.Tile; import h2d.Tile;
import hxd.BitmapData; import hxd.BitmapData;
@ -22,13 +23,14 @@ class MPSearchGui extends GuiImage {
var missionList = []; var missionList = [];
if (!isCustom) { if (!isCustom) {
for (diff in MissionList.missionList["multiplayer"]) { for (diffName => diff in MissionList.missionList["multiplayer"]) {
for (mis in diff) { for (mis in diff) {
missionList.push({ missionList.push({
mis: mis, mis: mis,
name: mis.title, name: mis.title,
artist: mis.artist, artist: mis.artist,
path: mis.path path: mis.path,
difficulty: diffName,
}); });
} }
} }
@ -39,7 +41,8 @@ class MPSearchGui extends GuiImage {
mis: mis, mis: mis,
name: mis.title, name: mis.title,
artist: mis.artist, artist: mis.artist,
path: mis.path path: mis.path,
difficulty: "custom"
}); });
} }
} }
@ -130,7 +133,15 @@ class MPSearchGui extends GuiImage {
searchPlay.pressedAction = (e) -> { searchPlay.pressedAction = (e) -> {
if (selectedIdx != -1) { if (selectedIdx != -1) {
var mis = retrieveMissionList[selectedIdx]; var mis = retrieveMissionList[selectedIdx];
cast(this.parent, Canvas).marbleGame.playMission(mis.mis);
if (mis.difficulty == "custom") {
var idx = Marbleland.multiplayerMissions.indexOf(mis.mis);
NetCommands.setLobbyLevelIndex(mis.difficulty, idx);
} else {
var idx = MissionList.missionList["multiplayer"][mis.difficulty].indexOf(mis.mis);
NetCommands.setLobbyLevelIndex(mis.difficulty, idx);
}
MarbleGame.canvas.popDialog(this);
} }
} }
this.addChild(searchPlay); this.addChild(searchPlay);