コード例 #1
0
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        displayMainMenu       = false;
        displayGameOver       = false;
        displayMainMenuPaused = false;

        sW                 = Screen.width;
        sH                 = Screen.height;
        buttonWidth        = sW * 0.6f;
        buttonHeight       = sH / 20.0f;
        storeKitController = GetComponent <StoreKitController>();

        // always authenticate at every launch
        GameCenterBinding.authenticateLocalPlayer();
        GameCenterBinding.loadLeaderboardTitles();

        //Get in-app purchase product data
        storeKitController.RequestProductData();

        showAds = true;
        int Ads = EncryptedPlayerPrefs.GetInt("removeadverts");

        if (Ads == 1)
        {
            if (EncryptedPlayerPrefs.CheckEncryption("removeadverts", "int", "1"))
            {
                showAds = false;
            }
        }
        else
        {
            //start loading ad
            AdBinding.initializeInterstitial();
            //start iAd
            AdBinding.createAdBanner(true);
        }

        // hack to detect iPad 3 until Unity adds official support
        this.isPad = (Screen.width >= 1536 || Screen.height >= 1536);
        if (isPad)
        {
            customButtonStyle.fontSize    = 64;
            customHighlightStyle.fontSize = 64;
            customPaddedStyle.fontSize    = 64;
        }

        //keep this object in memory
        DontDestroyOnLoad(transform.gameObject);
    }
コード例 #2
0
    public void SaveScore()
    {
        int highS = EncryptedPlayerPrefs.GetInt("highScoore");

        if (EncryptedPlayerPrefs.CheckEncryption("highScoore", "int", highS.ToString()) || highS == 0)
        {
            if (highS < score)
            {
                EncryptedPlayerPrefs.SetInt("highScoore", (int)score);
                MainMenu.Instance.SetHighScore(highS);
            }
        }
    }
コード例 #3
0
    void Start()
    {
        screenW = Screen.width;
        screenH = Screen.height;

        lableW = screenW / 8;
        lableH = screenH / 20;
        score  = 0.0f;

        if (EncryptedPlayerPrefs.CheckEncryption("xtralives", "int", "1"))
        {
            numLifes = 4;
        }

        if (EncryptedPlayerPrefs.CheckEncryption("10xtralives", "int", "1"))
        {
            numLifes = 11;
        }
    }