예제 #1
0
    static bool IsActiveAD()
    {
        string appVersion = "1.0.0";

#if UNITY_IPHONE
        appVersion = iOSInterfaces.getAPPVersion();
#elif UNITY_ANDROID
        appVersion = AndroidInterfaces.CallGetAppVersion();
#endif

#if UNITY_IPHONE || UNITY_ANDROID
        string currentVersionADActiveKey = "ad_switch_" + appVersion;

        GA.UpdateOnlineConfig();
        string ADActiveState = GA.GetConfigParamForKey(currentVersionADActiveKey);
#else
        string ADActiveState = "0";
#endif

        bool available = true;        //(Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        //&& (string.IsNullOrEmpty(ADActiveState) || ADActiveState == "1");

        Debug.Log(string.Format("AD state is {0}! version:{1} online param:{2}", available?"on":"off", appVersion, ADActiveState));
        return(available);
    }
예제 #2
0
 // Old method, remove it after android implemented.
 static public void Pay(string id, string callbackGameObject, string callbackMethod)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         AndroidInterfaces.CallPay(id, callbackGameObject, callbackMethod);
     }
 }
예제 #3
0
    public static IEnumerator ShareGame()
    {
        string shareContent = TextManager.GetText("game_share_text");

        Application.CaptureScreenshot("Sceenshot.png");
        string shareImagePath = Application.persistentDataPath + "/Sceenshot.png";

        yield return(new WaitForSeconds(0.6f));

                #if UNITY_IPHONE || UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)
        {
            AndroidInterfaces.CallShare(shareContent, shareImagePath, shareUrl);
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            if (instance != null)
            {
                //ios上弹出分享时,点击空白处后面的按钮也会响应,需屏蔽
                Debug.Log("Show FullScreenBlock");
                instance.shareScreenBlock.SetActive(true);
            }
            iOSInterfaces.CallShareWithScreenshot(shareContent, shareImagePath);
        }
                #endif
    }
예제 #4
0
    //private
    private string GetAPPVersion()
    {
        string appVersion = "1.0.0";

                #if UNITY_IPHONE
        appVersion = iOSInterfaces.getAPPVersion();
                #elif UNITY_ANDROID
        appVersion = AndroidInterfaces.CallGetAppVersion();
                #endif
        return(appVersion);
    }
예제 #5
0
    public void Restore(IAPProduct product)
    {
        string productID = productIDMap[product];

        if (Config.isSkipPurchase)
        {
            PayCallback("succeed," + productID);
        }
        else
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                //TODO:GL - android平台尚未实现
                AndroidInterfaces.CallRestore(productID, "", "");
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                iOSInterfaces.CallRestore(productID);
            }
        }
    }
예제 #6
0
    void Start()
    {
        coinLabel.text = string.Format("{0}", GameSystem.GetInstance().Coin);
        GameSystem.GetInstance().OnCoinChanged += HandleOnCoinChanged;
        muteButton.value = PlayerProfile.LoadMute();
        EventDelegate.Add(muteButton.onChange, MuteButtonValueOnChange);
        GameSoundSystem.GetInstance().Mute = muteButton.value;
        shopButton.SetActive(Config.isStoreActive);
        moreGameLabel.text = Config.isMoreGameActive ? TextManager.GetText("more_game") : "...";
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            versionLabel.text = "v" + iOSInterfaces.getAPPVersion();

            foreach (GameObject modeObject in modeObjects)
            {
                if (modeObject.GetComponent <MoreModeButton>() != null)
                {
                    modeObjects.Remove(modeObject);
                    modeObject.SetActive(false);
                    break;
                }
            }
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            versionLabel.text = "v" + AndroidInterfaces.CallGetAppVersion();
        }

#if UNITY_IPHONE || UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            KTPlay.SetAvailabilityChangedCallback(this, KTPlayAvailabilityChanged);
            GA.UpdateOnlineConfig();
        }
#endif
        UpdateGiftButtonState();
        RefreshVIPButtonState();
    }