Exemplo n.º 1
0
 void Start()
 {
     Time.timeScale = 0;
     if (File.Exists(adsData.GetAdsPath()))
     {
         videoPlayer.url = adsData.GetAdsPath();
         videoPlayer.Play();
     }
     StartCoroutine(DelayEnableBtn());
 }
 void Start()
 {
     Time.timeScale = 0;
     if (File.Exists(adsData.GetAdsPath()))
     {
         var fileData = File.ReadAllBytes(adsData.GetAdsPath());
         var tex      = new Texture2D(2, 2);
         tex.LoadImage(fileData);
         adsImage.texture = tex;
     }
     else
     {
         adsImage.gameObject.SetActive(false);
     }
 }
Exemplo n.º 3
0
    private IEnumerator CacheElement(AdsElement element)
    {
        UnityWebRequest www = UnityWebRequest.Get(element.url);

        yield return(www.SendWebRequest());

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            try
            {
                System.IO.File.WriteAllBytes(element.GetAdsPath(), www.downloadHandler.data);
            }
            catch (Exception e)
            {
                Debug.Log("Fail to cache ads" + e.Message);
            }
        }
    }