Esempio n. 1
0
 public void checkAndShowRemoveAd(Action <bool> callback = null)
 {
     if (_didInit)
     {
         if (!InhouseSDK.getInstance().getIsPro())
         {
             InhouseSDK.Language content = _config.RemoveAds.Languages.getLanguage(InhouseSDK.getInstance().GetCurrentSystemLanguage());
             if (content == null)
             {
                 content = _config.RemoveAds.Languages.getLanguage("en");
             }
             if (content != null)
             {
                 string title   = content.Title;
                 string message = content.Message;
                 string ok      = content.OK;
                 string cancel  = content.Cancel;
                 _callback = callback;
                 InhouseSDK.getInstance().ShowPopup(title, message, ok, cancel, "", (string respone) => {
                     if (respone == "0")
                     {
                         RemoveAds(callback);
                     }
                 });
             }
         }
     }
 }
Esempio n. 2
0
    public override void InitWithConfig(Hashtable data)
    {
        base.InitWithConfig(data);
        if (data == null)
        {
            return;
        }
        data = (Hashtable)data ["PaidAlert"];
        if (data == null)
        {
            return;
        }

        bool      enable    = (bool)data["Enable"];
        Hashtable languages = (Hashtable)data["Languages"];
        int       second    = TypeConvert.ToInt(data["Second"]);
        string    url       = HDUtils.ParseString(data["URL"]);

        if (url == string.Empty)
        {
            return;
        }

        InhouseSDK.Languages outLang = new InhouseSDK.Languages();
        foreach (DictionaryEntry entry in languages)
        {
            InhouseSDK.Language lang    = new InhouseSDK.Language();
            Hashtable           content = (Hashtable)entry.Value;
            lang.Cancel  = HDUtils.ParseString(content ["Cancel"]);
            lang.Key     = HDUtils.ParseString(entry.Key);
            lang.Message = HDUtils.ParseString(content ["Message"]);
            lang.OK      = HDUtils.ParseString(content ["OK"]);
            lang.Title   = HDUtils.ParseString(content ["Title"]);
            outLang.addLanguage(lang);
        }

        _config.PaidAlert.Enable    = enable;
        _config.PaidAlert.Languages = outLang;
        _config.PaidAlert.Second    = second;
        _config.PaidAlert.URL       = url;

        HDDebug.Log("PaidAlertMgr: initWithConfig success");
        _didInit = true;
    }
Esempio n. 3
0
    public override void InitWithConfig(Hashtable data)
    {
        base.InitWithConfig(data);
        if (data == null)
        {
            return;
        }
        data = (Hashtable)data["RateAlert"];
        if (data == null)
        {
            return;
        }

        Hashtable languages  = (Hashtable)data["Languages"];
        int       numDisplay = TypeConvert.ToInt(data["NumberToDisplayRatingPopup"]);
        string    url        = HDUtils.ParseString(data["URL"]);

        if (url == string.Empty)
        {
            return;
        }

        InhouseSDK.Languages outLang = new InhouseSDK.Languages();
        foreach (DictionaryEntry entry in languages)
        {
            InhouseSDK.Language lang    = new InhouseSDK.Language();
            Hashtable           content = (Hashtable)entry.Value;
            lang.Cancel  = HDUtils.ParseString(content ["Cancel"]);
            lang.Key     = HDUtils.ParseString(entry.Key);
            lang.Message = HDUtils.ParseString(content ["Message"]);
            lang.OK      = HDUtils.ParseString(content ["OK"]);
            lang.Title   = HDUtils.ParseString(content ["Title"]);
            outLang.addLanguage(lang);
        }

        _config.RateAlert.Languages = outLang;
        _config.RateAlert.NumberToDisplayRatingPopup = numDisplay;
        _config.RateAlert.URL = url;
        Debug.Log("Init rate ok");
        _didInit = true;
    }
