FreeKill/qml/Logic.js
Notify-ctrl d2315c7533 Basic roomscene (#1)
* create Photo

* Room layout, img, debug
2022-03-27 15:12:00 +08:00

34 lines
829 B
JavaScript

var callbacks = {}
callbacks["ErrorMsg"] = function(jsonData) {
toast.show(jsonData);
mainWindow.busy = false;
}
callbacks["EnterLobby"] = function(jsonData) {
// depth == 1 means the lobby page is not present in mainStack
if (mainStack.depth === 1) {
mainStack.push(lobby);
}
mainWindow.busy = false;
}
callbacks["EnterRoom"] = function(jsonData) {
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],
});
});
}