Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Bamf

#376
General (Antiguo) / mi plan esta en marcha
Mayo 02, 2018, 10:11:58 PM
Cita de: Igor date=1525285800mierda, Donald Trump se esta adelantando a mi plan...
   
   
      ...ya va por la fase de crear una "fuerza espacial"...
   
   
      ...tengo que darme prisa!
   


Tu puedes dar un paso más y crear el ejército especializado en Marte.
#377
Enhorabuena! Lamentablemente no lo puedo probar, soy de iOS. Pero tiene una buena pinta.
#378
Cuando quieras soltarme unos euros tal vez me pase a ver que hay de oferta jajaja
#379
General (Antiguo) / Buenas a todos !!!
Abril 30, 2018, 11:19:02 PM
Buenas y Bienvenido a la Comunidad! Si tienes alguna duda abre un post en su hilo correspondiente y se te intentará ayudar lo antes posible. Un saludo!
#380
General (Antiguo) / Hola Gente!
Abril 30, 2018, 11:39:36 AM
Buenas y Bienvenido a la Comunidad!
#381
General (Antiguo) / Ayuda Admob
Abril 30, 2018, 11:38:21 AM
No, las ids las oculté yo, pensaba que eran las originales por eso puse id @andresblend7
#382
General (Antiguo) / Ayuda Admob
Abril 30, 2018, 12:41:21 AM
Yo lo tengo así, tu ya puedes editarlo como quieras.
 

