Ejemplo n.º 1
0
 public void RetrieveProduct(string productId)
 {
     if (productId == "csgms_remove_ads")
     {
         P31Prefs.setInt("rads", 3);              //quando RADS vira 3, ele oculta os ads
         Ads.Refresh();
     }
 }
Ejemplo n.º 2
0
    public static void SetInt(string key, int val)
    {
#if UNITY_IPHONE
        //Use player prefs to set and return.
        P31Prefs.setInt(key, val);
        return;
#endif

        //If we fall here then we havent saved any other way and we will resport to unity default.
        PlayerPrefs.SetInt(key, val);
    }
Ejemplo n.º 3
0
    void Awake()
    {
        P31Prefs.setInt("level1", 1);
        mainCamera = this.gameObject;

#if UNITY_ANDROID
        EtceteraAndroid.askForReview(1, 1, 2, "Do you like this game?", "Please review the game if you do!", false);
#endif
#if UNITY_IOS
        EtceteraBinding.askForReview(1, 0.5f, "Do you like this game?", "Please review the game if you do!", "950049277");
#endif
    }
Ejemplo n.º 4
0
    public void GameOver()
    {
        Debug.Log("Game Over");
        balloonController.canMove    = false;
        balloonController.canRelease = false;
        balloonController.yDirection = 0;
        gameOver = true;
        Invoke("ShowGameOver", 2.0f);

        //CONFERE MISSOES
        if (giftCount >= totalChimneys)
        {
            CompleteMission(0);
        }
        if (shotCount <= 0)         //MISSAO DE NAO TOMAR TIROS
        {
            CompleteMission(2);
        }

        if (!menu)
        {
            for (int i = 0; i < 3; i++)
            {
                if (P31Prefs.getInt("level" + levelNumber + "mission" + i) == 1)
                {
                    uiGame.obCheck [i].GetComponent <Image> ().sprite = uiGame.obChecked;
                    completedMissions += 1;
                    Debug.Log("Completed mission " + i);
                }
            }
        }

        //LIBERA O PROXIMO LEVEL
        if (Game.completedMissions >= 2)
        {
            P31Prefs.setInt("level" + Game.levelNumber, 1);
        }

        Debug.Log("Gifts delivered: " + giftCount + ", Stars collected " + starCount + ", shots received " + shotCount);
    }
Ejemplo n.º 5
0
 public void NextLevel()        //INICIA A PROXIMA FASE
 {
     if (Game.levelNumber < 14)
     {
         if (Game.completedMissions >= 2)
         {
             Debug.Log("Skipping to next level");
             Game.tutorial     = false;
             Game.levelNumber += 1;
             P31Prefs.setInt("level" + Game.levelNumber, 1);
             Application.LoadLevel("level" + Game.levelNumber);
         }
         else
         {
             var buttons = new string[] { "OK" };
     #if UNITY_ANDROID
             EtceteraAndroid.showAlert("Hey!", "You need 2 stars to unlock the next level", buttons[0]);
     #endif
     #if UNITY_IOS
             EtceteraBinding.showAlertWithTitleMessageAndButtons("Hey!", "You need 2 stars to unlock the next level", buttons);
     #endif
             Debug.Log("Need more stars to unlock the next level");
         }
     }
     else
     {
         var buttons = new string[] { "OK" };
                     #if UNITY_ANDROID
         EtceteraAndroid.showAlert("Congratulations!", "You finished the game.", buttons[0]);
                     #endif
                     #if UNITY_IOS
         EtceteraBinding.showAlertWithTitleMessageAndButtons("Congratulations!", "You finished the game.", buttons);
                     #endif
         Debug.Log("Finished the game");
     }
 }
Ejemplo n.º 6
0
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Synchronize"))
        {
            // Note: synchronize is called automatically for you when iCloud initializes and your app closes so in practice you will not need to call it
            var didSync = P31Prefs.synchronize();
            Debug.Log("did synchronize: " + didSync);
        }


        if (GUILayout.Button("Get the ubiquityIdentityToken"))
        {
            var token = iCloudBinding.getUbiquityIdentityToken();
            Debug.Log("ubiquityIdentityToken: " + token);
        }


        if (GUILayout.Button("Set Int 29"))
        {
            P31Prefs.setInt("theInt", 29);
            Debug.Log("int: " + P31Prefs.getInt("theInt"));
        }


        if (GUILayout.Button("Set string 'word'"))
        {
            P31Prefs.setString("theString", "word");
            Debug.Log("string: " + P31Prefs.getString("theString"));
        }


        if (GUILayout.Button("Set Bool"))
        {
            P31Prefs.setBool("theBool", true);
            Debug.Log("bool: " + P31Prefs.getBool("theBool"));
        }


        if (GUILayout.Button("Set Float 13.68"))
        {
            P31Prefs.setFloat("theFloat", 13.68f);
            Debug.Log("float: " + P31Prefs.getFloat("theFloat"));
        }


        if (GUILayout.Button("Set Dictionary"))
        {
            var ht = new Hashtable();
            ht.Add("aFloat", 25.5f);
            ht.Add("aString", "dogma");
            ht.Add("anInt", 16);
            P31Prefs.setDictionary("theDict", ht);
            Prime31.Utils.logObject(P31Prefs.getDictionary("theDict"));
        }


        if (GUILayout.Button("Get All"))
        {
            Debug.Log("int: " + P31Prefs.getInt("theInt"));
            Debug.Log("string: " + P31Prefs.getString("theString"));
            Debug.Log("bool: " + P31Prefs.getBool("theBool"));
            Prime31.Utils.logObject(P31Prefs.getDictionary("theDict"));
            Debug.Log("float: " + P31Prefs.getFloat("theFloat"));
        }


        if (GUILayout.Button("Remove All Values"))
        {
            P31Prefs.removeAll();
        }


        endColumn(true);


        if (GUILayout.Button("Is Document Store Available"))
        {
            Debug.Log("Is document store available: " + P31Prefs.iCloudDocumentStoreAvailable);
        }


        if (GUILayout.Button("Is File in iCloud?"))
        {
            Debug.Log("Is file in iCloud: " + iCloudBinding.isFileInCloud(_filename));
        }


        if (GUILayout.Button("Is File Downloaded?"))
        {
            Debug.Log("Is file downloaded: " + iCloudBinding.isFileDownloaded(_filename));
        }


        if (GUILayout.Button("Save File to iCloud"))
        {
            // make up a file name
            _filename = string.Format("myCloudFile{0}.txt", Random.Range(0, 10000));

            var didSave = P31CloudFile.writeAllText(_filename, "going to write some text");
            Debug.Log("Did write file to iCloud: " + didSave);
        }


        if (GUILayout.Button("Modify File"))
        {
            var didSave = P31CloudFile.writeAllText(_filename, "changed up the text and now its this");
            Debug.Log("Did write file to iCloud: " + didSave);
        }


        if (GUILayout.Button("Get Contents of File"))
        {
            var lines = P31CloudFile.readAllLines(_filename);
            Debug.Log("File contents: " + string.Join("", lines));
        }


        if (GUILayout.Button("Evict File"))
        {
            iCloudBinding.evictFile(_filename);
        }

        endColumn();
    }
Ejemplo n.º 7
0
 //COMPLETA UMA DAS 3 MISSOES:
 //0- ACERTAR TODAS AS CHAMINES
 //1- COLETAR UMA ESTRELA
 //2- NAO TOMAR TIROS
 public void CompleteMission(int missionNumber)
 {
     P31Prefs.setInt("level" + levelNumber + "mission" + missionNumber, 1);          //0 = INCOMPLETO, 1 = COMPLETO
 }