ChickenOutbreak Demo
import QtQuick 2.0
import Felgo 4.0
SceneBase {
id: mainScene
property bool exitDialogShown: false
property bool vplayLinkShown: false
onBackButtonPressed: {
exitDialogShown = true
NativeUtils.displayMessageBox(qsTr("Really quit the game?"), "", 2);
}
Connections {
target: activeScene === mainScene ? NativeUtils : null
function onMessageBoxFinished(accepted) {
console.debug("the user confirmed the Ok/Cancel dialog with:", accepted)
if(accepted && exitDialogShown) {
Qt.quit()
} else if(accepted && vplayLinkShown) {
flurry.logEvent("MainScene.Show.VPlayWeb")
NativeUtils.openUrl("https://felgo.com/showcases/?utm_medium=game&utm_source=chickenoutbreak&utm_campaign=chickenoutbreak#chicken_outbreak");
}
exitDialogShown = false
vplayLinkShown = false
}
}
MultiResolutionImage {
source: Qt.resolvedUrl("../assets/img/mainMenuBackground.png")
anchors.centerIn: parent
}
Column {
spacing: 15
anchors.horizontalCenter: parent.horizontalCenter
y: 5
MenuText {
text: qsTr("Chicken Outbreak")
font.pixelSize: 35
}
MenuText {
text: qsTr("Highscore: ") + gameNetwork.userHighscoreForCurrentActiveLeaderboard
}
Item {
width: 1
height: 0
}
MenuButton {
text: qsTr("Play")
onClicked: window.state = "game"
textSize: 30
}
Item {
width: 1
height: 25
}
MenuButton {
visible: false
text: qsTr("Highscores")
width: 170 * 0.8
height: 60 * 0.8
onClicked: {
window.state = "gameNetwork"
gameNetwork.showLeaderboard()
}
}
MenuButton {
text: qsTr("Credits")
width: 170 * 0.8
height: 60 * 0.8
onClicked: window.state = "credits";
}
MenuButton {
text: settings.soundEnabled ? qsTr("Sound on") : qsTr("Sound off")
width: 170 * 0.8
height: 60 * 0.8
onClicked: {
settings.soundEnabled = !settings.soundEnabled
settings.musicEnabled = settings.soundEnabled
}
}
}
Image {
id: logo
anchors.right: mainScene.gameWindowAnchorItem.right
anchors.rightMargin: 10
anchors.bottom: mainScene.gameWindowAnchorItem.bottom
anchors.bottomMargin: 10
source: Qt.resolvedUrl("../assets/img/felgo-logo.png")
fillMode: Image.PreserveAspectFit
height: 55
MouseArea {
anchors.fill: parent
onClicked: {
vplayLinkShown = true
flurry.logEvent("MainScene.ShowDialog.VPlayWeb")
NativeUtils.displayMessageBox(qsTr("Felgo"), qsTr("This game is built with Felgo. The source code is available in the free Felgo SDK - so you can build your own Chicken Outbreak in minutes! Visit Felgo.net now?"), 2)
}
}
SequentialAnimation {
running: true
loops: -1
NumberAnimation { target: logo; property: "opacity"; to: 0.1; duration: 1200 }
NumberAnimation { target: logo; property: "opacity"; to: 1; duration: 1200 }
}
}
Keys.onReturnPressed: {