using System;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.Advertisements;
public class AdsController : MonoBehaviour
{
    public static AdsController Instance { set; get; }
    public string bannerId;
    public string fullPanelId;
    public string nativeId;
    public string IOSBannerId;
    public string IOSFullPanelId;
    public string rewardVideoId;
    private BannerView bannerView;
    private InterstitialAd interstitial;
    private NativeExpressAdView nativeExpressAdView;
    private RewardBasedVideoAd rewardBasedVideo;
    private void Awake()
    {
        Instance = this;
    }
    public void RequestAds()
    {
        RequestInterstitial();
        RequestBanner();
    }
    public void RequestRewardDelay(float timeWait)
    {
        StartCoroutine(StartRequest(timeWait));
    }
    IEnumerator StartRequest(float timeWait)
    {
        yield return new WaitForSeconds(timeWait);
        RequestRewardBasedVideo();
    }
    void PreloadRewardVideo()
    {
        // Get singleton reward based video ad reference.
        rewardBasedVideo = RewardBasedVideoAd.Instance;
        // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
        rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
        rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
        rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
        rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
        rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
    }
    public void RequestNativeExpressAdView()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        NativeInsize();
        #endif
    }
    void NativeInsize()
    {
       
        // Create a 320x150 native express ad at the top of the screen.
        this.nativeExpressAdView = new NativeExpressAdView(
            nativeId,
            new AdSize(320, 132),
            AdPosition.Center);
        // Register for ad events.
        this.nativeExpressAdView.OnAdLoaded += this.HandleNativeExpressAdLoaded;
        this.nativeExpressAdView.OnAdFailedToLoad += this.HandleNativeExpresseAdFailedToLoad;
        this.nativeExpressAdView.OnAdOpening += this.HandleNativeExpressAdOpened;
        this.nativeExpressAdView.OnAdClosed += this.HandleNativeExpressAdClosed;
        this.nativeExpressAdView.OnAdLeavingApplication += this.HandleNativeExpressAdLeftApplication;
        // Load a native express ad.
        this.nativeExpressAdView.LoadAd(this.createAdRequest());
    }
    public void ShowNative()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        nativeExpressAdView.Show();
        #endif
    }
    public void HideNative(bool isDestroy)
    {
//        #if UNITY_ANDROID && !UNITY_EDITOR
        if (nativeExpressAdView != null)
        {
            nativeExpressAdView.Hide();
            if (isDestroy)
            {
                nativeExpressAdView.Destroy();
            }
        }
//        #endif
    }
    public void RequestBanner()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        RequestBannerInsize();
        #elif UNITY_IOS
        RequestBannerIOSInsize();
        #endif
    }
    public void ShowBanner()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        ShowBannerInsize();
        #elif UNITY_IOS
        ShowBannerInsize();
        #endif
    }
    public void HideBanner()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        if (bannerView != null)
        {
            bannerView.Hide();
            bannerView.Destroy();
        }
        #elif UNITY_IOS
        #endif
    }
    void ShowBannerInsize()
    {
        RequestBanner();
        bannerView.Show();
    }
    void RequestBannerInsize()
    {
        HideBanner();
        // Create a 320x50 banner at the top of the screen.
        bannerView = new BannerView(bannerId, AdSize.Banner, AdPosition.Bottom);
        // Register for ad events.
        bannerView.OnAdLoaded += HandleAdLoaded;
        bannerView.OnAdFailedToLoad += HandleAdFailedToLoad;
        bannerView.OnAdLoaded += HandleAdOpened;
        bannerView.OnAdClosed += HandleAdClosed;
        bannerView.OnAdLeavingApplication += HandleAdLeftApplication;
        // Load a banner ad.
        bannerView.LoadAd(createAdRequest());
    }
    void RequestBannerIOSInsize()
    {
        // Create a 320x50 banner at the top of the screen.
        bannerView = new BannerView(IOSBannerId, AdSize.SmartBanner, AdPosition.Bottom);
        // Register for ad events.
        bannerView.OnAdLoaded += HandleAdLoaded;
        bannerView.OnAdFailedToLoad += HandleAdFailedToLoad;
        bannerView.OnAdLoaded += HandleAdOpened;
        bannerView.OnAdClosed += HandleAdClosed;
        bannerView.OnAdLeavingApplication += HandleAdLeftApplication;
        // Load a banner ad.
        bannerView.LoadAd(createAdRequest());
    }
    public void RequestInterstitial()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        RequestInterstitialInsize();
        #elif UNITY_IOS
        RequestInterstitialIOSInsize();
        #endif
    }
    void RequestInterstitialInsize()
    {
        // Create an interstitial.
        interstitial = new InterstitialAd(fullPanelId);
        // Register for ad events.
        interstitial.OnAdLoaded += HandleInterstitialLoaded;
        interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
        interstitial.OnAdOpening += HandleInterstitialOpened;
        interstitial.OnAdClosed += HandleInterstitialClosed;
        interstitial.OnAdLeavingApplication += HandleInterstitialLeftApplication;
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }
    void RequestInterstitialIOSInsize()
    {
        // Create an interstitial.
        interstitial = new InterstitialAd(IOSFullPanelId);
        // Register for ad events.
        interstitial.OnAdLoaded += HandleInterstitialLoaded;
        interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
        interstitial.OnAdOpening += HandleInterstitialOpened;
        interstitial.OnAdClosed += HandleInterstitialClosed;
        interstitial.OnAdLeavingApplication += HandleInterstitialLeftApplication;
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }
 
    // Returns an ad request with custom ad targeting.
    private AdRequest createAdRequest()
    {
        return new AdRequest.Builder()
                .AddTestDevice(AdRequest.TestDeviceSimulator)
                        .AddTestDevice("") // z4
        //.AddTestDevice("") // tab i8
                .AddKeyword("game")
//                .SetGender(Gender.Male)
                .SetBirthday(new DateTime(1985, 1, 1))
                .TagForChildDirectedTreatment(false)
                .AddExtra("color_bg", "9B30FF")
                .Build();
    }
    public void RequestRewardBasedVideo()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        RequestRewardBasedVideoInsize();
        #endif
    }
    void RequestRewardBasedVideoInsize()
    {
        rewardBasedVideo.LoadAd(createAdRequest(), rewardVideoId);
    }
    public void ShowInterstitial()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
        }
        RequestInterstitial();
        #elif UNITY_IOS
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
        }
        RequestInterstitial();
        #endif
    }
    public void ShowRewardBasedVideo()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        if (rewardBasedVideo.IsLoaded())
        {
            rewardBasedVideo.Show();
            RequestRewardDelay(10);
        }
        #endif
    }
    public bool IsRewardVideoLoaded()
    {
        #if UNITY_ANDROID && !UNITY_EDITOR
        return IsRewardVideoLoadedInsize();
        #endif
        return true;
    }
    bool IsRewardVideoLoadedInsize()
    {
        return rewardBasedVideo.IsLoaded();
        ;
    }
 
    // Unity Ads
    public void ShowRewardedAd(ref bool isReady)
    {
        if (Advertisement.IsReady("rewardedVideo"))
        {
            var options = new ShowOptions { resultCallback = HandleShowResult };
            Advertisement.Show("rewardedVideo", options);
            isReady = true;
        }
        else
        {
            isReady = false;
        }
    }
    public bool IsRewardedAdReady()
    {
        if (Advertisement.IsReady("rewardedVideo"))
        {
            return true;
        }
       
        return false;
    }
    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
            case ShowResult.Finished:
                Debug.Log("The ad was successfully shown.");
                //
                // YOUR CODE TO REWARD THE GAMER
                // Give coins etc.
                MainCanvas.Main.inGameScript.ShowRewardFinish();
                break;
            case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                break;
            case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                break;
        }
    }
 
    #region Banner callback handlers
    public void HandleAdLoaded(object sender, EventArgs args)
    {
        print("HandleAdLoaded event received.");
    }
    public void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        print("HandleFailedToReceiveAd event received with message: " + args.Message);
    }
    public void HandleAdOpened(object sender, EventArgs args)
    {
        print("HandleAdOpened event received");
    }
    void HandleAdClosing(object sender, EventArgs args)
    {
        print("HandleAdClosing event received");
    }
    public void HandleAdClosed(object sender, EventArgs args)
    {
        print("HandleAdClosed event received");
    }
    public void HandleAdLeftApplication(object sender, EventArgs args)
    {
        print("HandleAdLeftApplication event received");
    }
 
    #endregion
    #region Interstitial callback handlers
    public void HandleInterstitialLoaded(object sender, EventArgs args)
    {
        print("HandleInterstitialLoaded event received.");
    }
    public void HandleInterstitialFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        print("HandleInterstitialFailedToLoad event received with message: " + args.Message);
    }
    public void HandleInterstitialOpened(object sender, EventArgs args)
    {
        print("HandleInterstitialOpened event received");
    }
    void HandleInterstitialClosing(object sender, EventArgs args)
    {
        print("HandleInterstitialClosing event received");
    }
    public void HandleInterstitialClosed(object sender, EventArgs args)
    {
        print("HandleInterstitialClosed event received");
    }
    public void HandleInterstitialLeftApplication(object sender, EventArgs args)
    {
        print("HandleInterstitialLeftApplication event received");
    }
    #endregion
    #region RewardBasedVideo callback handlers
    public void HandleRewardBasedVideoLoaded(object sender, EventArgs args)
    {
        print("HandleRewardBasedVideoLoaded event received.");
    }
    public void HandleRewardBasedVideoFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        print("HandleRewardBasedVideoFailedToLoad event received with message: " + args.Message);
    }
    public void HandleRewardBasedVideoOpened(object sender, EventArgs args)
    {
        print("HandleRewardBasedVideoOpened event received");
    }
    public void HandleRewardBasedVideoStarted(object sender, EventArgs args)
    {
        print("HandleRewardBasedVideoStarted event received");
    }
    public void HandleRewardBasedVideoClosed(object sender, EventArgs args)
    {
        print("HandleRewardBasedVideoClosed event received");
    }
    public void HandleRewardBasedVideoRewarded(object sender, Reward args)
    {
        string type = args.Type;
        double amount = args.Amount;
        print("HandleRewardBasedVideoRewarded event received for " + amount.ToString() + " " +
            type);
    }
    public void HandleRewardBasedVideoLeftApplication(object sender, EventArgs args)
    {
        print("HandleRewardBasedVideoLeftApplication event received");
    }
    #endregion
    #region Native express ad callback handlers
    public void HandleNativeExpressAdLoaded(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleNativeExpressAdAdLoaded event received");
    }
    public void HandleNativeExpresseAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        MonoBehaviour.print(
            "HandleNativeExpressAdFailedToReceiveAd event received with message: " + args.Message);
    }
    public void HandleNativeExpressAdOpened(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleNativeExpressAdAdOpened event received");
    }
    public void HandleNativeExpressAdClosed(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleNativeExpressAdAdClosed event received");
    }
    public void HandleNativeExpressAdLeftApplication(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleNativeExpressAdAdLeftApplication event received");
    }
    #endregion
}

 
Recuerda que este script tiene que ir a un gameobject vacío.
 
