GameNetworkExample
import Felgo 3.0
import QtQuick 2.0
TestBase {
property bool textInputForLeaderboardInput: false
Column {
SimpleButton {
text: "Report Higher Score: " + (highscore+1).toString()
onClicked: {
gameNetwork.reportScore(highscore+1)
}
}
SimpleButton {
text: "Get User Score"
onClicked: {
gameNetwork.api.getUserScore()
}
}
SimpleButton {
text: "Get Leaderboard Scores"
onClicked: {
gameNetwork.api.getLeaderboardScores()
}
}
SimpleButton {
text: "Change Leaderboard"
onClicked: {
textInputForLeaderboardInput = true
nativeUtils.displayTextInput("Enter Leaderboard", "", "", gameNetwork.currentActiveLeaderboard)
}
}
Connections {
target: nativeUtils
onTextInputFinished: {
if(textInputForLeaderboardInput && accepted) {
gameNetwork.currentActiveLeaderboard = enteredText
}
textInputForLeaderboardInput = false
}
}
SimpleButton {
text: "Show Leaderboard"
onClicked: {
gameNetwork.showLeaderboard()
}
}
SimpleButton {
text: "Report Slider Score " + Math.round(scoreSlider.value)
onClicked: {
gameNetwork.reportScore(Math.round(scoreSlider.value))
}
}
SimpleButton {
text: "Report Relative Slider Score " + Math.round(scoreSlider.value)
onClicked: {
gameNetwork.reportRelativeScore(Math.round(scoreSlider.value))
}
}
GameSlider {
id: scoreSlider
minimumValue: -100
maximumValue: 100
value: 10
width: 200
height: 20
}
Text {
text: "highscore: " + highscore + "\ncurrentLB: " + gameNetwork.currentActiveLeaderboard
color: "white"