ChickenOutbreak2 Demo
import QtQuick 2.0
import Felgo 4.0
import "scripts/AchievementQueue.js" as AchievementQueue
Item {
id: achievementOverlay
Behavior on opacity {
NumberAnimation { duration: 150}
}
property variant achievement
function showAchievement(ach) {
AchievementQueue.push(ach)
if(!hideAfterDelay.running) display()
}
function display() {
achievement = AchievementQueue.take()
opacity = 1
hideAfterDelay.start()
}
function hide() {
hideAfterDelay.stop()
if(AchievementQueue.size() > 0) display()
else opacity = 0
}
Timer {
id: hideAfterDelay
interval: 10000
onTriggered: achievementOverlay.hide()
}
Item {
width: parent.width
height: parent.height
anchors.left: parent.left
anchors.top: parent.top
MouseArea {
anchors.fill: parent
onClicked: achievementOverlay.hide()
}
Rectangle {
color: "black"
anchors.fill: parent
opacity: 0.8
}
Text {
text: "Congratulations, You just unlocked the achievement:"
color: "white"
font.pixelSize: 18
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 8
}
Text {
text: achievement ? achievement.name : "sdfsd"
color: "white"
font.pixelSize: 24
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 28
}
Text {
text: achievement ? achievement.description : "sdfsdgsdggdgsfdfdsfsdf"
color: "white"
font.pixelSize: 16
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 54
}
Text {
text: "X"
color: "#444444"
font.pixelSize: 30
anchors.right: parent.right
font.family: fontHUD.name
anchors.rightMargin: 8