コード例 #1
0
        void FetchAds()
        {
            foreach (string tag in adsSettings.rewardAdTags)
            {
                HZIncentivizedAd.Fetch(tag);
                Toaster.ShowDebugToast("Fetching 'reward' ad for tag; " + tag);
            }

            //Dont fetch interstitials if NoAds is baught
            if (adsRemoved)
            {
                Toaster.ShowDebugToast("Not fetching other ads because 'Remove_ads' is bought.");
                return;
            }

            HZInterstitialAd.ChartboostFetchForLocation("Default");

            foreach (string tag in adsSettings.staticAdTags)
            {
                HZInterstitialAd.Fetch(tag);
                Toaster.ShowDebugToast("Fetching 'static' ad for tag; " + tag);
            }
            foreach (string tag in adsSettings.videoAdTags)
            {
                HZVideoAd.Fetch(tag);
                Toaster.ShowDebugToast("Fetching 'video' ad for tag; " + tag);
            }
        }
コード例 #2
0
    public static bool PlayAd(UnityEngine.Events.UnityAction onAdPlay, UnityEngine.Events.UnityAction adNotAviable)
    {
        // fetch the video
        HZVideoAd.Fetch();
        // Check for availability
        if (HZVideoAd.IsAvailable())
        {
            // Show the ad
            HZVideoAd.Show();
            // Callback
            if (null != onAdPlay)
            {
                onAdPlay.Invoke();
            }
            // E x i t
            return(true);
        }

        // Failed debug it
        if (null != adNotAviable)
        {
            adNotAviable.Invoke();
        }

        return(false);
    }
コード例 #3
0
    static void Initialize()
    {
        string HeyzapID;

        switch (StudioSettings.Instance.studio)
        {
        case StudioSettings.Studio.TopGame:
            HeyzapID = "cde2146866f96c9ad90736c1af512e13";
            break;

        case StudioSettings.Studio.FreeGame:
            HeyzapID = "ef2a0c12b6d378ddce5063ca08a660b9";
            break;

        case StudioSettings.Studio.CrystalBuffalo:
            HeyzapID = "70a2f87d4c05ba041dada7f272651dba";
            break;

        case StudioSettings.Studio.SurvivalGame:
            HeyzapID = "9dff8b4f221dbad7cbbeeb52b2fc6125";
            break;

        default:
            HeyzapID = "cde2146866f96c9ad90736c1af512e13";
            break;
        }

        // TO DO: Something needs to be done to initialize Heyzap!
        // It is no longer in the launch controller.
        HeyzapAds.Start(HeyzapID, HeyzapAds.FLAG_NO_OPTIONS);
        HZVideoAd.Fetch();
        HZIncentivizedAd.Fetch();
    }
コード例 #4
0
    // Untouched code copied from AdCentral
    // ------------

    private static bool PlayHeyzapVideoAd()
    {
        if (HZVideoAd.IsAvailable())
        {
            HZVideoAd.Show();
            HZVideoAd.Fetch();
            return(true);
        }
        return(false);
    }
コード例 #5
0
ファイル: Game.cs プロジェクト: gbdb71/Unity3D-Soccer-Game
    IEnumerator AdCache(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        HZInterstitialAd.Fetch();
        if (Random.Range(0, 10) >= 2)
        {
            HZVideoAd.Fetch();
        }
    }