Esempio n. 4
0
    public override void InitWithConfig(Hashtable data)
    {
        base.InitWithConfig(data);
        if (data == null)
        {
            return;
        }
        data = (Hashtable)data["RemoveAds"];
        if (data == null)
        {
            return;
        }

        Hashtable languages = (Hashtable)data["Languages"];
        string    productId = HDUtils.ParseString(data["ProductID"]);
        string    price     = HDUtils.ParseString(data["Price"]);

        if (productId == string.Empty)
        {
            return;
        }

        InhouseSDK.Languages outLang = new InhouseSDK.Languages();
        foreach (DictionaryEntry entry in languages)
        {
            InhouseSDK.Language lang    = new InhouseSDK.Language();
            Hashtable           content = (Hashtable)entry.Value;
            lang.Cancel  = HDUtils.ParseString(content ["Cancel"]);
            lang.Key     = HDUtils.ParseString(entry.Key);
            lang.Message = HDUtils.ParseString(content ["Message"]);
            lang.OK      = HDUtils.ParseString(content ["OK"]);
            lang.Title   = HDUtils.ParseString(content ["Title"]);
            outLang.addLanguage(lang);
        }

        _config.RemoveAds.Languages = outLang;
        _config.RemoveAds.ProductID = productId;
        _config.RemoveAds.Price     = price;

        _didInit = true;
    }
Esempio n. 5
0
    public void ShowPaidAlert()
    {
        if (_didInit)
        {
            int rated = PlayerPrefs.GetInt("paid", 0);
            if (_config.PaidAlert.Enable && rated == 0)
            {
                InhouseSDK.Language content = _config.PaidAlert.Languages.getLanguage(InhouseSDK.getInstance().GetCurrentSystemLanguage());
                if (content != null)
                {
                    float  delayTime = _config.PaidAlert.Second;
                    string title     = (string)content.Title;
                    string message   = (string)content.Message;
                    string ok        = (string)content.OK;
                    string cancel    = (string)content.Cancel;

                    InhouseSDK.getInstance().StartCoroutine(ShowMessageWithDelay(delayTime, title, message, ok, cancel, _config.PaidAlert.URL, PaidCall));
                }
            }
        }
    }
Esempio n. 6
0
 public void ShowRateAlertPopup()
 {
     if (_didInit)
     {
         int rated = PlayerPrefs.GetInt("rated", 0);
         if (rated == 0)
         {
             InhouseSDK.Language content = _config.RateAlert.Languages.getLanguage(InhouseSDK.getInstance().GetCurrentSystemLanguage());
             if (content == null)
             {
                 content = _config.RateAlert.Languages.getLanguage("en");
             }
             if (content != null)
             {
                 string title   = content.Title;
                 string message = content.Message;
                 string ok      = content.OK;
                 string cancel  = content.Cancel;
                 InhouseSDK.getInstance().ShowPopup(title, message, ok, cancel, _config.RateAlert.URL, RateCallback);
             }
         }
     }
 }
Esempio n. 7
0
    public void ShowRateAlert()
    {
        if (_didInit)
        {
            int count_rate = PlayerPrefs.GetInt("count_rate", -1);
            int rated      = PlayerPrefs.GetInt("rated", 0);

            if (count_rate == -1)
            {
                count_rate = 1;
                PlayerPrefs.SetInt("count_rate", count_rate);
            }
            Debug.Log("Rated = " + rated);
            Debug.Log("Count rate: " + count_rate);
            Debug.Log("Config rate: " + _config.RateAlert.NumberToDisplayRatingPopup);
            if (count_rate >= _config.RateAlert.NumberToDisplayRatingPopup && rated == 0)
            {
                Debug.Log("Languate A: " + (_config.RateAlert.Languages != null).ToString());
                InhouseSDK.Language content = _config.RateAlert.Languages.getLanguage(InhouseSDK.getInstance().GetCurrentSystemLanguage());
                Debug.Log("Languate B");
                if (content != null)
                {
                    string title   = content.Title;
                    string message = content.Message;
                    string ok      = content.OK;
                    string cancel  = content.Cancel;
                    InhouseSDK.getInstance().ShowPopup(title, message, ok, cancel, _config.RateAlert.URL, RateCallback);
                }
            }
            else
            {
                PlayerPrefs.SetInt("count_rate", count_rate + 1);
            }
            PlayerPrefs.Save();
            Debug.Log("Rate done");
        }
    }