Nota: Puedes borrar la línea 326
 
Nota 2: Si no usas UnityAds borra la línea desde 290 hasta 338.
 
Espero haberte ayudado!
#383
General (Antiguo) / Buenas a todos!!
Abril 30, 2018, 12:03:02 AM
Buenas y Bienvenido a la Comunidad! Espero que puedas solucionar todas tus dudas aquí, a veces algunas personas tardan en contestar pero siempre acaban ayudándote. Tan solo crea un post en la sección adecuada y dale tiempo. También tenemos un grupo en Telegram y en Discord. Échale un ojo si te apetece entrar más en contacto. Un saludo y espero que tu estancia por aquí sea de agrado.
#384
General (Antiguo) / Presentacion
Abril 28, 2018, 10:22:47 PM
Ohhh un musico! Bienvenido!!!
#385
Proyectos / Battle Banner
Abril 25, 2018, 11:57:08 AM
Cita de: Igor date=1524610488no sabia que en esta pagina dejaban ingrasar a los de Mac
   
   
      


Oye oye! Que la tenemos eh!
#386
General (Antiguo) / Hola a todo el mundo
Abril 24, 2018, 08:31:17 PM
Buenas y Bienvenido a la Comunidad jajaja aunque estés registrado desde hace mucho te doy la bienvenida ahora. Espero ver pronto tu proyecto!
#387
General (Antiguo) / Buenas!
Abril 24, 2018, 08:30:18 PM
Buenas y Bienvenido a la Comunidad!
#388
Proyectos / Battle Banner
Abril 24, 2018, 03:31:53 PM
Cita de: Igner date=1524576655 
   
   
      Gracias, dentro de poco pondré un enlace para la descarga de una primera demo jugable.
   


Que sea compatible con Mac por favor jajaja 
#389
Proyectos / Battle Banner
Abril 24, 2018, 03:26:29 PM
Maravilloso!
#390
General (Antiguo) / Hola a todos
Abril 24, 2018, 03:23:56 PM
Buenas y Bienvenido a la Comunidad!