コード例 #6
0
ファイル: Maze9.cs プロジェクト: aleknikolov11/Maze-Game
    void Start()
    {
        mapButtonClicked = false;
        bestTimeVariable = "bestTimeLevel9";
        currentShardsForLevelVariable = "currentShardsForLevel9";
        currentMapVariable            = "mapLevel9";
        currentLevel = 9;
        HeyzapAds.Start("3a045a04722e168baefdd3eeff198305", HeyzapAds.FLAG_NO_OPTIONS);
        HZVideoAd.Fetch();
        HZIncentivizedAd.Fetch();
        map = new int[6, 6] {
            { 4, 2, 2, 3, 2, 4 }, { 2, 2, 3, 2, 1, 2 }, { 3, 2, 1, 4, 2, 2 }, { 2, 1, 2, 3, 2, 3 }, { 4, 3, 2, 3, 2, 3 }, { 2, 2, 2, 4, 2, 2 }
        };
        rotations = new int[6, 6] {
            { 1, 1, 0, 0, 1, 2 }, { 0, 2, 1, 0, 3, 2 }, { 1, 0, 2, 0, 0, 1 }, { 3, 2, 3, 0, 2, 1 }, { 2, 1, 0, 0, 1, 1 }, { 3, 2, 3, 3, 3, 2 }
        };
        MazeGenerator.instance.mazeGenerator(map, rotations, 6);
        Ball.transform.position   = start;
        Ball.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
        Ball.SetActive(true);
        Instantiate(FinishParticleSystem, finish, Quaternion.identity);
        if (!PlayerPrefs.HasKey(currentShardsForLevelVariable))
        {
            PlayerPrefs.SetInt(currentShardsForLevelVariable, 0);
        }

        currentSpawnsLeft = 3 - PlayerPrefs.GetInt(currentShardsForLevelVariable);
        while (currentSpawnsLeft > 0)
        {
            int   randX  = Random.Range(0, 6);
            int   randZ  = Random.Range(0, 6);
            float Shardx = (float)randX + 0.05f;
            float Shardy = (float)randZ + 0.05f;
            if (Shardx != start.x && Shardx != finish.x && Shardy != start.z && Shardy != finish.z)
            {
                Instantiate(Shard, new Vector3((float)randX, 0.15f, (float)randZ), Quaternion.identity);
                currentSpawnsLeft--;
            }
        }
        if (!PlayerPrefs.HasKey(bestTimeVariable))
        {
            bestTimeScore.text = "00:00";
        }
        else
        {
            bestTimeScore.text = ((int)(PlayerPrefs.GetFloat(bestTimeVariable) / 60f)).ToString("00") + ":" + ((int)(PlayerPrefs.GetFloat(bestTimeVariable) % 60f)).ToString("00");
        }
        currentTime           = 0f;
        shardsText.text       = PlayerPrefs.GetInt("currentShards").ToString();
        currentTimeText.text  = "";
        currentTimeScore.text = "";
        bestTimeScore.text    = "";
        timeString            = "";
        gameOver = false;
    }
コード例 #7
0
ファイル: AdsManager.cs プロジェクト: zmer007/noodleadstest
    // Use this for initialization
    void Start()
    {
        // Your Publisher ID is: 7e4482c1be37901e95ec6b42c8e14e21
        HeyzapAds.Start("7e4482c1be37901e95ec6b42c8e14e21", HeyzapAds.FLAG_NO_OPTIONS);

        HeyzapAds.ShowDebugLogs();
        HeyzapAds.ShowThirdPartyDebugLogs();

        HZVideoAd.Fetch();
        HZIncentivizedAd.Fetch();

        bannerShowing = false;
    }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        IsRewardedVideoReady = false;
        VideoAdCointer       = 0;
        HeyzapAds.Start("70d6db5109295d28b9ab83165d3fa95c", HeyzapAds.FLAG_NO_OPTIONS);
//		HeyzapAds.ShowMediationTestSuite();

        // Interstitial ads are automatically fetched
        HZInterstitialAd.Fetch("app-launch");
        HZVideoAd.Fetch("video");
        HZIncentivizedAd.Fetch("rewarded");
        HZIncentivizedAd.AdDisplayListener listener = delegate(string adState, string adTag){
            if (adState.Equals("incentivized_result_complete"))
            {
                // The user has watched the entire video and should be given a reward.
                GameEvents.Send(GiveReward);
            }
            if (adState.Equals("incentivized_result_incomplete"))
            {
                // The user did not watch the entire video and should not be given a   reward.
            }
            if (adState.Equals("hide"))
            {
                // Sent when an ad has been removed from view.
                // This is a good place to unpause your app, if applicable.
                Defs.MuteSounds(false);
            }
            if (adState.Equals("available"))
            {
                IsRewardedVideoReady = true;
                // Sent when an ad has been loaded and is ready to be displayed,
                //   either because we autofetched an ad or because you called
                //   `Fetch`.
            }
        };

        HZIncentivizedAd.SetDisplayListener(listener);

        HZVideoAd.AdDisplayListener listenerVideo = delegate(string adState, string adTag){
            if (adState.Equals("hide"))
            {
                // Sent when an ad has been removed from view.
                // This is a good place to unpause your app, if applicable.
                Defs.MuteSounds(false);
            }
        };

        HZVideoAd.SetDisplayListener(listenerVideo);
    }
コード例 #9
0
    public static bool PlayAd()
    {
        // fetch the video
        HZVideoAd.Fetch();
        // Check for availability
        if (HZVideoAd.IsAvailable())
        {
            // Show the ad
            HZVideoAd.Show();
            // E x i t
            return(true);
        }

        return(false);
    }
コード例 #10
0
    void Start()
    {
        Application.targetFrameRate = 60;

        Time.timeScale       = 1;
        AudioListener.volume = 1;

        HeyzapAds.Start("e75a46b975f6cb4a120ac6c5fe89e2c6", HeyzapAds.FLAG_DISABLE_AUTOMATIC_FETCHING);
        HZInterstitialAd.Fetch();

        if (Random.Range(0, 10) >= 2)
        {
            HZVideoAd.Fetch();
        }
    }
