Changeset View
Changeset View
Standalone View
Standalone View
src/activities/clockgame/Clockgame.qml
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 37 | pageComponent: Image { | |||
---|---|---|---|---|---|
72 | onStart: { | 72 | onStart: { | ||
73 | Activity.start(items) | 73 | Activity.start(items) | ||
74 | } | 74 | } | ||
75 | onStop: { | 75 | onStop: { | ||
76 | Activity.stop() | 76 | Activity.stop() | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | Score { | 79 | Score { | ||
80 | id: score | ||||
80 | anchors { | 81 | anchors { | ||
81 | bottom: bar.top | 82 | bottom: bar.top | ||
82 | bottomMargin: 10 * ApplicationInfo.ratio | 83 | bottomMargin: 10 * ApplicationInfo.ratio | ||
83 | right: bar.right | 84 | right: bar.right | ||
84 | rightMargin: 10 * ApplicationInfo.ratio | 85 | rightMargin: 10 * ApplicationInfo.ratio | ||
85 | left: parent.left | 86 | left: parent.left | ||
86 | leftMargin: 10 * ApplicationInfo.ratio | 87 | leftMargin: 10 * ApplicationInfo.ratio | ||
87 | top: undefined | 88 | top: undefined | ||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Line(s) | 415 | if (dh === dmin) { | |||
415 | Activity.selectedArrow = h | 416 | Activity.selectedArrow = h | ||
416 | } else if (dm === dmin) { | 417 | } else if (dm === dmin) { | ||
417 | Activity.selectedArrow = m | 418 | Activity.selectedArrow = m | ||
418 | } else { | 419 | } else { | ||
419 | Activity.selectedArrow = s | 420 | Activity.selectedArrow = s | ||
420 | } | 421 | } | ||
421 | } | 422 | } | ||
422 | 423 | | |||
423 | onReleased: { | | |||
424 | Activity.selectedArrow = null | | |||
425 | //todo replace this with Ok button | | |||
426 | if (items.currentH === items.targetH | | |||
427 | && items.currentM === items.targetM | | |||
428 | && items.currentS === items.targetS) { | | |||
429 | items.bonus.good("gnu") | | |||
430 | } | | |||
431 | } | | |||
432 | | ||||
433 | onMouseXChanged: { | 424 | onMouseXChanged: { | ||
434 | /* Move */ | 425 | /* Move */ | ||
435 | if (Activity.selectedArrow !== null) { | 426 | if (Activity.selectedArrow !== null) { | ||
436 | var a = (270 + 360 + 180 * Math.atan2( | 427 | var a = (270 + 360 + 180 * Math.atan2( | ||
437 | mouseY - (center.y + center.height / 2), | 428 | mouseY - (center.y + center.height / 2), | ||
438 | mouseX - (center.x + center.width / 2)) / Math.PI) % 360 | 429 | mouseX - (center.x + center.width / 2)) / Math.PI) % 360 | ||
439 | 430 | | |||
440 | var previousM = items.currentM | 431 | var previousM = items.currentM | ||
Show All 18 Lines | 449 | if (previousM > 45 && items.currentM < 15) | |||
459 | items.currentH = (items.currentH + 1 + 12) % 12 | 450 | items.currentH = (items.currentH + 1 + 12) % 12 | ||
460 | if (previousM < 15 && items.currentM > 45) | 451 | if (previousM < 15 && items.currentM > 45) | ||
461 | items.currentH = (items.currentH - 1 + 12) % 12 | 452 | items.currentH = (items.currentH - 1 + 12) % 12 | ||
462 | } | 453 | } | ||
463 | } | 454 | } | ||
464 | } | 455 | } | ||
465 | } | 456 | } | ||
466 | 457 | | |||
458 | BarButton { | ||||
jjazeix: it would be better to have the button on the right side else it may override with the clock | |||||
459 | id: okButton | ||||
460 | source: "qrc:/gcompris/src/core/resource/bar_ok.svg" | ||||
461 | sourceSize.width: 60 * ApplicationInfo.ratio | ||||
462 | anchors.bottom: bar.top | ||||
463 | anchors.bottomMargin: parent.width * 0.03 | ||||
464 | anchors.left: score.right | ||||
465 | anchors.leftMargin: parent.width * 0.7 | ||||
466 | ParticleSystemStarLoader { | ||||
467 | id: okButtonParticles | ||||
468 | clip: false | ||||
469 | } | ||||
470 | MouseArea { | ||||
471 | id: okButtonMouseArea | ||||
472 | anchors.fill: parent | ||||
473 | onClicked: { | ||||
474 | Activity.checkAnswer() | ||||
475 | } | ||||
476 | } | ||||
477 | } | ||||
478 | | ||||
467 | DialogChooseLevel { | 479 | DialogChooseLevel { | ||
468 | id: dialogActivityConfig | 480 | id: dialogActivityConfig | ||
469 | currentActivity: activity.activityInfo | 481 | currentActivity: activity.activityInfo | ||
470 | 482 | | |||
471 | onSaveData: { | 483 | onSaveData: { | ||
472 | levelFolder = dialogActivityConfig.chosenLevels | 484 | levelFolder = dialogActivityConfig.chosenLevels | ||
473 | currentActivity.currentLevels = dialogActivityConfig.chosenLevels | 485 | currentActivity.currentLevels = dialogActivityConfig.chosenLevels | ||
474 | ApplicationSettings.setCurrentLevels(currentActivity.name, dialogActivityConfig.chosenLevels) | 486 | ApplicationSettings.setCurrentLevels(currentActivity.name, dialogActivityConfig.chosenLevels) | ||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |
it would be better to have the button on the right side else it may override with the clock