Stack With Friends Demo
import QtQuick 2.0
import Felgo 3.0
import "AchievementQueue.js" as AchievementQueue
SceneBase {
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.gameWindowAnchorItem.width
height: 130
anchors.left: parent.gameWindowAnchorItem.left
anchors.top: parent.gameWindowAnchorItem.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: 12
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 8
}
Text {
text: achievement ? achievement.name : ""
color: "white"
font.pixelSize: 21
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 36
}
Text {
text: achievement ? achievement.description : ""
color: "white"
font.pixelSize: 8
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 60
}
Text {
text: achievement ? "You earned " + achievement.points + " new credits!" : ""
color: "white"
font.pixelSize: 12
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 75
}
Text {
text: "Keep on unlocking new achievements to get even more credits..."
color: "white"
font.pixelSize: 10
font.family: fontHUD.name
anchors.horizontalCenter: parent.horizontalCenter
y: 108
}
Text {
text: "X"
color: "#444444"
font.pixelSize: 30
anchors.right: parent.right
font.family: fontHUD.name
anchors.rightMargin: 8