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,37 @@ showNext: false } ] + + tutorialInstructions: [ + { + "instruction": qsTr("This activity teaches about even and odd numbers."), + "instructionQml": "" + }, + { + "instruction": qsTr("What is mean by remainder of a number?"), + "instructionQml" : "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial1.qml" + }, + + { + "instruction": qsTr("Even numbers are numbers which leave remainder 0 when divided by 2."), + "instructionQml" : "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial2.qml" + }, + { + "instruction": qsTr("Odd numbers are numbers which do not leave remainder 0 when divided by 2."), + "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" + }, + { + "instruction": qsTr("Exercise: \n To test your understanding."), + "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/Tutorial6.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,47 @@ +/* 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: remainder + text: qsTr("The remainder is the amount \"left over\" after dividing the number by 2.\n" + + " If 6 is divided by 2 the result is 3 and the remainder is 0.\n " + + "If 7 is divided by 2 the result is 3 and the remainder is 1.") + fontSizeMode: Text.Fit + fontSize: mediumSize + anchors.left: tutorialRectangle.left + anchors.leftMargin: parent.height * 0.01 + color: "black" + horizontalAlignment: Text.AlignLeft + width: parent.width + height: 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,46 @@ +/* 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 divided by 2.") + fontSizeMode: Text.Fit + fontSize: mediumSize + anchors.left: tutorialRectangle.left + anchors.leftMargin: parent.height * 0.01 + color: "black" + horizontalAlignment: Text.AlignLeft + width: parent.width + height: 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,46 @@ +/* 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 divided by 2.") + fontSizeMode: Text.Fit + fontSize: mediumSize + anchors.left: tutorialRectangle.left + anchors.leftMargin: parent.height * 0.01 + color: "black" + horizontalAlignment: Text.AlignLeft + width: parent.width + height: parent.height + wrapMode: Text.WordWrap + z: 2 + } + } 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,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 { + + evenNumber: "2" + oddNumber: "5" +} 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,33 @@ +/* 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 { + + isEven: false + isOdd: true + evenNumber: isEven ? "52" : "59" + oddNumber: !isEven ? "52" : "59" +} diff --git a/src/activities/numbers-odd-even/resource/Tutorial6.qml b/src/activities/numbers-odd-even/resource/Tutorial6.qml new file mode 100644 --- /dev/null +++ b/src/activities/numbers-odd-even/resource/Tutorial6.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 { + + evenNumber: "108" + oddNumber: "111" + +} 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,155 @@ +/* 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.textLabel + property alias oddNumber: oddNumber.textLabel + property alias message: message.text + property bool isEven: true + property bool isOdd: false + + 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: isEven ? qsTr("Choose the even number") : qsTr("Choose the odd number") + fontSize: mediumSize + color: "black" + horizontalAlignment: Text.AlignLeft + width: 1.8 * parent.width + height: 1.8 * parent.height + wrapMode: Text.WordWrap + z: 2 + } + + AnswerButton { + id: oddNumber + textLabel: "" + anchors { + top: parent.top + topMargin: parent.height * 0.3 + left: parent.left + leftMargin: parent.width * 0.2 + } + width: parent.width * 0.2 + height: parent.height * 0.4 + isCorrectAnswer: !isOdd ? isOdd : isEven + onPressed: { + if(!isCorrectAnswer && !isOdd) { + message.text = qsTr("There is an error:" + + "When divided by 2, 13 is equal to 6 and remainder is 1." + + "Therefore this is an odd number.") + } + else if(!isOdd) { + message.text = qsTr("Great") + } + else { + message.text = qsTr("There is an error:" + + "When divided by 2, 14 is equal to 7 and remainder is 0." + + "Therefore this is not an odd number.") + + } + message.visible = true + messageRectangle.visible = true + } + } + + AnswerButton { + id: evenNumber + textLabel: "" + anchors { + top: parent.top + topMargin: parent.height * 0.3 + left: parent.left + leftMargin: parent.width * 0.65 + } + width: parent.width * 0.2 + height: parent.height * 0.4 + isCorrectAnswer: !isOdd ? isEven : isOdd + onPressed: { + if(isOdd) { + message.text = qsTr("Great") + } + if(isCorrectAnswer && !isOdd) { + message.text = qsTr("Great") + } + else if(!isCorrectAnswer && !isOdd) { + message.text = qsTr("There is an error:" + + "When divided by 2, 13 is equal to 6 and remainder is 1." + + "Therefore this is an odd number.") + } + message.visible = true + messageRectangle.visible = true + } + } + + Rectangle { + id: messageRectangle + anchors { + horizontalCenter: parent.horizontalCenter + top: parent.top + topMargin: parent.height * 0.75 + } + opacity: 0.8 + radius: 10 + border.width: 6 + color: "white" + border.color: "#87A6DD" + width: parent.width * 0.9 + height: parent.height * 0.4 + visible: false + GCText { + id: message + anchors { + top: messageRectangle.top + topMargin: (message.text === "Great") ? parent.height * 0.2 : 0 + left: messageRectangle.left + leftMargin: (message.text === "Great") ? parent.width * 0.45 : 0 + } + text: "" + fontSizeMode: Text.Fit + fontSize: mediumSize + color: "black" + horizontalAlignment: Text.AlignLeft + width: parent.width + height: parent.height + wrapMode: Text.WordWrap + z: 2 + + } + } +} + + + + + 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 @@ -80,7 +80,6 @@ items.movePlaneTimer.stop(); items.cloudCreation.stop() - items.score.visible = dataset[currentLevel].showNext items.score.message = dataset[currentLevel].data[currentSubLevel] upPressed = false @@ -95,16 +94,19 @@ 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(); }