Squaby Demo
import QtQuick 2.0
import Felgo 4.0
Item {
property bool __loadLevelForFirstTime: true
property bool startInLevelEditingMode: false
property variant loadedWaypoints
property url toLoadLevelUrl
property variant __toLoadLevelData
property bool __createNewLevel
function startLoadingLevel(createNewLevel, levelMetaData) {
console.debug("TwoPhaseLevelLoader: startLoadingLevel() called, createNewLevel:", createNewLevel, ", levelData:", JSON.stringify(levelMetaData))
if(scene.state !== "levelEditing" && !levelStore.noAdsGood.purchased) {
chartboostView.showAdvertIfAvailable()
}
if(__toLoadLevelData && __createNewLevel === createNewLevel) {
var levelDataStayedTheSame = true
for(var propName in levelMetaData) {
if(levelMetaData[propName] !== __toLoadLevelData[propName]) {
levelDataStayedTheSame = false
break;
}
}
if(levelDataStayedTheSame && !createdNewLevel && !reloadLevel) {
console.debug("TwoPhaseLevelLoader: old and new levelData are the same, thus skip the loading scene")
levelEditor.loadLevelFinished()
scene.exitScene()
scene.enterScene()
return;
}
if(reloadLevel) {
reloadLevel = false
}
}
__createNewLevel = createNewLevel
__toLoadLevelData = levelMetaData
console.debug("TwoPhaseLevelLoader: set window state to 'loading' from previous state", window.state)
window.state = "loading"
}
function startGameAfterLevelLoadingAnimationFinished() {
console.debug("TwoPhaseLevelLoader: startGameAfterLevelLoadingAnimationFinished called")
console.debug("TwoPhaseLevelLoader: starting the loadDelayPhaseOne timer")
loadLevelDelayedTimer.start()
}
Timer {
id: loadLevelDelayedTimer
interval: system.desktopPlatform ? 0 : (system.Meego ? 2000 : 50)
onTriggered: {
if(__createNewLevel) {
levelEditor.createNewLevel(__toLoadLevelData)
} else {
levelEditor.loadSingleLevel(__toLoadLevelData)
}
}