2022-01-24 02:23:08 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.0
|
|
|
|
import QtQuick.Window 2.0
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-03-27 12:00:29 +00:00
|
|
|
import "Logic.js" as Logic
|
2022-01-24 02:23:08 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
2022-03-01 09:40:02 +00:00
|
|
|
property alias roomModel: roomModel
|
2022-01-24 02:23:08 +00:00
|
|
|
Component {
|
|
|
|
id: roomDelegate
|
|
|
|
|
|
|
|
Row {
|
|
|
|
spacing: 24
|
|
|
|
Text {
|
|
|
|
width: 40
|
|
|
|
text: String(roomId)
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
width: 40
|
|
|
|
text: roomName
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
width: 20
|
|
|
|
text: gameMode
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
width: 10
|
|
|
|
color: (playerNum == capacity) ? "red" : "black"
|
|
|
|
text: String(playerNum) + "/" + String(capacity)
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: "Enter"
|
|
|
|
font.underline: true
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: { parent.color = "blue" }
|
|
|
|
onExited: { parent.color = "black" }
|
2022-03-01 05:18:00 +00:00
|
|
|
onClicked: {
|
|
|
|
mainWindow.busy = true;
|
2022-03-27 06:49:41 +00:00
|
|
|
ClientInstance.notifyServer(
|
2022-03-24 13:23:42 +00:00
|
|
|
"EnterRoom",
|
2022-03-01 05:18:00 +00:00
|
|
|
JSON.stringify([roomId])
|
|
|
|
);
|
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: roomModel
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
Rectangle {
|
|
|
|
width: root.width * 0.7
|
|
|
|
height: root.height
|
|
|
|
color: "#e2e2e1"
|
|
|
|
radius: 4
|
|
|
|
Text {
|
|
|
|
text: "Room List"
|
|
|
|
}
|
|
|
|
ListView {
|
|
|
|
height: parent.height * 0.9
|
|
|
|
width: parent.width * 0.95
|
|
|
|
anchors.centerIn: parent
|
|
|
|
id: roomList
|
|
|
|
delegate: roomDelegate
|
|
|
|
model: roomModel
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
id: scrollbar
|
|
|
|
anchors.right: roomList.right
|
|
|
|
y: roomList.visibleArea.yPosition * roomList.height
|
|
|
|
width: 10
|
|
|
|
radius: 4
|
|
|
|
height: roomList.visibleArea.heightRatio * roomList.height
|
|
|
|
color: "#a89da8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2022-03-27 06:49:41 +00:00
|
|
|
Button {
|
|
|
|
text: "Edit Profile"
|
|
|
|
onClicked: {
|
2022-03-27 12:00:29 +00:00
|
|
|
globalPopup.source = "EditProfile.qml";
|
|
|
|
globalPopup.open();
|
2022-03-27 06:49:41 +00:00
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Create Room"
|
2022-03-01 05:18:00 +00:00
|
|
|
onClicked: {
|
2022-03-27 12:00:29 +00:00
|
|
|
globalPopup.source = "CreateRoom.qml";
|
|
|
|
globalPopup.open();
|
2022-03-01 05:18:00 +00:00
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Generals Overview"
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Cards Overview"
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Scenarios Overview"
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "About"
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Exit Lobby"
|
2022-03-01 05:18:00 +00:00
|
|
|
onClicked: {
|
|
|
|
toast.show("Goodbye.");
|
|
|
|
Backend.quitLobby();
|
|
|
|
mainStack.pop();
|
|
|
|
}
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-01 05:18:00 +00:00
|
|
|
Loader {
|
|
|
|
id: lobby_dialog
|
|
|
|
z: 1000
|
|
|
|
onSourceChanged: {
|
|
|
|
if (item === null)
|
|
|
|
return;
|
|
|
|
item.finished.connect(function(){
|
|
|
|
source = "";
|
|
|
|
});
|
|
|
|
item.widthChanged.connect(function(){
|
|
|
|
lobby_dialog.moveToCenter();
|
|
|
|
});
|
|
|
|
item.heightChanged.connect(function(){
|
|
|
|
lobby_dialog.moveToCenter();
|
|
|
|
});
|
|
|
|
moveToCenter();
|
|
|
|
}
|
|
|
|
|
|
|
|
function moveToCenter()
|
|
|
|
{
|
|
|
|
item.x = Math.round((root.width - item.width) / 2);
|
|
|
|
item.y = Math.round(root.height * 0.67 - item.height / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-24 02:23:08 +00:00
|
|
|
Component.onCompleted: {
|
2022-03-01 05:18:00 +00:00
|
|
|
toast.show("Welcome to FreeKill lobby!");
|
2022-01-24 02:23:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|