コード例 #11
0
ファイル: AdManager.cs プロジェクト: aleknikolov11/Maze-Game
 void Start()
 {
     HeyzapAds.Start("3a045a04722e168baefdd3eeff198305", HeyzapAds.FLAG_NO_OPTIONS);
     HZVideoAd.Fetch();
     HZIncentivizedAd.Fetch();
     HZIncentivizedAd.AdDisplayListener listener = delegate(string adState, string adTag) {
         if (adState.Equals("incentivized_result_complete"))
         {
             PlayerPrefs.SetInt("currentShards", PlayerPrefs.GetInt("currentShards") + 10);
         }
         if (adState.Equals("incentivized_result_incomplete"))
         {
             //Don give him/her shards
         }
     };
     HZIncentivizedAd.SetDisplayListener(listener);
 }
コード例 #12
0
    public void FetchButton()
    {
        string tag = this.adTag();

        this.console.Append("Fetching " + this.SelectedAdType.ToString() + " with tag: " + tag);
        switch (this.SelectedAdType)
        {
        case AdType.Interstitial:
            HZInterstitialAd.Fetch(tag);
            break;

        case AdType.Video:
            HZVideoAd.Fetch(tag);
            break;

        case AdType.Incentivized:
            HZIncentivizedAd.Fetch(tag);
            break;
        }
    }
コード例 #13
0
    public override void FetchAds(AdsElement type)
    {
        if (!AdsController.NoAds)
        {
            switch (type.type)
            {
            case AdsType.Banner:
                break;

            case AdsType.Interstitial:
                HZInterstitialAd.Fetch(type.name);
                break;

            case AdsType.Video:
                HZVideoAd.Fetch(type.name);
                break;

            case AdsType.RewardedVideo:
                HZIncentivizedAd.Fetch(type.name);
                break;
            }
        }
    }
コード例 #14
0
    void Start()
    {
        //Exit text not showing
        exitTextRenderer = GameObject.Find("ExitOverlay").GetComponent <CanvasRenderer> ();
        exitTextRenderer.SetAlpha(0f);
        exitTextRenderer.GetComponentInChildren <Text>().GetComponent <CanvasRenderer> ().SetAlpha(0f);

        HeyzapAds.Start("74ffa522d9d72b0bf95f103d3c142b2f", HeyzapAds.FLAG_NO_OPTIONS);
        HZVideoAd.Fetch();
        if (PlayerPrefs.HasKey("First time playing"))
        {
            GameObject.Find("HowToPlayCanvas").GetComponent <Canvas> ().enabled = false;
        }

        //HeyzapAds.ShowMediationTestSuite();// used for test purposes


        if (PlayerPrefs.HasKey("Total Time Played Since Last ad"))
        {
            totalPlayTime = PlayerPrefs.GetInt("Total Time Played Since Last ad");
        }

        GameObject temp = GameObject.Find("SoundToggleButton");

        soundToggleButton = temp.GetComponent <Button> ();
        highScore         = PlayerPrefs.GetFloat("Highscore");
        ShieldPowerup     = GetComponent <AudioSource> ();
        GameObject z = GameObject.Find("HUDCanvas");

        score    = z.GetComponentInChildren <Text>();
        animator = GetComponent <Animator> ();
        //Animation x = animator.GetComponent<Animation> ();
        animator.enabled = false;
        GameObject y = GameObject.Find("GameOverCanvas");

        gameOverCanvas         = y.GetComponent <Canvas> ();
        gameOverCanvas.enabled = false;

        y = GameObject.Find("RemainingFreezesText");
        remainingFreezes      = y.GetComponent <Text> ();
        remainingFreezes.text = freezePowerup.ToString();
        //repulsion powerup
        arrows     = new GameObject[4];
        arrows [0] = GameObject.Find("arrow");
        arrows [1] = GameObject.Find("arrow (1)");
        arrows [2] = GameObject.Find("arrow (2)");
        arrows [3] = GameObject.Find("arrow (3)");

        //disable animation of shield remaining time at first
        GameObject.Find("ShieldCountDownText").GetComponent <Animator> ().enabled = false;
        GameObject.Find("ShieldCountDownText").GetComponent <Text> ().enabled     = false;

        //retrieve last player audio preferences
        int i = PlayerPrefs.GetInt("Audio");

        //1 means it's off, else means it's on
        if (i == 1)
        {
            soundToggleButton.image.sprite = SoundOff;
            soundOn = false;
        }
        else
        {
            soundToggleButton.image.sprite = SoundOn;
            soundOn = true;
        }
    }
コード例 #15
0
 // Use this for initialization
 void Start()
 {
     HeyzapAds.Start("ecef46611330f64b1c88df6f89c05b63", HeyzapAds.FLAG_NO_OPTIONS);
     HZVideoAd.Fetch();
     HZIncentivizedAd.Fetch();
 }
コード例 #16
0
 public void FetchVideoAd()
 {
     HZVideoAd.Fetch();
 }