Changeset View
Changeset View
Standalone View
Standalone View
src/activities/planegame/Planegame.qml
Show All 23 Lines | |||||
24 | 24 | | |||
25 | import "../../core" | 25 | import "../../core" | ||
26 | import "planegame.js" as Activity | 26 | import "planegame.js" as Activity | ||
27 | 27 | | |||
28 | ActivityBase { | 28 | ActivityBase { | ||
29 | id: activity | 29 | id: activity | ||
30 | focus: true | 30 | focus: true | ||
31 | 31 | | |||
32 | onStart: { focus = true; } | 32 | onStart: { focus = true; } | ||
jjazeix: why this change? | |||||
33 | onStop: { } | 33 | onStop: { } | ||
34 | 34 | | |||
35 | Keys.onPressed: Activity.processPressedKey(event) | 35 | Keys.onPressed: Activity.processPressedKey(event) | ||
36 | Keys.onReleased: Activity.processReleasedKey(event) | 36 | Keys.onReleased: Activity.processReleasedKey(event) | ||
37 | 37 | | |||
jjazeix: it should be on the pageComponent | |||||
38 | property var dataset | 38 | property var dataset | ||
39 | property var tutorialInstructions | ||||
40 | property bool showTutorial: false | ||||
39 | 41 | | |||
40 | property int oldWidth: width | 42 | property int oldWidth: width | ||
you should avoir naming it the same as the image just above. jjazeix: you should avoir naming it the same as the image just above.
Where is it used? | |||||
41 | onWidthChanged: { | 43 | onWidthChanged: { | ||
42 | // Reposition helico and clouds, same for height | 44 | // Reposition helico and clouds, same for height | ||
43 | Activity.repositionObjectsOnWidthChanged(width / oldWidth) | 45 | Activity.repositionObjectsOnWidthChanged(width / oldWidth) | ||
44 | oldWidth = width | 46 | oldWidth = width | ||
45 | } | 47 | } | ||
46 | 48 | | |||
47 | property int oldHeight: height | 49 | property int oldHeight: height | ||
48 | onHeightChanged: { | 50 | onHeightChanged: { | ||
49 | // Reposition helico and clouds, same for height | 51 | // Reposition helico and clouds, same for height | ||
50 | Activity.repositionObjectsOnHeightChanged(height / oldHeight) | 52 | Activity.repositionObjectsOnHeightChanged(height / oldHeight) | ||
51 | oldHeight = height | 53 | oldHeight = height | ||
52 | } | 54 | } | ||
53 | 55 | | |||
54 | pageComponent: Image { | 56 | pageComponent: Image { | ||
55 | id: background | 57 | id: background | ||
56 | anchors.fill: parent | 58 | anchors.fill: parent | ||
57 | signal start | 59 | signal start | ||
58 | signal stop | 60 | signal stop | ||
59 | source: Activity.url + "../algorithm/resource/desert_scene.svg" | 61 | source: Activity.url + "../algorithm/resource/desert_scene.svg" | ||
60 | sourceSize.width: parent.width | 62 | sourceSize.width: parent.width | ||
61 | 63 | | |||
62 | Component.onCompleted: { | 64 | Component.onCompleted: { | ||
63 | activity.start.connect(start) | 65 | activity.start.connect(start) | ||
64 | activity.stop.connect(stop) | 66 | activity.stop.connect(stop) | ||
jjazeix: why this change? | |||||
65 | } | 67 | } | ||
68 | | ||||
66 | QtObject { | 69 | QtObject { | ||
67 | id: items | 70 | id: items | ||
68 | property alias background: background | 71 | property alias background: background | ||
69 | property alias bar: bar | 72 | property alias bar: bar | ||
70 | property alias bonus: bonus | 73 | property alias bonus: bonus | ||
71 | property alias score: score | 74 | property alias score: score | ||
72 | property alias plane: plane | 75 | property alias plane: plane | ||
73 | property GCAudio audioVoices: activity.audioVoices | 76 | property GCAudio audioVoices: activity.audioVoices | ||
74 | property GCSfx audioEffects: activity.audioEffects | 77 | property GCSfx audioEffects: activity.audioEffects | ||
75 | property alias movePlaneTimer: movePlaneTimer | 78 | property alias movePlaneTimer: movePlaneTimer | ||
76 | property alias cloudCreation: cloudCreation | 79 | property alias cloudCreation: cloudCreation | ||
80 | property bool showTutorial: activity.showTutorial | ||||
81 | } | ||||
amankumargupta: Extra empty line | |||||
82 | | ||||
83 | onStart: { Activity.start(items, dataset) } | ||||
84 | onStop: { Activity.stop() } | ||||
85 | | ||||
86 | //Tutorial section starts | ||||
87 | Loader { | ||||
amankumargupta: space after ':' | |||||
88 | active: showTutorial | ||||
89 | anchors.fill: parent | ||||
90 | z: 1 | ||||
91 | sourceComponent: tutorialComponent | ||||
92 | Component { | ||||
93 | id: tutorialComponent | ||||
94 | Image { | ||||
95 | id: tutorialImage | ||||
96 | source: "../digital_electricity/resource/texture01.png" | ||||
97 | anchors.fill: parent | ||||
98 | fillMode: Image.Tile | ||||
99 | Tutorial { | ||||
100 | id: tutorialSection | ||||
101 | tutorialDetails: tutorialInstructions | ||||
102 | useImage: false | ||||
103 | onSkipPressed: { | ||||
104 | showTutorial = false | ||||
105 | Activity.initLevel() | ||||
77 | } | 106 | } | ||
78 | onStart: Activity.start(items, dataset) | 107 | } | ||
79 | onStop: Activity.stop(); | 108 | } | ||
109 | } | ||||
110 | } | ||||
111 | // Tutorial section ends | ||||
80 | 112 | | |||
81 | MultiPointTouchArea { | 113 | MultiPointTouchArea { | ||
82 | anchors.fill: parent | 114 | anchors.fill: parent | ||
83 | touchPoints: [ TouchPoint { id: point1 } ] | 115 | touchPoints: [ TouchPoint { id: point1 } ] | ||
84 | 116 | | |||
85 | onReleased: { | 117 | onReleased: { | ||
86 | plane.x = point1.x - plane.width / 2 | 118 | plane.x = point1.x - plane.width / 2 | ||
87 | plane.y = point1.y - plane.height / 2 | 119 | plane.y = point1.y - plane.height / 2 | ||
88 | } | 120 | } | ||
89 | } | 121 | } | ||
jjazeix: indentation | |||||
90 | 122 | | |||
91 | DialogHelp { | 123 | DialogHelp { | ||
92 | id: dialogHelp | 124 | id: dialogHelp | ||
93 | onClose: home() | 125 | onClose: home() | ||
94 | } | 126 | } | ||
95 | 127 | | |||
96 | Bar { | 128 | Bar { | ||
97 | id: bar | 129 | id: bar | ||
98 | content: BarEnumContent { value: help | home | level } | 130 | content: BarEnumContent { value: help | home | level } | ||
99 | onHelpClicked: displayDialog(dialogHelp) | 131 | onHelpClicked: displayDialog(dialogHelp) | ||
100 | onPreviousLevelClicked: Activity.previousLevel() | 132 | onPreviousLevelClicked: if(showTutorial === false) { | ||
101 | onNextLevelClicked: Activity.nextLevel() | 133 | Activity.previousLevel() | ||
134 | } | ||||
135 | onNextLevelClicked: if(showTutorial === false) { | ||||
136 | Activity.nextLevel() | ||||
137 | } | ||||
102 | onHomeClicked: activity.home() | 138 | onHomeClicked: activity.home() | ||
103 | } | 139 | } | ||
104 | 140 | | |||
105 | Bonus { | 141 | Bonus { | ||
106 | id: bonus | 142 | id: bonus | ||
107 | Component.onCompleted: win.connect(Activity.nextLevel) | 143 | Component.onCompleted: win.connect(Activity.nextLevel) | ||
108 | } | 144 | } | ||
109 | 145 | | |||
110 | Score { | 146 | Score { | ||
111 | id: score | 147 | id: score | ||
112 | visible: false | | |||
113 | fontSize: background.width >= background.height ? internalTextComponent.largeSize : internalTextComponent.mediumSize | 148 | fontSize: background.width >= background.height ? internalTextComponent.largeSize : internalTextComponent.mediumSize | ||
114 | height: internalTextComponent.height + 10 | 149 | height: internalTextComponent.height + 10 | ||
115 | anchors.bottom: bar.top | 150 | anchors.bottom: bar.top | ||
116 | anchors.margins: 10 | 151 | anchors.margins: 10 | ||
152 | visible: !showTutorial | ||||
117 | } | 153 | } | ||
118 | 154 | | |||
119 | property int movePlaneTimerCounter: 0 | 155 | property int movePlaneTimerCounter: 0 | ||
120 | Timer { | 156 | Timer { | ||
121 | id: movePlaneTimer | 157 | id: movePlaneTimer | ||
122 | running: false | 158 | running: false | ||
123 | repeat: true | 159 | repeat: true | ||
124 | onTriggered: { | 160 | onTriggered: { | ||
Show All 13 Lines | 172 | Timer { | |||
138 | running: false | 174 | running: false | ||
139 | repeat: true | 175 | repeat: true | ||
140 | interval: 10200 - (bar.level * 200) | 176 | interval: 10200 - (bar.level * 200) | ||
141 | onTriggered: Activity.createCloud() | 177 | onTriggered: Activity.createCloud() | ||
142 | } | 178 | } | ||
143 | 179 | | |||
144 | Plane { | 180 | Plane { | ||
145 | id: plane | 181 | id: plane | ||
182 | visible: !showTutorial | ||||
146 | background: background | 183 | background: background | ||
147 | } | 184 | } | ||
148 | 185 | | |||
149 | } | 186 | } | ||
150 | } | 187 | } |
why this change?