1
/* GCompris - braille_fun.js
3
* Copyright (C) 2014 Arkit Vora <arkitvora123@gmail.com>
6
* Srishti Sethi (GTK+ version)
7
* Arkit Vora <arkitvora123@gmail.com> (Qt Quick port)
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 3 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, see <https://www.gnu.org/licenses/>.
23
.import QtQuick 2.6 as Quick
24
.import "qrc:/gcompris/src/core/core.js" as Core
31
var set = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
32
var questionArray = [];
34
var url = "qrc:/gcompris/src/activities/braille_fun/resource/"
36
function start(items_ ) {
46
function initQuestion() {
47
items.question = questionArray[currentQuestion]
48
items.charBg.clickable(true)
49
items.charBg.clearAllLetters()
50
items.animateX.restart()
53
function nextQuestion() {
54
if(++currentQuestion == set.length) {
61
function initLevel() {
62
items.bar.level = currentLevel + 1
64
items.score.numberOfSubLevels = set.length;
65
items.score.currentSubLevel = 0;
68
switch(currentLevel) {
70
for(var i = 0; i < set.length; i++) {
71
questionArray[i] = set[i];
75
for(var i = 0; i < set.length; i++) {
76
questionArray[i] = set[i] +
77
set[Math.floor(Math.random() * set.length)];
81
for(var i = 0; i < set.length; i++) {
82
questionArray[i] = set[i] +
83
set[Math.floor(Math.random() * set.length)] +
84
set[Math.floor(Math.random() * set.length)];
90
items.cardRepeater.model = currentLevel + 1;
93
function nextLevel() {
94
if(numberOfLevel <= ++currentLevel ) {
100
function previousLevel() {
101
if(--currentLevel < 0) {
102
currentLevel = numberOfLevel - 1