Exemple #1
0
    void Ad()
    {
        int randomNumber = Random.Range(0, 10);

        if (hide)
        {
            AdMob.destroyBanner();               //oculta banner do AdMob
#if UNITY_ANDROID
            FlurryAndroid.removeAd("main_menu"); //oculta banner do Flurry
#endif
#if UNITY_IOS
            FlurryAds.removeAdFromSpace("main_menu");               //oculta banner do Flurry
#endif
        }

        if (randomNumber <= chance)
        {
            if (banner == false && interstitial == false)
            {
                banner = true;
            }

            if (show && P31Prefs.getInt("rads") == 0)
            {
                if (banner)
                {
                    AdMob.createBanner("ca-app-pub-8470511340989148/5727361119", "ca-app-pub-8470511340989148/7343695112", AdMobBanner.SmartBanner, AdMobBannerLocation);
                }
                if (interstitial)
                {
                    ShowInterstitial(location);
                }
            }
        }
    }
Exemple #2
0
    public static void Sync()
    {
#if UNITY_IPHONE
        //Use player prefs to set and return.
        P31Prefs.synchronize();
#endif
    }
 void Awake()
 {
     if (P31Prefs.getInt("rads") == 3)
     {
         Destroy(gameObject);
     }
 }
Exemple #4
0
    public static bool HasKey(string key)
    {
#if UNITY_IPHONE
        return(P31Prefs.hasKey(key));
#endif

        return(PlayerPrefs.HasKey(key));
    }
 public void RetrieveProduct(string productId)
 {
     if (productId == "csgms_remove_ads")
     {
         P31Prefs.setInt("rads", 3);              //quando RADS vira 3, ele oculta os ads
         Ads.Refresh();
     }
 }
Exemple #6
0
    public static void ClearAllKeys()
    {
#if UNITY_IPHONE
        //Use player prefs to set and return.

        P31Prefs.removeAll();
        return;
#endif

        PlayerPrefs.DeleteAll();
    }
Exemple #7
0
    public static int FetchInt(string key)
    {
#if UNITY_IPHONE
        //Use player prefs to set and return.

        return(P31Prefs.getInt(key));
#endif

        //If we fall here then we havent saved any other way and we will resport to unity default.
        return(PlayerPrefs.GetInt(key));
    }
Exemple #8
0
    public static void SetString(string key, string val)
    {
                #if UNITY_IPHONE
        //Use player prefs to set and return.
        P31Prefs.setString(key, val);
        return;
#endif

        //If we fall here then we havent saved any other way and we will resport to unity default.
        PlayerPrefs.SetString(key, val);
    }
Exemple #9
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
    }
Exemple #10
0
    public static IDictionary FetchDictonary(string key)
    {
#if UNITY_IPHONE
        //Use player prefs to set and return.

        return(P31Prefs.getDictionary(key));
#endif

        //If we fall here then we havent saved any other way and we will resport to unity default.
        var json = PlayerPrefs.GetString(key);
        return(json.dictionaryFromJson());
    }
Exemple #11
0
    public static void Refresh()
    {
        if (P31Prefs.getInt("rads") == 3)
        {
            AdMob.destroyBanner();
#if UNITY_ANDROID
            FlurryAndroid.removeAd("main_menu");               //oculta banner do Flurry
#endif
#if UNITY_IOS
            FlurryAds.removeAdFromSpace("main_menu");
#endif
        }
    }
Exemple #12
0
    public static void SetDictionary(string key, IDictionary val)
    {
                #if UNITY_IPHONE
        //Use player prefs to set and return.
        P31Prefs.setDictionary(key, new Hashtable(val));
        return;
#endif

        //If we fall here then we havent saved any other way and we will resport to unity default.
        //PlayerPrefs.SetString(key,val);

        var json = Prime31.Json.jsonEncode(val);
        PlayerPrefs.SetString(key, json);
    }
Exemple #13
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);
    }
Exemple #14
0
 void CheckLock()
 {
     if (P31Prefs.getInt("level" + levelNumber) == 1)           //0 TRANCADO - 1 LIBERADO
     {
         Debug.Log("Level " + levelNumber + " is unlocked!");
         isLocked             = false;
         spriteRenderer.color = new Color(1, 1, 1, 0.5f);
         transform.FindChild("levelNumber").GetComponent <TextMesh>().
         text = levelNumber.ToString();
     }
     else
     {
         foreach (Sprite s in menuSprites)
         {
             if (s.name.Equals("lock"))
             {
                 spriteRenderer.sprite = s;
                 break;
             }
         }
         isLocked = true;
     }
 }
Exemple #15
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");
     }
 }
Exemple #16
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();
    }
Exemple #17
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
 }