コード例 #1
0
    private void OnRenderableReady(bool isReady)
    {
        if (!UnityEngine.Application.isPlaying || !isReady)
        {
            return;
        }
        UnityEngine.Debug.LogWarning("CrossPromoButton::OnRenderableReady texture set");
        Renderer component = this.sprite.GetComponent <Renderer>();

        if (this.crossPromoType == CrossPromoButton.CrossPromoType.Main && AdvertisementHandler.CrossPromoMainRenderable != null)
        {
            component.material.mainTexture = AdvertisementHandler.GetCrossPromoMainTexture();
        }
        else if (this.crossPromoType == CrossPromoButton.CrossPromoType.Episode && AdvertisementHandler.CrossPromoEpisodeRenderable != null)
        {
            component.material.mainTexture = AdvertisementHandler.GetCrossPromoEpisodeTexture();
        }
        if (component.material != null && component.material.mainTexture != null)
        {
            float num  = (float)component.material.mainTexture.width;
            float num2 = (float)component.material.mainTexture.height;
            component.transform.localScale = Vector3.up * component.transform.localScale.y + Vector3.right * component.transform.localScale.y * (num / num2);
            this.OnRenderableShow();
        }
    }
コード例 #2
0
 private void Awake()
 {
     UnityEngine.Debug.LogWarning("CrossPromoButton::Awake");
     if (this.crossPromoType == CrossPromoButton.CrossPromoType.Main && AdvertisementHandler.CrossPromoMainRenderable != null)
     {
         if (AdvertisementHandler.GetCrossPromoMainTexture() != null)
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::OnRenderableReady: Main");
             this.OnRenderableReady(true);
         }
         else
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::GetCrossPromoMainTexture is NULL");
             AdvertisementHandler.RenderableHandler crossPromoMainRenderable = AdvertisementHandler.CrossPromoMainRenderable;
             crossPromoMainRenderable.onRenderableReady = (Action <bool>)Delegate.Combine(crossPromoMainRenderable.onRenderableReady, new Action <bool>(this.OnRenderableReady));
             base.gameObject.SetActive(false);
         }
     }
     else if (this.crossPromoType == CrossPromoButton.CrossPromoType.Episode && AdvertisementHandler.CrossPromoEpisodeRenderable != null)
     {
         if (AdvertisementHandler.GetCrossPromoEpisodeTexture() != null)
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::OnRenderableReady: Episode");
             this.OnRenderableReady(true);
         }
         else
         {
             UnityEngine.Debug.LogWarning("CrossPromoButton::Awake::GetCrossPromoEpisodeTexture is NULL");
             AdvertisementHandler.RenderableHandler crossPromoEpisodeRenderable = AdvertisementHandler.CrossPromoEpisodeRenderable;
             crossPromoEpisodeRenderable.onRenderableReady = (Action <bool>)Delegate.Combine(crossPromoEpisodeRenderable.onRenderableReady, new Action <bool>(this.OnRenderableReady));
             base.gameObject.SetActive(false);
         }
     }
     else
     {
         base.gameObject.SetActive(false);
     }
 }