-
Notifications
You must be signed in to change notification settings - Fork 1
/
QtValues.qml
110 lines (94 loc) · 2.53 KB
/
QtValues.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import QtQuick 2.2
import "gui/blocks"
QtObject {
property double blockSize
property bool initiated: false
property bool running: !paused && started && !gameOver && !waiting
property bool paused: false
property bool waiting: false
property bool started: false
property bool gameOver: false
property bool debug: false
property int score: 0
property int lines: 0
property int level: 0
property int deltaTime: 1000
property int comboScore: 0
property int highscore: 0
property bool nowHighscore: highscore < score
property int musicVolume
property int fxVolume
property int startingLevel: 1
property int sensitivity: 5
property Item gameCanvas
property Shape currentPiece: Shape
property Shape nextPiece: Shape
property Shape storedPiece: Shape
signal run(bool running)
signal init()
onRunningChanged: {
print("QtValues::onRunningChanged():"+running)
if(running) {
}
run(running)
}
onPausedChanged: {
print("QtValues::onPausedChanged():"+paused)
if(paused) {
}
}
onWaitingChanged: {
print("QtValues::onWaitingChanged():"+waiting)
if(waiting) {
}
}
onStartedChanged: {
print("QtValues::onStartedChanged():"+started)
if(started) {
gameOver = false
}
}
onGameOverChanged: {
print("QtValues::onGameOverChanged():"+gameOver)
if(gameOver) {
paused = false;
started = false;
}
}
onInit: {
paused = false
waiting = false
started = false
gameOver = false
score = 0
lines = 0
level = 0
deltaTime = 1000
highscore = mainDbObj.highScore.score
{
var tempContents = mainDbObj.volumes.contents
if(typeof tempContents["music"] != "undefined") {
musicVolume = tempContents["music"]
}
else {
musicVolume = 7
}
if(typeof tempContents["fx"] != "undefined") {
fxVolume = tempContents["fx"]
}
else {
fxVolume = 5
}
}
{
var tempContents = mainDbObj.settings.contents
if(typeof tempContents["dropsens"] != "undefined") {
sensitivity = tempContents["dropsens"]
}
else {
sensitivity = 5
}
}
initiated = true
}
}