mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 19:58:13 +08:00
a67175f8eb
* Run room in lua * handle offline player * Better toast and other * delete useless stuff * todo: edit profile * use pch
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
var callbacks = {};
|
|
|
|
callbacks["NetworkDelayTest"] = function(jsonData) {
|
|
ClientInstance.notifyServer("Setup", JSON.stringify([
|
|
config.screenName,
|
|
config.password
|
|
]));
|
|
}
|
|
|
|
callbacks["ErrorMsg"] = function(jsonData) {
|
|
toast.show(jsonData, 5000);
|
|
mainWindow.busy = false;
|
|
}
|
|
|
|
callbacks["BackToStart"] = function(jsonData) {
|
|
while (mainStack.depth > 1) {
|
|
mainStack.pop();
|
|
}
|
|
}
|
|
|
|
callbacks["EnterLobby"] = function(jsonData) {
|
|
// depth == 1 means the lobby page is not present in mainStack
|
|
if (mainStack.depth === 1) {
|
|
mainStack.push(lobby);
|
|
} else {
|
|
mainStack.pop();
|
|
}
|
|
mainWindow.busy = false;
|
|
}
|
|
|
|
callbacks["EnterRoom"] = function(jsonData) {
|
|
config.roomCapacity = JSON.parse(jsonData)[0];
|
|
mainStack.push(room);
|
|
mainWindow.busy = false;
|
|
}
|
|
|
|
callbacks["UpdateRoomList"] = function(jsonData) {
|
|
let current = mainStack.currentItem; // should be lobby
|
|
current.roomModel.clear();
|
|
JSON.parse(jsonData).forEach(function(room) {
|
|
current.roomModel.append({
|
|
roomId: room[0],
|
|
roomName: room[1],
|
|
gameMode: room[2],
|
|
playerNum: room[3],
|
|
capacity: room[4],
|
|
});
|
|
});
|
|
}
|