Example #1
0
 void Empty_ad()
 {
     current_ad = null;
     ad_reward current_reward_selected = ad_reward.virtual_money;
     current_quantity_reward_selected = 0;
     current_item_id_reward_selected = -1;
     buy_button_cost = 0;
 }
Example #2
0
    public void Reset_reward()
    {
        current_ad = null;
        current_quantity_reward_selected = 0;
        current_item_id_reward_selected = -1;

        target_checkpoint = null;
        buy_button_cost = 0;
    }
Example #3
0
    public void Initiate_ads()
    {
        if(enable_ads && !Advertisement.isInitialized)
        {
            current_ad = null;
            app_id_selected = "";
            #if UNITY_IPHONE
            app_id_selected = iOS_ads_app_id;
            #elif UNITY_ANDROID
            app_id_selected = android_ads_app_id;
            #endif
            if (app_id_selected == "" && show_debug_warnings)
                Debug.LogWarning("No app_id found");

            Advertisement.Initialize(app_id_selected,ads_test_mode);
        }
    }
Example #4
0
    public void Call_ad(ad_options target_ad)
    {
        if (enable_ads && target_ad.this_ad_is_enabled)
        {
            if (target_ad.ignore_minimum_time_interval_between_ads
                || (minimum_time_interval_between_ads+time_of_latest_ad_showed) < Time.realtimeSinceStartup)
            {
                if (show_debug_messages)
                    Debug.Log("ad pass time check");

                if (UnityEngine.Random.Range(1,100) <= target_ad.chance_to_open_an_ad_here)
                {
                    if (show_debug_messages)
                        Debug.Log("ads_just_after_logo_when_game_start_as_daily_reward" + " - random ok");

                    if (target_ad.ask_to_player_if_he_want_to_watch_an_ad_before_start_it)
                    {
                        if (show_debug_messages)
                            Debug.Log("ask");

                        //decide the quantity of the reward (if it not is select by the player)
                        if (target_ad.my_ad_reward != ad_reward.select_by_the_player)
                        {
                            if (target_ad.randrom_reward)
                            {
                                if (show_debug_messages)
                                    Debug.Log("random reward");

                                //select the reward
                                int reward_slot = (int)Choose(target_ad.chance_to_give_this_reward);
                                current_reward_selected = (ad_reward)reward_slot;

                                //selet item id
                                if (current_reward_selected == ad_reward.consumable_item)
                                    current_item_id_reward_selected = UnityEngine.Random.Range(target_ad.min_item_id_randrom_reward[reward_slot],
                                                                                               target_ad.max_item_id_randrom_reward[reward_slot]);

                                //select the quantity
                                if (target_ad.randrom_reward_quantity_for_random_reward[reward_slot])
                                {
                                    if (show_debug_messages)
                                        Debug.Log("set random quantity");
                                    current_quantity_reward_selected = UnityEngine.Random.Range(target_ad.min_reward_quantity_for_random_reward[reward_slot],
                                                                                                target_ad.max_reward_quantity_for_random_reward[reward_slot]);
                                }
                                else
                                {
                                    if (show_debug_messages)
                                        Debug.Log("set quantity");
                                    current_quantity_reward_selected = target_ad.reward_quantity_for_random_reward[reward_slot];
                                }
                            }
                            else
                            {
                                if (show_debug_messages)
                                    Debug.Log("specific reward reward");

                                current_reward_selected = target_ad.my_ad_reward;

                                if (target_ad.my_ad_reward == ad_reward.consumable_item)
                                {
                                    if(target_ad.choose_a_random_consumable)
                                    {
                                        current_item_id_reward_selected = UnityEngine.Random.Range(target_ad.min_random_consumable_item_id,
                                                                                                   target_ad.max_random_consumable_item_id+1);
                                    }
                                    else
                                        current_item_id_reward_selected = target_ad.consumable_item_id;
                                }

                                if (target_ad.randrom_reward_quantity)
                                    current_quantity_reward_selected = UnityEngine.Random.Range(target_ad.min_reward_quantity,
                                                                                                target_ad.max_reward_quantity);
                                else
                                    current_quantity_reward_selected = target_ad.reward_quantity;
                            }
                        }
                        else
                        {
                            if (show_debug_messages)
                                Debug.Log("the reward will be chosen by the player");
                            current_reward_selected = target_ad.my_ad_reward;

                        }

                        current_ad = target_ad;
                        my_gift_manager.Start_me(target_ad.asking_text, //the message to show in the window
                                                 current_reward_selected,//the kind of reward
                                                 current_quantity_reward_selected);//quantity
                    }
                    else
                    {
                        if (show_debug_messages)
                            Debug.Log("ad start automatically");
                        current_ad = target_ad;

                        if (current_ad == target_ad)
                            Set_app_start_ad_countdown();

                        //star ad
                        Show_ad(false);//false = not rewarded
                    }
                }
                else
                {
                    if (show_debug_messages)
                        Debug.Log("ad - random fail");
                }
            }
            else
            {
                if (show_debug_messages)
                    Debug.Log("ad don't pass time check");
            }
        }
    }
Example #5
0
 public void Call_ad(ad_options target_ad)
 {
 }
	public void Call_ad(ad_options target_ad)
	{
	}