GameNetworkExample
import QtQuick 2.0
import Felgo 3.0
Item {
id: levelDelegate
property alias levels: levelRepeater.model
signal levelClicked(int levelId)
onLevelsChanged: {
console.debug("LevelDelegate.levels changed to", JSON.stringify(levels))
}
anchors.fill: parent
Rectangle {
anchors.fill: parent
color: "grey"
}
Flickable {
id: flickable
width: parent.width
height: parent.height
contentWidth: levelListColumn.width
contentHeight: levelListColumn.height
clip: true
flickableDirection: Flickable.VerticalFlick
Column {
id: levelListColumn
width: parent.width
spacing: 5
Repeater {
id: levelRepeater
delegate: Rectangle {
width: levelDelegate.width
height: col.height
color: "white"
Component.onCompleted: {
console.debug("model in level object:", JSON.stringify(modelData))
}
Column {
id: col
width: parent.width
Text {
text: "LevelId: " + modelData.id +
"\nLevelName: " + modelData.name +
"\nDescription: " + modelData.description +
"\nAuthor: " + modelData.user.name +
"\nQuality: " + modelData.average_quality + ", Difficulty:" + modelData.average_difficulty +
"\n#Favored: " + modelData.times_favored + ", #Played: " + modelData.times_played + ", #Downloaded: " + modelData.times_downloaded +
"\nUserRating: " + JSON.stringify(modelData.rating) +
"\nData: " + JSON.stringify(modelData.data)
width: parent.width
wrapMode: Text.Wrap
}
}
MouseArea {
anchors.fill: parent
onClicked: {
console.debug("clicked level model with id:", modelData.id, ", complete model:", JSON.stringify(modelData))
levelClicked(modelData.id)
}
}
}
}
}
}
SimpleButton {
text: "Close"
anchors.right: parent.right
onClicked: parent.visible = false