diff --git a/src/activities/numbers-odd-even/NumbersOddEven.qml b/src/activities/numbers-odd-even/NumbersOddEven.qml --- a/src/activities/numbers-odd-even/NumbersOddEven.qml +++ b/src/activities/numbers-odd-even/NumbersOddEven.qml @@ -21,6 +21,8 @@ Planegame { + showTutorial: true + dataset: [ { data: "0 2 4 6 8 10 12 14 16 18 20".split(" "), @@ -39,4 +41,32 @@ showNext: false } ] + + tutorialInstructions: [ + { + "instruction": qsTr("This activity teaches about even and odd numbers."), + "instructionQml": "" + }, + { + "instruction": qsTr("Even numbers are numbers which leave remainder 0 when divisible by 2."), + "instructionQml" : "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial1.qml" + }, + { + "instruction": qsTr("Odd numbers are numbers which do not leave remainder 0 when divisible by 2."), + "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial2.qml" + }, + { + "instruction": qsTr("Exercise: \n To test your understanding."), + "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial3.qml" + }, + { + "instruction": qsTr("Exercise: \n To test your understanding."), + "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial4.qml" + }, + { + "instruction": qsTr("Exercise: \n To test your understanding."), + "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial5.qml" + } + + ] } diff --git a/src/activities/numbers-odd-even/resource/Tutorial1.qml b/src/activities/numbers-odd-even/resource/Tutorial1.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/Tutorial1.qml @@ -0,0 +1,44 @@ +/* GCompris - Tutorial1.qml + * + * Copyright (C) 2019 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import GCompris 1.0 + +import "../../../core" + +Rectangle { + id: tutorialRectangle + anchors.fill: parent + color: "#80FFFFFF" + + GCText { + id: even + text: qsTr("For example: 12, 38, 52, 68, 102, 118, 168, 188, 502, 532, 700, 798, 842, 892 ,1000. All of these numbers are even numbers as they leave remainder 0 when divisible by 2.") + font.pointSize: parent.height * 0.07 + anchors.left: tutorialRectangle.left + anchors.leftMargin: parent.height * 0.3 + color: "black" + horizontalAlignment: Text.AlignLeft + width: Math.min(implicitWidth, 0.8 * parent.width) + height: Math.min(implicitHeight, 0.5 * parent.height) + wrapMode: Text.WordWrap + z: 2 + } +} diff --git a/src/activities/numbers-odd-even/resource/Tutorial2.qml b/src/activities/numbers-odd-even/resource/Tutorial2.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/Tutorial2.qml @@ -0,0 +1,44 @@ +/* GCompris - Tutorial2.qml + * + * Copyright (C) 2019 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import GCompris 1.0 + +import "../../../core" + +Rectangle { + id: tutorialRectangle + anchors.fill: parent + color: "#80FFFFFF" + + GCText { + id: odd + text: qsTr("For example: 15, 19, 51, 65, 103, 119, 169, 185, 505, 533, 701, 799, 845, 897, 1001. All of these numbers are odd numbers as they do not leave remainder 0 when divisible by 2.") + font.pointSize: parent.height * 0.07 + anchors.left: tutorialRectangle.left + anchors.leftMargin: parent.height * 0.3 + color: "black" + horizontalAlignment: Text.AlignLeft + width: Math.min(implicitWidth, 0.8 * parent.width) + height: Math.min(implicitHeight, 0.5 * parent.height) + wrapMode: Text.WordWrap + z: 2 + } + } diff --git a/src/activities/numbers-odd-even/resource/Tutorial3.qml b/src/activities/numbers-odd-even/resource/Tutorial3.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/Tutorial3.qml @@ -0,0 +1,31 @@ +/* GCompris - Tutorial3.qml + + * + * Copyright (C) 2019 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import GCompris 1.0 + +import "../../../core" + +TutorialBase { + order: 3 + evenNumber: "2" + oddNumber: "5" +} diff --git a/src/activities/numbers-odd-even/resource/Tutorial4.qml b/src/activities/numbers-odd-even/resource/Tutorial4.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/Tutorial4.qml @@ -0,0 +1,32 @@ +/* GCompris - Tutorial4.qml + + * + * Copyright (C) 2019 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import GCompris 1.0 + +import "../../../core" + +TutorialBase { + order: 4 + question: qsTr("Choose the odd number") + evenNumber: "59" + oddNumber: "52" +} diff --git a/src/activities/numbers-odd-even/resource/Tutorial5.qml b/src/activities/numbers-odd-even/resource/Tutorial5.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/Tutorial5.qml @@ -0,0 +1,31 @@ +/* GCompris - Tutorial5.qml + * + * Copyright (C) 2019 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import GCompris 1.0 + +import "../../../core" + +TutorialBase { + order: 5 + evenNumber: "111" + oddNumber: "108" + +} diff --git a/src/activities/numbers-odd-even/resource/TutorialBase.qml b/src/activities/numbers-odd-even/resource/TutorialBase.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/TutorialBase.qml @@ -0,0 +1,170 @@ +/* GCompris - TutorialBase.qml + * + * Copyright (C) 2019 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import "../../../core" + +Rectangle { + id: tutorialRectangle + anchors.fill: parent + color: "#80FFFFFF" + property alias evenNumber: evenNumber.text + property alias oddNumber: oddNumber.text + property alias message: message.text + property alias question: question.text + property int order + + GCText { + id: question + anchors { + left: parent.left + verticalCenter: parent.verticalCenter + leftMargin: parent.height * 0.1 + centerIn: parent.Center + top: parent.top + topMargin: parent.height * 0.05 + } + text: qsTr("Choose the even number") + fontSize: mediumSize + color: "black" + horizontalAlignment: Text.AlignLeft + width: 1.8 * parent.width + height: 1.8 * parent.height + wrapMode: Text.WordWrap + z: 2 + } + + Row { + spacing: parent.height * 0.8 + anchors.centerIn: parent + Rectangle { + color: "transparent" + border.color: "black" + width: 170 + height: 130 + MouseArea { + anchors.fill: parent + onClicked: { + if(order === 3 || order === 4) { + message.text = qsTr("Great") + } + else if (order === 5) { + message.text = qsTr("No,this is not an even number.") + } + messageRectangle.visible = true + message.visible = true + } + } + } + Rectangle { + color: "transparent" + border.color: "black" + width: 170 + height: 130 + MouseArea { + anchors.fill: parent + onClicked: { + if(order === 3) { + message.text = qsTr("No,this is not an even number.") + } + else if (order === 4) { + message.text = qsTr("No,this is not an odd number.") + } + else if(order === 5) { + message.text = qsTr("Great") + } + + messageRectangle.visible = true + message.visible = true + } + } + } + } + + + Row { + id: number + spacing: parent.height * 0.8 + anchors.centerIn: parent + + GCText { + id: evenNumber + text: " " + fontSize: hugeSize + } + + GCText { + id: oddNumber + text: " " + fontSize: hugeSize + } +} + + + Rectangle { + id: messageRectangle + anchors { + top: parent.top + topMargin: parent.height * 0.7 + left: parent.left + leftMargin: parent.height * 0.7 + } + opacity: 0.8 + radius: 10 + border.width: 6 + color: "white" + border.color: "#87A6DD" + width: parent.width * 0.4 + height: parent.height * 0.3 + visible: false + MouseArea { + anchors.fill: parent + onClicked: { + messageRectangle.visible = false + message.visible = false + } + } + + GCText { + id: message + anchors { + top: parent.top + topMargin: parent.height * 0.2 + left: parent.left + leftMargin: parent.height * 0.08 + } + text: "" + fontSize: largeSize + fontSizeMode: Text.Fit + color: "black" + horizontalAlignment: Text.AlignLeft + width: parent.width + height: parent.height + visible: false + z: 2 + + } + } +} + + + + + diff --git a/src/activities/planegame/Cloud.qml b/src/activities/planegame/Cloud.qml --- a/src/activities/planegame/Cloud.qml +++ b/src/activities/planegame/Cloud.qml @@ -37,7 +37,6 @@ state: "normal" fillMode: Image.PreserveAspectFit - z: 5 signal done diff --git a/src/activities/planegame/Planegame.qml b/src/activities/planegame/Planegame.qml --- a/src/activities/planegame/Planegame.qml +++ b/src/activities/planegame/Planegame.qml @@ -36,6 +36,8 @@ Keys.onReleased: Activity.processReleasedKey(event) property var dataset + property var tutorialInstructions + property bool showTutorial: false property int oldWidth: width onWidthChanged: { @@ -60,9 +62,10 @@ sourceSize.width: parent.width Component.onCompleted: { - activity.start.connect(start) - activity.stop.connect(stop) + activity.start.connect(start) + activity.stop.connect(stop) } + QtObject { id: items property alias background: background @@ -74,11 +77,37 @@ property GCSfx audioEffects: activity.audioEffects property alias movePlaneTimer: movePlaneTimer property alias cloudCreation: cloudCreation + property alias tutorialSection: tutorialSection + property alias tutorialImage: tutorialImage + } + + onStart: { Activity.start(items, dataset) } + onStop: { Activity.stop() } + + // Tutorial section starts + Image { + id: tutorialImage + source: "../digital_electricity/resource/texture01.png" + anchors.fill: parent + fillMode: Image.Tile + z: 5 + visible: showTutorial + Tutorial { + id: tutorialSection + tutorialDetails: tutorialInstructions + useImage: false + onSkipPressed: { + Activity.initLevel() + tutorialImage.visible = false + Activity.createCloud() + cloudCreation.start() + } + } } - onStart: Activity.start(items, dataset) - onStop: Activity.stop(); - MultiPointTouchArea { + //Tutorial section ends + + MultiPointTouchArea { anchors.fill: parent touchPoints: [ TouchPoint { id: point1 } ] @@ -109,11 +138,11 @@ Score { id: score - visible: false fontSize: background.width >= background.height ? internalTextComponent.largeSize : internalTextComponent.mediumSize height: internalTextComponent.height + 10 anchors.bottom: bar.top anchors.margins: 10 + visible: !tutorialImage.visible } property int movePlaneTimerCounter: 0 @@ -143,6 +172,7 @@ Plane { id: plane + visible: !tutorialImage.visible background: background } diff --git a/src/activities/planegame/planegame.js b/src/activities/planegame/planegame.js --- a/src/activities/planegame/planegame.js +++ b/src/activities/planegame/planegame.js @@ -52,7 +52,7 @@ dataset = dataset_ numberOfLevel = dataset.length currentLevel = 0 - initLevel() + initLevel() } function stop() { @@ -73,14 +73,14 @@ } function initLevel() { + items.bar.level = currentLevel + 1; currentSubLevel = 0 numberOfSubLevels = dataset[currentLevel].data.length - items.movePlaneTimer.stop(); items.cloudCreation.stop() - items.score.visible = dataset[currentLevel].showNext + items.score.message = dataset[currentLevel].data[currentSubLevel] upPressed = false @@ -95,24 +95,28 @@ items.plane.state = "init" items.movePlaneTimer.interval = 1000 items.movePlaneTimer.start(); - items.cloudCreation.start() - // Inject the first cloud now - createCloud() + if(items.tutorialImage.visible === false) { + items.score.visible = dataset[currentLevel].showNext + items.cloudCreation.start() + //Inject the first cloud now + createCloud() + + + } } function nextLevel() { if(numberOfLevel <= ++currentLevel) { currentLevel = 0 } - - initLevel(); + initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } - initLevel(); + initLevel(); } function repositionObjectsOnWidthChanged(factor) { diff --git a/src/core/Tutorial.qml b/src/core/Tutorial.qml --- a/src/core/Tutorial.qml +++ b/src/core/Tutorial.qml @@ -56,8 +56,7 @@ property var tutorialDetails /* Do we use image or qml files for illustrations */ - - property bool useImage : true + property bool useImage: true // Emitted when skipButton is clicked signal skipPressed @@ -141,8 +140,7 @@ onClicked: { ++tutorialNumber nextPressed() - } - } + } } // skipButton: It emits the skipPressed signal which calls the initLevel to close the tutorial when clicked. IntroButton { @@ -166,7 +164,7 @@ // Image component for tutorial instructions Image { id: tutorialImage - enabled: useImage + visible: useImage width: parent.width * 0.8 height: (parent.height - nextButton.height) * 0.48 fillMode: Image.PreserveAspectFit @@ -177,7 +175,7 @@ horizontalCenter: parent.horizontalCenter } } - + // Alternative QML component for tutorial instructions Loader { id: tutorialQml @@ -191,5 +189,4 @@ horizontalCenter: parent.horizontalCenter } } - }