コード例 #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);
                }
            }
        }
    }
コード例 #2
0
ファイル: btPurchase.cs プロジェクト: CountrysideGames/MadSnt
 void Awake()
 {
     if (P31Prefs.getInt("rads") == 3)
     {
         Destroy(gameObject);
     }
 }
コード例 #3
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));
    }
コード例 #4
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
        }
    }
コード例 #5
0
ファイル: Game.cs プロジェクト: CountrysideGames/MadSnt
    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);
    }
コード例 #6
0
ファイル: btLevel.cs プロジェクト: CountrysideGames/MadSnt
 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;
     }
 }
コード例 #7
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();
    }