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

0001 /* GCompris - Clickgame.qml
0002  *
0003  * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
0004  *
0005  * Authors:
0006  *   Bruno Coudoin <bruno.coudoin@gcompris.net> (GTK+ version)
0007  *   Bruno Coudoin <bruno.coudoin@gcompris.net> (Qt Quick port)
0008  *   Timothée Giet <animtim@gmail.com> (animation refactoring)
0009  *
0010  *   SPDX-License-Identifier: GPL-3.0-or-later
0011  */
0012 import QtQuick 2.12
0013 import GCompris 1.0
0014 import "../../core"
0015 import "clickgame.js" as Activity
0016 
0017 ActivityBase {
0018     id: activity
0019     focus: true
0020 
0021     onStart: {}
0022     onStop: {}
0023 
0024     pageComponent: Image {
0025         id: background
0026         signal start
0027         signal stop
0028         signal animTrigger
0029         focus: true
0030         fillMode: Image.PreserveAspectCrop
0031         source: "qrc:/gcompris/src/activities/clickgame/resource/sea1.webp"
0032         sourceSize.width: width
0033         sourceSize.height: height
0034 
0035         Component.onCompleted: {
0036             activity.start.connect(start)
0037             activity.stop.connect(stop)
0038         }
0039         onStart: { Activity.start(activity, background, bar, bonus, items) }
0040         onStop: {
0041             Activity.stop()
0042             timer.stop()
0043             fishAnimation.stop()
0044         }
0045 
0046         QtObject {
0047             id: items
0048             property alias score: score
0049             property alias killedFishes: score.currentSubLevel
0050             property int currentLevel: activity.currentLevel
0051         }
0052 
0053         Timer {
0054             id: timer
0055             interval: 5000
0056             running: true
0057             repeat: true
0058             onTriggered: activity.audioEffects.play("qrc:/gcompris/src/activities/clickgame/resource/bubble.wav")
0059         }
0060 
0061         Timer {
0062             id: fishAnimation
0063             interval: 10
0064             running: true
0065             repeat: true
0066             onTriggered: background.animTrigger()
0067         }
0068 
0069         DialogHelp {
0070             id: dialogHelpLeftRight
0071             onClose: home()
0072         }
0073 
0074         Score {
0075             id: score
0076 
0077             anchors {
0078                 top: parent.top
0079                 bottom: undefined
0080                 right: parent.right
0081                 margins: 10 * ApplicationInfo.ratio
0082             }
0083         }
0084 
0085         Bar {
0086             id: bar
0087             level: items.currentLevel + 1
0088             content: BarEnumContent { value: help | home | level }
0089             onHelpClicked: {
0090                 displayDialog(dialogHelpLeftRight)
0091             }
0092             onPreviousLevelClicked: Activity.previousLevel()
0093             onNextLevelClicked: Activity.nextLevel()
0094             onHomeClicked: home()
0095         }
0096 
0097         Bonus {
0098             id: bonus
0099             Component.onCompleted: win.connect(Activity.nextLevel)
0100         }
0101     }
0102 
0103 }