Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

GameNetworkExample

 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 = ""
     }
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded