92 lines
1.7 KiB
QML
92 lines
1.7 KiB
QML
|
import QtQuick 2.9
|
||
|
import QtQuick.Window 2.2
|
||
|
import QtQuick.Controls 2.4
|
||
|
|
||
|
import com.itsblue.qcookieclicker 1.0
|
||
|
|
||
|
import "./components"
|
||
|
|
||
|
Window {
|
||
|
visible: true
|
||
|
width: 540
|
||
|
height: 960
|
||
|
title: "QcookieClicker"
|
||
|
|
||
|
Page {
|
||
|
id: app
|
||
|
|
||
|
property int level: settings.read("score")
|
||
|
|
||
|
anchors.fill: parent
|
||
|
|
||
|
AppSettings {
|
||
|
id: settings
|
||
|
}
|
||
|
|
||
|
Label {
|
||
|
id: levelLa
|
||
|
|
||
|
anchors {
|
||
|
top: parent.top
|
||
|
horizontalCenter: parent.horizontalCenter
|
||
|
topMargin: 20
|
||
|
}
|
||
|
|
||
|
font.pixelSize: 30
|
||
|
|
||
|
text: app.level
|
||
|
}
|
||
|
|
||
|
GameButton {
|
||
|
id: cookieBt
|
||
|
|
||
|
imageSrc: "qrc:/icons/cookie.png"
|
||
|
|
||
|
anchors.centerIn: parent
|
||
|
|
||
|
height: parent.width * 0.6
|
||
|
|
||
|
onClicked: {
|
||
|
settings.write("score", parseInt(settings.read("score")) + 1)
|
||
|
app.level = settings.read("score")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Row {
|
||
|
id: menuRo
|
||
|
|
||
|
anchors {
|
||
|
bottom: parent.bottom
|
||
|
bottomMargin: parent.height * 0.025
|
||
|
horizontalCenter: parent.horizontalCenter
|
||
|
}
|
||
|
|
||
|
height: parent.height * 0.1
|
||
|
|
||
|
GameButton {
|
||
|
id: shopBt
|
||
|
|
||
|
imageSrc: "qrc:/icons/shop.png"
|
||
|
|
||
|
height: parent.height
|
||
|
|
||
|
onClicked: {
|
||
|
shopPu.open()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ShopPopup {
|
||
|
id: shopPu
|
||
|
|
||
|
x: ( parent.width - width ) / 2
|
||
|
y: ( parent.height - height ) / 2
|
||
|
|
||
|
width: parent.width * 0.8
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|