AchievementTest.qml Example File

examples/gamenetwork/GameNetworkTest/qml/AchievementTest.qml
 import Felgo 3.0
 import QtQuick 2.0

 TestBase {

   property string currentAchievementKey: "achievement01"

   // can either be "achievementKey" or ""
   property string textInputState

  Column {

   Text {
     text: "currentAchievementKey: " + currentAchievementKey
     color: "white"
   }

   SimpleButton {
     text: "Change Current Achievement"
     onClicked: {
       textInputState = "achievementKey"
       nativeUtils.displayTextInput("Enter Achievement Key", "", "", currentAchievementKey )
     }
   }

   SimpleButton {
     text: "Increase Achievement progress"
     onClicked: {
       gameNetwork.incrementAchievement(currentAchievementKey)
     }
   }
   SimpleButton {
     text: "Unlock Achievement"
     onClicked: {
       gameNetwork.unlockAchievement(currentAchievementKey)
     }
   }
   SimpleButton {
     text: "Get All Achievements"
     onClicked: {
       gameNetwork.api.getAllAchievements()
     }
   }
   SimpleButton {
     text: "Get User Achievements with progress"
     onClicked: {
       gameNetwork.api.getAchievementProgress()
     }
   }

   /* Resetting achievement is not supported by the API yet!
   SimpleButton {
     text: "Reset Achievement"
     onClicked: {
       gameNetwork.resetAchievement(currentAchievementKey)
     }
   }
   */

   SimpleButton {
     text: "Show AchievementView"
     onClicked: {
       gameNetwork.showAchievements()
     }
   }

  }// Column

   Connections {
     target: nativeUtils
     onTextInputFinished: {

       if(textInputState === "achievementKey" && accepted) {
         currentAchievementKey = enteredText
       }

       textInputState = ""
     }
   }

 }

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support