Warning, /education/gcompris/src/activities/followline/LinePart.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - LinePart.qml
0002  *
0003  * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
0004  *
0005  * Authors:
0006  *   Bruno Coudoin <bruno.coudoin@gcompris.net>
0007  *
0008  *   SPDX-License-Identifier: GPL-3.0-or-later
0009  */
0010 import QtQuick 2.12
0011 import "../../core"
0012 import "followline.js" as Activity
0013 
0014 Item {
0015     id: part
0016     property QtObject items
0017     property int index: 0
0018     property GCSfx audioEffects
0019     property bool isPart: true
0020 
0021     Rectangle {
0022         anchors.horizontalCenter: parent.horizontalCenter
0023         anchors.verticalCenter: parent.verticalCenter
0024         anchors.verticalCenterOffset: - parent.height / 2
0025         width: parent.width
0026         height: parent.height * 0.2
0027         radius: height / 8
0028         color: "#30354e"
0029         z: 10
0030     }
0031 
0032     Rectangle {
0033         anchors.horizontalCenter: parent.horizontalCenter
0034         anchors.verticalCenter: parent.verticalCenter
0035         anchors.horizontalCenterOffset: - parent.width * 0.1
0036         anchors.verticalCenterOffset: 0
0037         width: parent.width * 1.2
0038         height: parent.height * 0.9
0039         radius: height / 4
0040         z: 5
0041         color: index < part.items.currentLock
0042                ? "#3ca7e0"
0043                : index === part.items.currentLock
0044                  ? "#dd3128"
0045                  : "#7A7F8E"
0046 
0047         MouseArea {
0048             anchors.fill: parent
0049             hoverEnabled: true
0050             onEntered: {
0051                 if(part.items.currentLock <= part.index && !Activity.movedOut) {
0052                     part.items.currentLock = part.index
0053                     if(part.items.currentLock >= part.items.lastLock) {
0054                         audioEffects.play("qrc:/gcompris/src/core/resource/sounds/water.wav")
0055                         items.background.win()
0056                     } else {
0057                         Activity.playAudioFx();
0058                     }
0059                 } else if(part.items.currentLock >= part.index && Activity.movedOut) {
0060                     items.lineBrokenTimer.stop();
0061                     Activity.movedOut = false;
0062                 }
0063             }
0064         }
0065     }
0066 
0067     Rectangle {
0068         anchors.horizontalCenter: parent.horizontalCenter
0069         anchors.verticalCenter: parent.verticalCenter
0070         anchors.verticalCenterOffset: parent.height / 2
0071         width: parent.width
0072         height: parent.height * 0.2
0073         radius: height / 8
0074         color: "#30354e"
0075         z: 10
0076     }
0077 }