Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     if (game_master.game_master_obj)
     {
         my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
     }
 }
Esempio n. 2
0
    public void Select_this_tab(int tab_id)
    {
        if (tab_selected != tab_id)
        {
            if (tab_selected >= 0)
            {
                my_game_master.Gui_sfx(my_game_master.tap_sfx);
            }

            for (int i = 0; i < tabs_length; i++)
            {
                windows[i].SetActive(false);
                tab_buttons_ico[i].sprite = not_selected_tab;
            }

            windows[tab_id].SetActive(true);
            tab_buttons_ico[tab_id].sprite = selected_tab;
            tab_selected = tab_id;

            if (!my_game_master)
            {
                my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            }

            if (my_game_master.use_pad)
            {
                Invoke("Focus_on_first_button_of_this_window", 0.1f);
            }
        }
    }
Esempio n. 3
0
    public void My_start()
    {
        if (game_master.game_master_obj)
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

        if (my_world_number < my_game_master.total_stages_in_world_n.Length)
        {
            if (my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.manual)
                {
                my_manage_menu_uGUI = GameObject.Find("Home_Canvas").GetComponent<manage_menu_uGUI>();

                if (my_game_master.total_stages_in_world_n[my_world_number] != stage_icons.Length)
                    Debug.LogError("the number of icons don't match the number of stages in this world ");

                for (int i = 0; i < stage_icons.Length; i++)
                    {
                    stage_icons[i].world_number = my_world_number;
                    stage_icons[i].stage_number = i+1;
                    stage_icons[i].my_manage_menu_uGUI = my_manage_menu_uGUI;
                    stage_icons[i].my_game_master = my_game_master;
                    if ((i+1) <stage_icons.Length)
                        stage_icons[i].next_stage_ico = stage_icons[i+1];
                    stage_icons[i].My_start();
                    }

                Focus_on_first_icon();

                }
            }
    }
Esempio n. 4
0
	// Use this for initialization
	void Start () {

		GameObject gui = GameObject.FindGameObjectWithTag ("_gui_");
		if(gui != null){
			my_game_uGUI = GameObject.FindGameObjectWithTag("_gui_").GetComponent<game_uGUI>();
			
		}

		/*int health = StoreInventory.GetItemBalance ("health");

		if (health != 0) {
			healtcount = StoreInventory.GetItemBalance ("health");
		}
		int healthx2 = StoreInventory.GetItemBalance ("healthx2");
		int healtcountx2 = 0;
		if (healthx2 != 0) {
			healtcount = StoreInventory.GetItemBalance ("healthx2");
		}
		int healthx3 = StoreInventory.GetItemBalance ("healthx3");
		int healtcountx3 = 0;
		if (healthx3 != 0) {
			healtcount = StoreInventory.GetItemBalance ("healthx3");
		}

		*/

		if (game_master.game_master_obj)
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
	}
Esempio n. 5
0
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        //create and arrays
        child_count   = this.transform.childCount;
        rank_items    = new score_rank_item[child_count];
        sort_scores   = new int[child_count];
        sort_names    = new string[child_count];
        name_assigned = new bool[child_count];

        //load data
        for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++)
        {
            my_game_master.best_int_score_for_current_player[i] = PlayerPrefs.GetInt("profile_" + i.ToString() + "_best_int_score_for_this_profile");
            my_game_master.profile_name[i] = PlayerPrefs.GetString("profile_" + i.ToString() + "_name");
            //Debug.Log("["+i+"] originale: " + my_game_master.best_int_score_for_current_player[i] + " " + my_game_master.profile_name[i] + " ... " + my_game_master.this_profile_have_a_save_state_in_it[i]);
            //Debug.Log("["+i+"] copia: " + sort_scores[i]);
        }

        //fill arrays
        Array.Copy(my_game_master.best_int_score_for_current_player, sort_scores, my_game_master.number_of_save_profile_slot_avaibles);
        Array.Sort(sort_scores);
        Array.Reverse(sort_scores);

        /*
         * for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++)
         * {
         *      //Debug.Log("["+i+"] originale: " + my_game_master.best_int_score_for_current_player[i]);
         *      Debug.Log("["+i+"] copia riordinata: " + sort_scores[i]);
         * }*/

        for (int i = 0; i < child_count; i++)
        {
            rank_items[i] = (score_rank_item)this.transform.GetChild(i).GetComponent <score_rank_item>();
        }

        for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++)
        {
            if (i < my_game_master.number_of_save_profile_slot_avaibles && my_game_master.this_profile_have_a_save_state_in_it[i])            //is there is a save profile here
            {
                for (int n = 0; n < child_count; n++)
                {
                    if (my_game_master.best_int_score_for_current_player[i] == sort_scores[n] && !name_assigned[n])
                    {
                        //Debug.Log(sort_scores[n] + " == " + my_game_master.best_int_score_for_current_player[i] + " : " + my_game_master.profile_name[i]);
                        sort_names[n]    = my_game_master.profile_name[i];
                        name_assigned[n] = true;
                        break;
                    }
                }
            }
        }


        Update_local();
    }
	public void My_start()
	{
		if (game_master.game_master_obj && my_game_master == null)
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");


		if (Check_if_show_this_button())
			{
			Debug.Log(give_this_selected + " id " + my_item_ID);
			my_name_tx.text = my_name;
			my_ico_img.sprite = my_ico;

			if (price_currency_selected == price_currency.real_money)
				{
				my_money_ico_img.sprite = real_money_ico;
				you_have_enough_money = true;
				}
			else if (price_currency_selected == price_currency.virtual_money)
				{
				my_money_ico_img.sprite = virtual_money_ico;
				Check_if_you_have_enough_virtual_money();
				}

			my_price_tx.text = my_price.ToString();

			Check_if_this_purchase_dont_hit_the_cap();

			Show_quantity();
			Show_buy_ico();

			}
		else
			this.gameObject.SetActive(false);

	}
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
            {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            //selet the rule
            if (virtual_money_cost <= 0)
                {
                if (my_game_master.my_ads_master.ads_when_reach_a_check_point.this_ad_is_enabled)
                    activation_cost_selected = activation_cost.unity_ad;
                else
                    activation_cost_selected = activation_cost.free;
                }
            else //can use money to activate the checkpoint
                {
                if (my_game_master.my_ads_master.ads_when_reach_a_check_point.this_ad_is_enabled)
                    activation_cost_selected = activation_cost.virtual_money_or_unity_ad;
                //else
                    //activation_cost_selected = activation_cost.virtual_money;
                }
            }

        my_game_uGUI = GameObject.FindGameObjectWithTag("_gui_").GetComponent<game_uGUI>();
        checkpoint_triggered = false;
        checkpoint_enabled = false;
        //base_color = GetComponent<Renderer>().material.color;
    }
    public void My_start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        if (my_world_number < my_game_master.total_stages_in_world_n.Length)
        {
            if (my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.manual)
            {
                my_manage_menu_uGUI = GameObject.Find("Home_Canvas").GetComponent <manage_menu_uGUI>();

                if (my_game_master.total_stages_in_world_n[my_world_number] != stage_icons.Length)
                {
                    Debug.LogError("the number of icons don't match the number of stages in this world ");
                }

                for (int i = 0; i < stage_icons.Length; i++)
                {
                    stage_icons[i].world_number        = my_world_number;
                    stage_icons[i].stage_number        = i + 1;
                    stage_icons[i].my_manage_menu_uGUI = my_manage_menu_uGUI;
                    stage_icons[i].my_game_master      = my_game_master;
                    if ((i + 1) < stage_icons.Length)
                    {
                        stage_icons[i].next_stage_ico = stage_icons[i + 1];
                    }
                    stage_icons[i].My_start();
                }

                Focus_on_first_icon();
            }
        }
    }
Esempio n. 9
0
    public void Update_me()
    {
        if (my_game_master == null)
        {
            if (game_master.game_master_obj)
            {
                my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            }
        }

        if (my_game_master.show_star_score)
        {
            my_stars.GetChild(0).GetComponent <Text>().text = my_game_master.stars_total_score[my_game_master.current_profile_selected].ToString();
        }

        if (!my_game_master.infinite_lives)
        {
            my_lives.GetChild(0).GetComponent <Text>().text = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();
            if ((my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token) && (!my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled))
            {
                my_tokens.GetChild(0).GetComponent <Text>().text = my_game_master.current_continue_tokens[my_game_master.current_profile_selected].ToString();
            }
        }
        my_virtual_money.GetChild(0).GetComponent <Text>().text = my_game_master.current_virtual_money[my_game_master.current_profile_selected].ToString("N0");
    }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            //selet the rule
            if (virtual_money_cost <= 0)
            {
                if (my_game_master.my_ads_master.ads_when_reach_a_check_point.this_ad_is_enabled)
                {
                    activation_cost_selected = activation_cost.unity_ad;
                }
                else
                {
                    activation_cost_selected = activation_cost.free;
                }
            }
            else             //can use money to activate the checkpoint
            {
                if (my_game_master.my_ads_master.ads_when_reach_a_check_point.this_ad_is_enabled)
                {
                    activation_cost_selected = activation_cost.virtual_money_or_unity_ad;
                }
                //else
                //activation_cost_selected = activation_cost.virtual_money;
            }
        }

        checkpoint_triggered = false;
        checkpoint_enabled   = false;
    }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            //selet the rule
            if (virtual_money_cost <= 0)
            {
                if (my_game_master.my_ads_master.ads_when_reach_a_check_point.this_ad_is_enabled)
                {
                    activation_cost_selected = activation_cost.unity_ad;
                }
                else
                {
                    activation_cost_selected = activation_cost.free;
                }
            }
            else             //can use money to activate the checkpoint
            {
                if (my_game_master.my_ads_master.ads_when_reach_a_check_point.this_ad_is_enabled)
                {
                    activation_cost_selected = activation_cost.virtual_money_or_unity_ad;
                }
                //else
                //activation_cost_selected = activation_cost.virtual_money;
            }
        }

        my_game_uGUI         = GameObject.FindGameObjectWithTag("_gui_").GetComponent <game_uGUI>();
        checkpoint_triggered = false;
        checkpoint_enabled   = false;
        //base_color = GetComponent<Renderer>().material.color;
    }
Esempio n. 12
0
    public void Select_this_tab(int tab_id)
    {
        if (tab_selected != tab_id)
            {
            if (tab_selected >= 0)
                my_game_master.Gui_sfx(my_game_master.tap_sfx);

            for (int i = 0; i < tabs_length; i++)
                {
                windows[i].SetActive(false);
                tab_buttons_ico[i].sprite = not_selected_tab;
                }

            windows[tab_id].SetActive(true);
            tab_buttons_ico[tab_id].sprite = selected_tab;
            tab_selected = tab_id;

            if (!my_game_master)
                my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

            if (my_game_master.use_pad)
                Invoke("Focus_on_first_button_of_this_window",0.1f);

            }
    }
Esempio n. 13
0
    public void Show_info_bar(bool show)
    {
        if (show)
            {
            this.gameObject.SetActive(true);

            if (my_game_master == null)
                {
                if (game_master.game_master_obj)
                    my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
                }

            //show star score
            if (my_game_master.show_star_score)
                {
                my_stars.gameObject.SetActive(true);
                my_stars.GetChild(0).GetComponent<Text>().text = my_game_master.stars_total_score[my_game_master.current_profile_selected].ToString("N0");
                }
            else
                my_stars.gameObject.SetActive(false);

            //show lives
            if (my_game_master.infinite_lives)
                {
                my_lives.gameObject.SetActive(false);
                my_tokens.gameObject.SetActive(false);
                }
            else
                {
                my_lives.gameObject.SetActive(true);
                my_lives.GetChild(0).GetComponent<Text>().text = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();

                if ((my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token) && (!my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled))
                    {
                    my_tokens.gameObject.SetActive(true);
                    my_tokens.GetChild(0).GetComponent<Text>().text = my_game_master.current_continue_tokens[my_game_master.current_profile_selected].ToString();
                    }
                else
                    my_tokens.gameObject.SetActive(false);
                }

            //show virtual money
            if (my_game_master.store_enabled)
                {
                my_virtual_money.gameObject.SetActive(true);
                my_virtual_money.GetChild(0).GetComponent<Text>().text = my_game_master.current_virtual_money[my_game_master.current_profile_selected].ToString("N0");
                if (my_game_master.can_buy_virtual_money_with_real_money)
                    my_virtual_money.GetChild(1).gameObject.SetActive(true);
                else
                    my_virtual_money.GetChild(1).gameObject.SetActive(false);
                }
            else
                my_virtual_money.gameObject.SetActive(false);
            }
        else
            {
            this.gameObject.SetActive(false);
            }
    }
Esempio n. 14
0
 // Use this for initialization
 void Start()
 {
     if (game_master.game_master_obj)
     {
         my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
         my_text.text   = my_game_master.current_stage.ToString();
     }
 }
Esempio n. 15
0
 // Use this for initialization
 void Start()
 {
     if (game_master.game_master_obj)
         {
         my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
         my_ico.sprite = my_game_master.my_store_item_manager.consumable_item_list[item_id].icon;
         my_quantity.text = my_game_master.consumable_item_current_quantity[my_game_master.current_profile_selected][item_id].ToString("N0");
         }
 }
Esempio n. 16
0
	void Start()
	{
		if (game_master.game_master_obj)
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

		//create and arrays
		child_count = this.transform.childCount;
		rank_items = new score_rank_item[child_count];
		sort_scores = new int[child_count];
		sort_names = new string[child_count];
		name_assigned = new bool[child_count];

		//load data
		for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++)
			{
			my_game_master.best_int_score_for_current_player[i] = PlayerPrefs.GetInt("profile_"+i.ToString()+"_best_int_score_for_this_profile");
			my_game_master.profile_name[i] = PlayerPrefs.GetString("profile_"+i.ToString()+"_name");
			//Debug.Log("["+i+"] originale: " + my_game_master.best_int_score_for_current_player[i] + " " + my_game_master.profile_name[i] + " ... " + my_game_master.this_profile_have_a_save_state_in_it[i]);
			//Debug.Log("["+i+"] copia: " + sort_scores[i]);
			long longscore = Convert.ToInt64(long.Parse(my_game_master.best_int_score_for_current_player.GetValue(i).ToString()));
			long l = longscore;
			}

		//fill arrays
		Array.Copy(my_game_master.best_int_score_for_current_player,sort_scores,my_game_master.number_of_save_profile_slot_avaibles);
		Array.Sort(sort_scores);
		Array.Reverse(sort_scores);
		/*
		for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++)
		{
			//Debug.Log("["+i+"] originale: " + my_game_master.best_int_score_for_current_player[i]);
			Debug.Log("["+i+"] copia riordinata: " + sort_scores[i]);
		}*/

		for (int i = 0; i < child_count; i++)
			rank_items[i] = (score_rank_item)this.transform.GetChild(i).GetComponent<score_rank_item>();

		for (int i = 0; i < my_game_master.number_of_save_profile_slot_avaibles; i++)
			{
			if (i < my_game_master.number_of_save_profile_slot_avaibles && my_game_master.this_profile_have_a_save_state_in_it[i])//is there is a save profile here
				{
				for (int n = 0; n < child_count; n++)
					{
					if (my_game_master.best_int_score_for_current_player[i] == sort_scores[n] && !name_assigned[n])
								{
								//Debug.Log(sort_scores[n] + " == " + my_game_master.best_int_score_for_current_player[i] + " : " + my_game_master.profile_name[i]);
								sort_names[n] = my_game_master.profile_name[i];
								name_assigned[n] = true;
								break;
								}
					}
				}
			}
			

		Update_local();
	}
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     if (game_master.game_master_obj)
     {
         my_game_master   = (game_master)game_master.game_master_obj.GetComponent("game_master");
         my_ico.sprite    = my_game_master.my_store_item_manager.consumable_item_list[item_id].icon;
         my_quantity.text = my_game_master.consumable_item_current_quantity[my_game_master.current_profile_selected][item_id].ToString("N0");
     }
 }
Esempio n. 18
0
    public void Start_me()
    {
        yes_button.SetActive(true);
        watch_button.SetActive(false);

        initial_time_scale = Time.timeScale;
        Time.timeScale     = 1 * time_scale_multiplier;


        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

            Debug.Log("check if continue [Time.timeScale = " + Time.timeScale + "]");
        }

        if (my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token &&
            my_game_master.current_continue_tokens[my_game_master.current_profile_selected] <= 0)
        {
            if (my_game_uGUI.show_debug_messages)
            {
                Debug.Log("you can't continue");
            }
            Continue_no(true);
        }
        else
        {
            if (my_game_uGUI.show_debug_messages)
            {
                Debug.Log("you can continue");
            }

            Update_heading();
            game_uGUI.in_pause         = true;
            game_uGUI.allow_game_input = false;
            can_take_input             = true;

            this.gameObject.SetActive(true);

            if (my_game_master.continue_menu_have_countdown)
            {
                my_timer.text = my_game_master.continue_menu_countdown_seconds.ToString();
                stop_timer    = false;
                StartCoroutine(Countdown(my_game_master.continue_menu_countdown_seconds));
                my_timer.gameObject.SetActive(true);
            }
            else
            {
                my_timer.gameObject.SetActive(false);
            }

            my_game_uGUI.Invoke("Mark_continue", 0.1f * time_scale_multiplier);
            //my_game_uGUI.Mark_this_button(my_game_uGUI.continue_window_target_button);
        }
    }
Esempio n. 19
0
	void Generate_consumable_items()
	{
		if (game_master.game_master_obj && !store_button_generated)
		{
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
			for (int i = 0; i < my_game_master.my_store_item_manager.consumable_item_list.Length; i++)
			{
			//check if this item is avaible at this phase of the game
				if ((my_game_master.my_store_item_manager.consumable_item_list[i].avaible_from_world <= my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected]) //world
					&& (my_game_master.my_store_item_manager.consumable_item_list[i].avaible_from_stage <= my_game_master.play_this_stage_to_progress_in_the_game_stage[my_game_master.current_profile_selected]))//stage
					{
					//if the player can buy more item like this...
					if  (my_game_master.show_consumable_item_even_if_cap_reached
						|| (my_game_master.consumable_item_current_quantity[my_game_master.current_profile_selected][i] < my_game_master.my_store_item_manager.consumable_item_list[i].quantity_cap))
						{
						GameObject temp_button = (GameObject)Instantiate(store_button_obj);
						temp_button.transform.SetParent(this.transform,false);
						
						store_button button_script = temp_button.GetComponent<store_button>();



						button_script.my_item_ID = i;
						button_script.my_name = my_game_master.my_store_item_manager.consumable_item_list[i].name;

						button_script.my_ico = my_game_master.my_store_item_manager.consumable_item_list[i].icon;

						//set quantity
						button_script.quantity = 1;
						
						//set price
						button_script.my_price = my_game_master.my_store_item_manager.consumable_item_list[i].price;
						
						if (my_game_master.my_store_item_manager.consumable_item_list[i].require_real_money){
							button_script.price_currency_selected = global::store_button.price_currency.real_money;
						
						}else{
							button_script.price_currency_selected = global::store_button.price_currency.virtual_money;
						
						}

						button_script.show_quantity = false;
						button_script.give_this_selected = global::store_button.give_this.consumable_item;
						button_script.My_start();


						}
					}
			}

		}


	}
Esempio n. 20
0
 public void My_start()
 {
     if (stage_icons.Length > 0)
     {
         if (game_master.game_master_obj)
         {
             my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
             my_game_master.current_world[my_game_master.current_profile_selected] = my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected];
             Update_page();
         }
     }
 }
Esempio n. 21
0
    public void My_start()
    {
        if (stage_icons.Length > 0)
        {
            if (game_master.game_master_obj)
            {
                my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
                my_game_master.current_world[my_game_master.current_profile_selected] = my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected];
                Update_page();
            }

        }
    }
Esempio n. 22
0
	public void My_start()
	{
		manager_linear_map_obj = this.gameObject;
		DontDestroyOnLoad(manager_linear_map_obj);

		if (stage_icons.Length > 0)
			{
			if (game_master.game_master_obj)
				my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
		
			my_manage_menu_uGUI = GameObject.Find("Home_Canvas").GetComponent<manage_menu_uGUI>();
		
			if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.map)//if the map is in use
				{
				if (my_game_master.total_number_of_stages_in_the_game != stage_icons.Length)
					{
						Debug.LogError("the number of icons don't match the total number of stages in the game");
					}
				else
					{
					int temp_current_world = 0;
					int temp_stage_conut = 1;
					for (int i = 0; i < stage_icons.Length; i++)
						{
						//check if this stage icon belong to this world of if you must pass to next world
						if (temp_stage_conut  <= my_game_master.total_stages_in_world_n[temp_current_world])
							{
							//Debug.Log("same world " + temp_current_world +","+temp_stage_conut);
							Update_this_icon(i,temp_current_world,temp_stage_conut);
							temp_stage_conut++;
							}
						else//next world
							{
							temp_current_world++;
							temp_stage_conut = 1;
							//Debug.Log("new world " + temp_current_world +","+temp_stage_conut);
							Update_this_icon(i,temp_current_world,temp_stage_conut);
							temp_stage_conut++;
							}
						}
					
					}
				}

			my_manage_menu_uGUI.stage_screen_target_button = stage_icons[0].gameObject;
			if (this.gameObject.activeSelf)
				my_manage_menu_uGUI.Mark_this_button(my_manage_menu_uGUI.stage_screen_target_button);
			}

	}
Esempio n. 23
0
    void Generate_consumable_items()
    {
        if (game_master.game_master_obj && !store_button_generated)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            for (int i = 0; i < my_game_master.my_store_item_manager.consumable_item_list.Length; i++)
            {
                //check if this item is avaible at this phase of the game
                if ((my_game_master.my_store_item_manager.consumable_item_list[i].avaible_from_world <= my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected]) &&              //world
                    (my_game_master.my_store_item_manager.consumable_item_list[i].avaible_from_stage <= my_game_master.play_this_stage_to_progress_in_the_game_stage[my_game_master.current_profile_selected]))                       //stage
                {
                    //if the player can buy more item like this...
                    if (my_game_master.show_consumable_item_even_if_cap_reached ||
                        (my_game_master.consumable_item_current_quantity[my_game_master.current_profile_selected][i] < my_game_master.my_store_item_manager.consumable_item_list[i].quantity_cap))
                    {
                        GameObject temp_button = (GameObject)Instantiate(store_button_obj);
                        temp_button.transform.SetParent(this.transform, false);

                        store_button button_script = temp_button.GetComponent <store_button>();

                        button_script.my_item_ID = i;
                        button_script.my_name    = my_game_master.my_store_item_manager.consumable_item_list[i].name;

                        button_script.my_ico = my_game_master.my_store_item_manager.consumable_item_list[i].icon;

                        //set quantity
                        button_script.quantity = 1;

                        //set price
                        button_script.my_price = my_game_master.my_store_item_manager.consumable_item_list[i].price;

                        if (my_game_master.my_store_item_manager.consumable_item_list[i].require_real_money)
                        {
                            button_script.price_currency_selected = global::store_button.price_currency.real_money;
                        }
                        else
                        {
                            button_script.price_currency_selected = global::store_button.price_currency.virtual_money;
                        }



                        button_script.show_quantity      = false;
                        button_script.give_this_selected = global::store_button.give_this.consumable_item;
                        button_script.My_start();
                    }
                }
            }
        }
    }
Esempio n. 24
0
    public void ResetWinScreen(game_master _my_game_master, int _total_collectable_stars_in_this_stage, bool _show_int_score)
    {
        this.gameObject.SetActive(false);

        total_collectable_stars_in_this_stage = _total_collectable_stars_in_this_stage;
        my_game_master = _my_game_master;
        show_int_score = _show_int_score;

        currentUISkin.GetEmoticon(UI_Skin.EndScreenEmotion.Normal);
        for (int i = 0; i < 3; i++)
        {
            stars_on[i].transform.localScale = Vector3.zero;
            stars_on[i].SetActive(false);
        }
    }
Esempio n. 25
0
    public void My_start()
    {
        if (stage_icons.Length > 0)
        {
            if (game_master.game_master_obj)
            {
                my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            }

            my_manage_menu_uGUI = GameObject.Find("Home_Canvas").GetComponent <manage_menu_uGUI>();

            if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.map)            //if the map is in use
            {
                if (my_game_master.total_number_of_stages_in_the_game != stage_icons.Length)
                {
                    Debug.LogError("the number of icons don't match the total number of stages in the game");
                }
                else
                {
                    int temp_current_world = 0;
                    int temp_stage_conut   = 1;
                    for (int i = 0; i < stage_icons.Length; i++)
                    {
                        //check if this stage icon belong to this world of if you must pass to next world
                        if (temp_stage_conut <= my_game_master.total_stages_in_world_n[temp_current_world])
                        {
                            //Debug.Log("same world " + temp_current_world +","+temp_stage_conut);
                            Update_this_icon(i, temp_current_world, temp_stage_conut);
                            temp_stage_conut++;
                        }
                        else                        //next world
                        {
                            temp_current_world++;
                            temp_stage_conut = 1;
                            //Debug.Log("new world " + temp_current_world +","+temp_stage_conut);
                            Update_this_icon(i, temp_current_world, temp_stage_conut);
                            temp_stage_conut++;
                        }
                    }
                }
            }
            my_manage_menu_uGUI.stage_screen_target_button = stage_icons[0].gameObject;
            if (this.gameObject.activeSelf)
            {
                my_manage_menu_uGUI.Mark_this_button(my_manage_menu_uGUI.stage_screen_target_button);
            }
        }
    }
Esempio n. 26
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            if (my_game_master.use_pad)
            {
                my_button = this.gameObject.GetComponent <Button>();

                var target = my_button.colors;
                target.normalColor      = my_game_master.normal_button_color;
                target.highlightedColor = my_game_master.highlighted_button_color;
                my_button.colors        = target;
            }
        }
    }
Esempio n. 27
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
            {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            if (my_game_master.use_pad)
                {
                my_button = this.gameObject.GetComponent<Button>();

                var target = my_button.colors;
                target.normalColor = my_game_master.normal_button_color;
                target.highlightedColor = my_game_master.highlighted_button_color;
                my_button.colors = target;
                }
            }
    }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(this);
     // // * testing
     // _isSave = false;
     _state       = new base_state();
     _isDeveloper = false;
 }
Esempio n. 29
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            buy_money_tab.SetActive(my_game_master.can_buy_virtual_money_with_real_money);
        }

        tabs_length = 0;
        for (int i = 0; i < this.transform.childCount; i++)
        {
            if (this.transform.GetChild(i).gameObject.activeSelf)
            {
                tabs_length++;
            }
        }
    }
Esempio n. 30
0
    public void Start_me(int my_id)
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        button_id = my_id;

        my_gift_manager.gift_buttons_is_active++;
        this.gameObject.SetActive(true);

        //show ico
        switch (give_this_selected)
        {
        case ads_master.ad_reward.virtual_money:
            my_ico.sprite = my_gift_manager.virtual_money_ico;
            break;

        case ads_master.ad_reward.new_live:
            my_ico.sprite = my_gift_manager.live_ico;
            break;

        case ads_master.ad_reward.consumable_item:
            my_ico.sprite = my_game_master.my_store_item_manager.consumable_item_list[item_id].icon;
            break;
        }


        //decide if you need to show quantity
        if (quantity > 1)
        {
            quantity_text.gameObject.SetActive(true);
            quantity_text.text = quantity.ToString("N0");
        }
        else
        {
            quantity_text.gameObject.SetActive(false);
        }

        if (my_gift_manager.gift_buttons_is_active == 1)
        {
            my_gift_manager.Select_this_button(my_id);
        }
    }
Esempio n. 31
0
    public void My_start()
    {
        if (game_master.game_master_obj)
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

        my_manage_menu_uGUI = GameObject.Find("Home_Canvas").GetComponent<manage_menu_uGUI>();

        if (my_game_master.total_stages_in_world_n.Length != world_icons.Length)
            Debug.LogError("the length of game_master._total_stages_in_world_n and manual_world_screen.world_icons MUST be the same");

        for (int i = 0; i < world_icons.Length; i++)
            {
            world_icons[i].my_number = i;
            world_icons[i].my_manage_menu_uGUI = my_manage_menu_uGUI;
            world_icons[i].my_game_master = my_game_master;
            world_icons[i].My_start();
            }
    }
Esempio n. 32
0
    public void Start_me()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

            //music
            my_game_master.Music_on_off(game_master.music_on[my_game_master.current_profile_selected]);

            //sfx
            my_game_master.Sfx_on_off(game_master.sfx_on[my_game_master.current_profile_selected]);

            //voice
            my_game_master.Voice_on_off(game_master.voice_on[my_game_master.current_profile_selected]);

            Update_sound_icons();
        }
    }
Esempio n. 33
0
    public void Start_me(Sprite ico, int quantity, string name)
    {
        //start pause
        currentTimeScale = 1;
        Time.timeScale = 0;

        if (game_master.game_master_obj)
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

        my_game_master.a_window_is_open = true;

        my_ico.sprite = ico;
        my_quantity.text = quantity.ToString("N0");
        my_name.text = name;
        this.gameObject.SetActive(true);

        if (my_game_master.use_pad)
            EventSystem_obj.SetActive(false);//in order to avoid pad input out the of the window
    }
Esempio n. 34
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        //search all buttons that you must manage
        total_buttons  = this.transform.childCount;
        profiles_array = new profile_button[total_buttons];
        for (int i = 0; i < total_buttons; i++)
        {
            Transform       temp_childeren = this.transform.GetChild(i);
            profile_manager this_script    = this.GetComponent <profile_manager>();

            if (i < my_game_master.number_of_save_profile_slot_avaibles)
            {
                temp_childeren.gameObject.SetActive(true);
                profiles_array[i] = temp_childeren.GetComponent <profile_button>();
                profiles_array[i].my_profile_manager = this_script;
                profiles_array[i].my_game_master     = my_game_master;
                profiles_array[i].Start_me(i);


                if (my_game_master.this_profile_have_a_save_state_in_it[i])
                {
                    my_game_master.Load(i);

                    Update_this_slot(i);
                }
                else
                {
                    profiles_array[i].Set_off();
                }
            }
            else
            {
                temp_childeren.gameObject.SetActive(false);
            }
        }

        initialized = true;
    }
Esempio n. 35
0
    // Use this for initialization
    public void My_start(int profile_target_slot, bool show_cancel_button, GameObject my_target_button)
    {
        if (game_master.game_master_obj)
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

        if (show_cancel_button)
        {
            only_ok_button.SetActive(false);
            ok_and_cancel_button.SetActive(true);
        }
        else
        {
            only_ok_button.SetActive(true);
            ok_and_cancel_button.SetActive(false);
        }

        profile_slot = profile_target_slot;
        this.gameObject.SetActive(true);
        select_this_button_when_close_me = my_target_button;
    }
Esempio n. 36
0
	public void Start_me()
	{

		if (game_master.game_master_obj)
		{
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

			//music
			my_game_master.Music_on_off(game_master.music_on[my_game_master.current_profile_selected]);

			//sfx
			my_game_master.Sfx_on_off(game_master.sfx_on[my_game_master.current_profile_selected]);

			//voice
			my_game_master.Voice_on_off(game_master.voice_on[my_game_master.current_profile_selected]);

			Update_sound_icons();


		}
	}
Esempio n. 37
0
    public void My_start()
    {
        if (game_master.game_master_obj && my_game_master == null)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }


        if (Check_if_show_this_button())
        {
            if (my_game_master.show_debug_messages)
            {
                Debug.Log(give_this_selected + " id " + my_item_ID);
            }
            my_name_tx.text   = my_name;
            my_ico_img.sprite = my_ico;

            if (price_currency_selected == price_currency.real_money)
            {
                my_money_ico_img.sprite = real_money_ico;
                you_have_enough_money   = true;
            }
            else if (price_currency_selected == price_currency.virtual_money)
            {
                my_money_ico_img.sprite = virtual_money_ico;
                Check_if_you_have_enough_virtual_money();
            }

            my_price_tx.text = my_price.ToString();

            Check_if_this_purchase_dont_hit_the_cap();

            Show_quantity();
            Show_buy_ico();
        }
        else
        {
            this.gameObject.SetActive(false);
        }
    }
Esempio n. 38
0
    public void My_start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        my_manage_menu_uGUI = GameObject.Find("Home_Canvas").GetComponent <manage_menu_uGUI>();

        if (my_game_master.total_stages_in_world_n.Length != world_icons.Length)
        {
            Debug.LogError("the length of game_master._total_stages_in_world_n and manual_world_screen.world_icons MUST be the same");
        }

        for (int i = 0; i < world_icons.Length; i++)
        {
            world_icons[i].my_number           = i;
            world_icons[i].my_manage_menu_uGUI = my_manage_menu_uGUI;
            world_icons[i].my_game_master      = my_game_master;
            world_icons[i].My_start();
        }
    }
Esempio n. 39
0
    // Use this for initialization
    public void My_start(int profile_target_slot, bool show_cancel_button, GameObject my_target_button)
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        if (show_cancel_button)
        {
            only_ok_button.SetActive(false);
            ok_and_cancel_button.SetActive(true);
        }
        else
        {
            only_ok_button.SetActive(true);
            ok_and_cancel_button.SetActive(false);
        }

        profile_slot = profile_target_slot;
        this.gameObject.SetActive(true);
        select_this_button_when_close_me = my_target_button;
    }
Esempio n. 40
0
    public void Start_me(Sprite ico, int quantity, string name)
    {
        //start pause
        currentTimeScale = 1;
        Time.timeScale   = 0;

        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }

        my_game_master.a_window_is_open = true;

        my_ico.sprite    = ico;
        my_quantity.text = quantity.ToString("N0");
        my_name.text     = name;
        this.gameObject.SetActive(true);

        if (my_game_master.use_pad)
        {
            EventSystem_obj.SetActive(false);            //in order to avoid pad input out the of the window
        }
    }
Esempio n. 41
0
	public void Call_ad(ad_options target_ad)
	{
		my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

		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");
			}
		}
	}
Esempio n. 42
0
 // Use this for initialization
 void Start()
 {
     if (game_master.game_master_obj)
         my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
 }
Esempio n. 43
0
	void Start () {
		int max_stages_in_a_world = 15;
		//save game
		GooglePlaySavedGamesManager.ActionNewGameSaveRequest += ActionNewGameSaveRequest;
		GooglePlaySavedGamesManager.ActionGameSaveLoaded += ActionGameSaveLoaded;
		GooglePlaySavedGamesManager.ActionConflict += ActionConflict;

		if(GooglePlayConnection.State == GPConnectionState.STATE_CONNECTED) {
			//GooglePlayConnection.Instance.Disconnect ();
			
		} else {
			GooglePlayConnection.Instance.Connect ();
		}


		if (functioncalled != "ShareFB" || functioncalled != "LikePage" || functioncalled != "RateDialogPopUp"  || functioncalled !="showAchievementsUI") {
			if (callfunction) {
				Invoke (functioncalled, 0);
			}
		}
		my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
		if (Application.loadedLevelName == "Home") {
			my_manage_menu_uGUI = GameObject.Find ("Home_Canvas").GetComponent<manage_menu_uGUI> ();
		}


		world_playable = new bool[1][];
		world_purchased = new bool[1][];
		stage_playable = new bool[1][,];
		stage_solved = new bool[1][,];
		all_stages_solved = new bool[1];
		dot_tail_turn_on = new bool[1][,];
		stage_stars_score = new int[1][,];
		star_score_in_this_world = new int[1][];
		stars_total_score = new int[1];
		best_int_score_in_this_stage = new int[1][,];
		best_int_score_for_current_player = new int[1];
		
		incremental_item_current_level= new int[1][];
		
		consumable_item_current_quantity = new int[1][];
		
		for (int i = 0; i < 1; i++)
		{
			incremental_item_current_level[i] = new int[my_game_master.my_store_item_manager.incremental_item_list.Length];
			
			consumable_item_current_quantity[i] = new int[my_game_master.my_store_item_manager.consumable_item_list.Length];
			
			world_playable[i] = new bool[my_game_master.total_stages_in_world_n.Length];
			world_purchased[i] = new bool[my_game_master.total_stages_in_world_n.Length];
			stage_playable[i] = new bool[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			stage_solved[i] = new bool[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			stage_stars_score[i] = new int[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			star_score_in_this_world[i] = new int[my_game_master.total_stages_in_world_n.Length];
			best_int_score_in_this_stage[i] = new int[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world]; 
			dot_tail_turn_on[i] = new bool[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			
			//this_profile_have_a_save_state_in_it[i] = Convert.ToBoolean(PlayerPrefs.GetInt("profile_"+i.ToString()+"_have_a_save_state_in_it")) ;
			/*if (my_store_item_manager)
			{
				incremental_item_current_level[i] = new int[my_store_item_manager.incremental_item_list.Length]; 
				consumable_item_current_quantity[i] = new int[my_store_item_manager.consumable_item_list.Length];
			}*/
		}
	//	SPFacebook.Instance.OnInitCompleteAction += OnInit;
	//	SPFacebook.Instance.OnFocusChangedAction += OnFocusChanged;
		
		
	//	SPFacebook.Instance.OnAuthCompleteAction += OnAuth;
		
		
		
	//	SPFacebook.Instance.OnPostingCompleteAction += OnPost;

		
	//	SPFacebook.Instance.Init();


	
	}
Esempio n. 44
0
    public void Show_info_bar(bool show)
    {
        if (show)
        {
            this.gameObject.SetActive(true);

            if (my_game_master == null)
            {
                if (game_master.game_master_obj)
                {
                    my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
                }
            }

            //show star score
            if (my_game_master.show_star_score)
            {
                my_stars.gameObject.SetActive(true);
                my_stars.GetChild(0).GetComponent <Text>().text = my_game_master.stars_total_score[my_game_master.current_profile_selected].ToString("N0");
            }
            else
            {
                my_stars.gameObject.SetActive(false);
            }

            //show lives
            if (my_game_master.infinite_lives)
            {
                my_lives.gameObject.SetActive(false);
                my_tokens.gameObject.SetActive(false);
            }
            else
            {
                my_lives.gameObject.SetActive(true);
                my_lives.GetChild(0).GetComponent <Text>().text = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();

                if ((my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token) && (!my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled))
                {
                    my_tokens.gameObject.SetActive(true);
                    my_tokens.GetChild(0).GetComponent <Text>().text = my_game_master.current_continue_tokens[my_game_master.current_profile_selected].ToString();
                }
                else
                {
                    my_tokens.gameObject.SetActive(false);
                }
            }

            //show virtual money
            if (my_game_master.store_enabled)
            {
                my_virtual_money.gameObject.SetActive(true);
                my_virtual_money.GetChild(0).GetComponent <Text>().text = my_game_master.current_virtual_money[my_game_master.current_profile_selected].ToString("N0");
                if (my_game_master.can_buy_virtual_money_with_real_money)
                {
                    my_virtual_money.GetChild(1).gameObject.SetActive(true);
                }
                else
                {
                    my_virtual_money.GetChild(1).gameObject.SetActive(false);
                }
            }
            else
            {
                my_virtual_money.gameObject.SetActive(false);
            }
        }
        else
        {
            this.gameObject.SetActive(false);
        }
    }
Esempio n. 45
0
    // Use this for initialization
    void Start()
    {
        my_options      = options_screen.GetComponent <options_menu>();
        normal_emoticon = perfect_target.sprite;

        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            my_game_master.my_ads_master.my_game_uGUI = this;
        }

        if (my_game_master)
        {
            //set ads gui
            my_game_master.my_ads_master.Initiate_ads();
            my_game_master.my_ads_master.my_feedback_window = my_feedback_window;
            my_game_master.my_ads_master.my_gift_manager    = my_gift_manager;
            my_gift_manager.my_game_master = my_game_master;

            //star score
            if (!ignore_game_master_preferences)
            {
                show_star_score   = my_game_master.show_star_score;
                show_progress_bar = my_game_master.show_progres_bar;
                //int score
                show_int_score = my_game_master.show_int_score;
            }
            show_stage_record = my_game_master.show_int_score_stage_record_in_game_stage;


            if (my_game_master.score_name != "")
            {
                int_score_ico.GetComponent <Text>().text = my_game_master.score_name;
            }

            if (!ignore_game_master_preferences)
            {
                show_debug_messages = my_game_master.show_debug_messages;
                show_debug_warnings = my_game_master.show_debug_warnings;
            }

            my_game_master.latest_stage_played_world[my_game_master.current_profile_selected] = n_world;
            my_game_master.latest_stage_played_stage[my_game_master.current_profile_selected] = n_stage;


            my_game_master.current_world[my_game_master.current_profile_selected] = n_world - 1;
        }
        else
        {
            temp_score_name = win_screen_int_score_title.text;
            if (show_debug_warnings)
            {
                Debug.LogWarning("In order to allow saves and play music and menu sfx, you must star from Home scene and open this stage using the in game menu");
            }
        }

        //star score
        if (show_star_score)
        {
            star_container.SetActive(true);
        }
        else
        {
            show_star_count = false;
            star_container.SetActive(false);
        }
        if (show_progress_bar)
        {
            my_progress_bar.Start_me(this);
            my_progress_bar.gameObject.SetActive(true);
        }
        else
        {
            my_progress_bar.gameObject.SetActive(false);
        }

        //int score
        if (show_int_score)
        {
            int_score_ico.SetActive(true);
        }
        else
        {
            int_score_ico.SetActive(false);
        }

        Reset_me();
    }
Esempio n. 46
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

        //search all buttons that you must manage
        total_buttons = this.transform.childCount;
        profiles_array = new profile_button[total_buttons];
        for (int i = 0; i < total_buttons; i++)
            {
            Transform temp_childeren = this.transform.GetChild(i);
            profile_manager this_script = this.GetComponent<profile_manager>();

            if (i < my_game_master.number_of_save_profile_slot_avaibles)
                {
                temp_childeren.gameObject.SetActive(true);
                profiles_array[i] = temp_childeren.GetComponent<profile_button>();
                profiles_array[i].my_profile_manager = this_script;
                profiles_array[i].my_game_master = my_game_master;
                profiles_array[i].Start_me(i);

                if (my_game_master.this_profile_have_a_save_state_in_it[i])
                    {
                    my_game_master.Load(i);

                    Update_this_slot(i);
                    }
                else
                    profiles_array[i].Set_off();
                }
            else
                temp_childeren.gameObject.SetActive(false);
            }
    }
Esempio n. 47
0
	public void Start_me()
	{
		yes_button.SetActive(true);
		watch_button.SetActive(false);

		initial_time_scale = Time.timeScale;
		Time.timeScale = 1 * time_scale_multiplier;


		if (game_master.game_master_obj)
			{
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

				Debug.Log("check if continue [Time.timeScale = " + Time.timeScale + "]");
			}

		if (my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token
		    && my_game_master.current_continue_tokens[my_game_master.current_profile_selected] <= 0)
			{
			if (my_game_uGUI.show_debug_messages)
				Debug.Log("you can't continue");
			Continue_no(true);
			}
		else
			{
			if (my_game_uGUI.show_debug_messages)
				Debug.Log("you can continue");

			Update_heading();
			game_uGUI.in_pause = true;
			game_uGUI.allow_game_input = false;
			can_take_input = true;

			this.gameObject.SetActive(true);

			if (my_game_master.continue_menu_have_countdown)
			{
				my_timer.text = my_game_master.continue_menu_countdown_seconds.ToString();
			
				stop_timer = false;
				StartCoroutine(Countdown(my_game_master.continue_menu_countdown_seconds));
				my_timer.gameObject.SetActive(true);
			}
			else
				my_timer.gameObject.SetActive(false);

			my_game_uGUI.Invoke("Mark_continue",0.1f*time_scale_multiplier);
			//my_game_uGUI.Mark_this_button(my_game_uGUI.continue_window_target_button);
			}
	}
Esempio n. 48
0
	public void My_start()
	{
		if (selectButton)
		{
			if(selectButton !=null){
			//get checkbox component
			selCheck = selectButton.GetComponent<Toggle>();			
			if (selCheck) selCheck.group = transform.parent.GetComponent<ToggleGroup>();
			}

		}

		if (game_master.game_master_obj && my_game_master == null)
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");


		//id = my_game_master.my_store_item_manager.consumable_item_list[my_item_ID].id;


		if(SelectedCharacter.bikeselected == true && id == "bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.superbikeselected == true && id == "super_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.partybikeselected == true && id == "party_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.nightmarebikeselected == true && id == "nightmare_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.monsterbikeselected == true && id == "monster_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.monsterbikeselected == true && id == "neon_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.hellbikeselected == true && id == "hell_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		
		if(SelectedCharacter.bluebikeselected == true && id == "blue_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.summerbikeselected == true && id == "summer_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.peacebikeselected == true && id == "peace_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}
		if(SelectedCharacter.sunshinebikeselected == true && id == "sunshine_bike"){
			//selected.SetActive(true);
			if(selectButton !=null)
			selectButton.SetActive(false);
		}

		if (Check_if_show_this_button ()) {
			//if (!selected) {
				Debug.Log (give_this_selected + " id " + my_item_ID);
				my_name_tx.text = my_name;
				my_ico_img.sprite = my_ico;

				if (price_currency_selected == price_currency.real_money) {
					my_money_ico_img.sprite = real_money_ico;
					you_have_enough_money = true;
				} else if (price_currency_selected == price_currency.virtual_money) {
					my_money_ico_img.sprite = virtual_money_ico;
					Check_if_you_have_enough_virtual_money ();
				}

				my_price_tx.text = my_price.ToString ();

				Check_if_this_purchase_dont_hit_the_cap ();

				Show_quantity ();
				Show_buy_ico ();

			//}
		}
		else
			this.gameObject.SetActive(false);

	}
Esempio n. 49
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
            {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            buy_money_tab.SetActive(my_game_master.can_buy_virtual_money_with_real_money);
            }

        tabs_length = 0;
        for (int i = 0; i < this.transform.childCount; i++)
            {
            if (this.transform.GetChild(i).gameObject.activeSelf)
                    tabs_length++;
            }
    }
Esempio n. 50
0
	// Use this for initialization
	void Start () {



		if (game_master.game_master_obj)
			{
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
			my_gift_manager.my_game_master = my_game_master;
			//play music menu again
			my_game_master.music_source.enabled  = true;
			if (my_game_master.my_ads_master)
				{
				my_game_master.my_ads_master.my_feedback_window = my_feedback_window;
				my_game_master.my_ads_master.my_gift_manager = my_gift_manager;
				my_game_master.my_ads_master.my_info_bar = info_bar;
				}
			score_ranck_ico.SetActive(true);
//			score_ranck_ico.SetActive(my_game_master.show_int_score_rank);

			if (my_game_master.my_ads_master.enable_ads)
				Check_internet();
			else
				internet_off_ico.SetActive(false); 
			}


		this_script = this.gameObject.GetComponent("manage_menu_uGUI") as manage_menu_uGUI;
		my_options = options_screen.GetComponent<options_menu>();

		//adjust canvas scale
		my_scale = this.gameObject.GetComponent<CanvasScaler>();
		if (my_scale)
			{
			if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.map)
				my_scale.matchWidthOrHeight = 0.7f;
			else 
				my_scale.matchWidthOrHeight = 0.75f;
			}

		//stage pages
		stages_screen_manual = new Transform[manual_stage_screens_list.childCount];
		for (int i = 0; i < stages_screen_manual.Length; i++)
			stages_screen_manual[i] = manual_stage_screens_list.GetChild(i);

		Setup_stage_page();


		if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.nested_world_stage_select_screen)
			{
			if (my_game_master.total_stages_in_world_n.Length == 1)
				{
				if(my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.automatic)
					{
					Generate_stage_screen(my_game_master.current_world[my_game_master.current_profile_selected]);
					}

				}
			else
				{
				if (my_game_master.world_screen_generation_selected == game_master.world_screen_generation.automatic)
					Generate_world_screen();
				else if (my_game_master.world_screen_generation_selected == game_master.world_screen_generation.manual)
					my_manual_world_screen.My_start();
				}
			}

		info_bar.Show_info_bar(false);

		if (my_game_master.go_to_this_screen == game_master.this_screen.home_screen)//is this scene not is load from a game stage
		{

			//show logo at the start
			if (logo_screen != null && show_logo_for_n_seconds > 0 && !game_master.logo_already_show)
				{
				Mark_current_screen(logo_screen);
				home_screen.gameObject.SetActive(false);
				game_master.logo_already_show = true;

				if (!my_game_master.show_new_profile_window)
					{
					Update_profile_name(true);
					}
				Invoke("Close_logo",show_logo_for_n_seconds);
				}
			else//don't show logo at the start
				{
				if (!game_master.logo_already_show)
					{
					game_master.logo_already_show = true;
					if (!my_game_master.show_new_profile_window)
						{
						Update_profile_name(true);
						if (my_game_master.my_ads_master.Check_app_start_ad_countdown())
							my_game_master.my_ads_master.Call_ad(my_game_master.my_ads_master.ads_just_after_logo_when_game_start_as_daily_reward);
						}
					}
				//start music when the game start
				my_game_master.Start_music(my_game_master.music_menu,true);
				Show_home_screen();
				}
		}
		else if (my_game_master.go_to_this_screen == game_master.this_screen.stage_screen) //return to home stage from a game stage
		{
			if (my_game_master.show_debug_messages)
				Debug.Log("return to home stage from a game stage");

			home_screen.gameObject.SetActive(false);
			//Update_profile_name(true);
			if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.nested_world_stage_select_screen)
				{
				if(my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.automatic)
					{
					Mark_current_screen(stages_screen_automatic);

					Generate_stage_screen(my_game_master.current_world[my_game_master.current_profile_selected]);

					Mark_this_button(stage_screen_target_button);
					}
				else if (my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.manual)
					{
					Mark_current_screen(stages_screen_manual[my_game_master.current_world[my_game_master.current_profile_selected]]);
					}
				}
			else if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.map)
				{
				Mark_current_screen(map_screen);
				}
			else if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.single_screen_with_a_page_for_every_world)
				{
				Mark_current_screen(multi_page_screen);
				}
			else if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.straight_to_the_next_game_stage)
				{
				Mark_current_screen(home_screen);
				}

			Update_profile_name(true);

			my_game_master.my_ads_master.Call_ad(my_game_master.my_ads_master.ads_when_return_to_home_scene_from_a_stage);

			//start music when retur to home from a game stage
			my_game_master.Start_music(my_game_master.music_menu,true);

		}
	}
Esempio n. 51
0
    public void Start_me_with_ad(ads_master.ad_options target_ad)
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
        }
        else
        {
            if (game_uGUI.current_game_uGUI.show_debug_warnings)
            {
                Debug.LogWarning("You need to open this stage from Home scene in order to see continue with ads");
            }
            return;
        }

        if (target_ad.ignore_minimum_time_interval_between_ads ||
            (my_game_master.my_ads_master.minimum_time_interval_between_ads + my_game_master.my_ads_master.time_of_latest_ad_showed) < Time.realtimeSinceStartup)
        {
            if (game_uGUI.current_game_uGUI.show_debug_messages)
            {
                Debug.Log("ad pass time check");
            }

            if (UnityEngine.Random.Range(1, 100) <= target_ad.chance_to_open_an_ad_here)
            {
                my_game_master.my_ads_master.current_ad = target_ad;

                yes_button.SetActive(false);
                watch_button.SetActive(true);

                initial_time_scale = Time.timeScale;
                Time.timeScale     = 1 * time_scale_multiplier;

                Update_heading();
                game_uGUI.current_game_uGUI.in_pause         = true;
                game_uGUI.current_game_uGUI.allow_game_input = false;
                can_take_input = true;

                this.gameObject.SetActive(true);

                if (my_game_master.continue_menu_have_countdown)
                {
                    my_timer.text = my_game_master.continue_menu_countdown_seconds.ToString();
                    stop_timer    = false;
                    StartCoroutine(Countdown(my_game_master.continue_menu_countdown_seconds));
                    my_timer.gameObject.SetActive(true);
                }
                else
                {
                    my_timer.gameObject.SetActive(false);
                }
            }
            else
            {
                if (game_uGUI.current_game_uGUI.show_debug_messages)
                {
                    Debug.Log("ad - random fail");
                }

                Continue_no(true);
            }
        }
        else
        {
            if (game_uGUI.current_game_uGUI.show_debug_messages)
            {
                Debug.Log("ad don't pass time check");
            }

            Continue_no(true);
        }
    }
Esempio n. 52
0
    // Use this for initialization
    void Start()
    {
        my_options       = options_screen.GetComponent <options_menu>();
        lives_timer_text = lives_timer.transform.GetChild(0).GetComponent <TextMeshProUGUI>();


        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            my_game_master.my_ads_master.my_game_uGUI = this;
        }

        if (my_game_master)
        {
            //set ads gui
            my_game_master.my_ads_master.Initiate_ads();
            my_game_master.my_ads_master.my_feedback_window = my_feedback_window;
            my_game_master.my_ads_master.my_gift_manager    = my_gift_manager;
            my_gift_manager.my_game_master = my_game_master;

            //star score
            if (!ignore_game_master_preferences)
            {
                show_star_score   = my_game_master.show_star_score;
                show_progress_bar = my_game_master.show_progres_bar;
                //int score
                show_int_score = my_game_master.show_int_score;
            }
            show_stage_record = my_game_master.show_int_score_stage_record_in_game_stage;


            if (my_game_master.score_name != "")
            {
                int_score_ico.GetComponent <TextMeshProUGUI>().text = my_game_master.score_name;
            }

            if (!ignore_game_master_preferences)
            {
                show_debug_messages = my_game_master.show_debug_messages;
                show_debug_warnings = my_game_master.show_debug_warnings;
            }

            if (my_game_master.use_same_scene_for_all_stages_in_the_same_world)
            {
                n_stage = my_game_master.current_stage;
            }

            my_game_master.latest_stage_played_world[my_game_master.current_profile_selected] = n_world;
            my_game_master.latest_stage_played_stage[my_game_master.current_profile_selected] = n_stage;


            my_game_master.current_world[my_game_master.current_profile_selected] = n_world - 1;
        }
        else
        {
            temp_score_name = win_screen_int_score_title.text;
            if (show_debug_warnings)
            {
                Debug.LogWarning("In order to allow saves and play music and menu sfx, you must star from Home scene and open this stage using the in game menu");
            }
        }

        //star score
        if (total_collectable_stars_in_this_stage == 0)
        {
            total_collectable_stars_in_this_stage = 3; //defalut value
        }
        if (my_game_master && my_game_master.star_score_rule == game_master.Star_score_rule.EachStageHaveHisOwnStarCap)
        {
            my_game_master.stage_stars_cap_score[my_game_master.current_profile_selected][n_world - 1, n_stage - 1] = total_collectable_stars_in_this_stage;
        }

        if (show_star_score)
        {
            winScreenSkin.star_container.SetActive(true);
        }
        else
        {
            show_star_count = false;
            winScreenSkin.star_container.SetActive(false);
        }
        if (show_progress_bar)
        {
            my_progress_bar.Start_me(this);
            my_progress_bar.gameObject.SetActive(true);
        }
        else
        {
            my_progress_bar.gameObject.SetActive(false);
        }

        //int score
        if (show_int_score)
        {
            int_score_ico.SetActive(true);
        }
        else
        {
            int_score_ico.SetActive(false);
        }

        Reset_me();
    }
Esempio n. 53
0
 // Start is called before the first frame update
 void Start()
 {
     backgroundManager = GameObject.Find("Background Manager");                       // We find the background manager when the portal spawns
     gameMaster        = GameObject.Find("Game Master").GetComponent <game_master>(); // We find the game master script
 }
Esempio n. 54
0
    void Generate_incremental_items()
    {
        if (game_master.game_master_obj && !store_button_generated)
            {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            for (int i = 0; i < my_game_master.my_store_item_manager.incremental_item_list.Length; i++)
                {
                //check if this item is avaible at this phase of the game
                if ((my_game_master.my_store_item_manager.incremental_item_list[i].avaible_from_world <= my_game_master.play_this_stage_to_progress_in_the_game_world[my_game_master.current_profile_selected]) //world
                    && (my_game_master.my_store_item_manager.incremental_item_list[i].avaible_from_stage <= my_game_master.play_this_stage_to_progress_in_the_game_stage[my_game_master.current_profile_selected]))//stage
                    {
                    GameObject temp_button = (GameObject)Instantiate(store_button_obj);
                    temp_button.transform.SetParent(this.transform,false);

                    store_button button_script = temp_button.GetComponent<store_button>();

                    button_script.my_item_ID = i;
                    button_script.my_name = my_game_master.my_store_item_manager.incremental_item_list[i].name;
                    button_script.give_this_selected = global::store_button.give_this.incremental_item;

                    button_script.my_game_master = my_game_master;

                    //if this item not is at the maximum
                    if (my_game_master.incremental_item_current_level[my_game_master.current_profile_selected][i] < my_game_master.my_store_item_manager.incremental_item_list[i].max_level)
                        {

                        //set icon
                        if (my_game_master.my_store_item_manager.incremental_item_list[i].icon.Length > i)
                            button_script.my_ico = my_game_master.my_store_item_manager.incremental_item_list[i].icon[my_game_master.incremental_item_current_level[my_game_master.current_profile_selected][i]];
                        else
                            button_script.my_ico = my_game_master.my_store_item_manager.incremental_item_list[i].icon[0];

                        //set quantity

                        //set price
                        button_script.my_price = my_game_master.my_store_item_manager.incremental_item_list[i].price[my_game_master.incremental_item_current_level[my_game_master.current_profile_selected][i]];

                        if (my_game_master.my_store_item_manager.incremental_item_list[i].require_real_money)
                            button_script.price_currency_selected = global::store_button.price_currency.real_money;
                        else
                            button_script.price_currency_selected = global::store_button.price_currency.virtual_money;

                            //level
                            button_script.show_quantity = true;
                            button_script.quantity = my_game_master.incremental_item_current_level[my_game_master.current_profile_selected][i]+1;

                        }
                    else // max level
                        {
                        button_script.Incremental_item_MAX();
                        }

                    button_script.My_start();

                    }
                }
            }

        store_button_generated = true;
    }
Esempio n. 55
0
	public void Update_me()
	{
		if (my_game_master== null)
		{
			if (game_master.game_master_obj)
				my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
		}

		if (my_game_master.show_star_score)
			my_stars.GetChild(0).GetComponent<Text>().text = my_game_master.stars_total_score[my_game_master.current_profile_selected].ToString();

		if (!my_game_master.infinite_lives)
			{
			my_lives.GetChild(0).GetComponent<Text>().text = my_game_master.current_lives[my_game_master.current_profile_selected].ToString();
			if ((my_game_master.continue_rule_selected == game_master.continue_rule.continue_cost_a_continue_token)&& (!my_game_master.my_ads_master.ads_when_continue_screen_appear.this_ad_is_enabled))
				my_tokens.GetChild(0).GetComponent<Text>().text = my_game_master.current_continue_tokens[my_game_master.current_profile_selected].ToString();
			}
		my_virtual_money.GetChild(0).GetComponent<Text>().text = my_game_master.current_virtual_money[my_game_master.current_profile_selected].ToString("N0");
	}
Esempio n. 56
0
	void Start () {
		int max_stages_in_a_world = 15;


		GetComponent<AudioSource>().volume = 0.4f;
		n_world = Convert.ToInt32(Application.loadedLevelName.Substring(1,1));
		if(Application.loadedLevelName.Length > 10){
		n_stage = Convert.ToInt32(Application.loadedLevelName.Substring(9,2));
		}else{
			n_stage = Convert.ToInt32(Application.loadedLevelName.Substring(9,1));
		}

		isfinish=false;
		in_pause = false;
		GooglePlayConnection.ActionPlayerConnected +=  OnPlayerConnected;
		GooglePlayConnection.ActionPlayerDisconnected += OnPlayerDisconnected;		
		GooglePlayConnection.ActionConnectionResultReceived += OnConnectionResult;
		GooglePlayManager.ActionScoreSubmited += OnScoreSbumitted;

		GooglePlaySavedGamesManager.ActionNewGameSaveRequest += ActionNewGameSaveRequest;
	//	GooglePlaySavedGamesManager.ActionGameSaveLoaded += ActionGameSaveLoaded;
		GooglePlaySavedGamesManager.ActionConflict += ActionConflict;

		if(GooglePlayConnection.State == GPConnectionState.STATE_CONNECTED) {
			//GooglePlayConnection.Instance.Disconnect ();
			
		} else {
			GooglePlayConnection.Instance.Connect ();
		}
		/*
		if(GooglePlayConnection.State == GPConnectionState.STATE_CONNECTED) {
			//GooglePlayConnection.Instance.Disconnect ();
		} else {
			GooglePlayConnection.Instance.Connect ();
		}*/

		my_options = options_screen.GetComponent<options_menu>();

		//normal_emoticon = perfect_target.sprite;


		if (game_master.game_master_obj)
		{
			my_store_item_manager = game_master.game_master_obj.GetComponent<store_item_manager>();
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
			my_game_master.my_ads_master.my_game_uGUI = this;
		}
		funds = my_game_master.current_virtual_money [0];
			//StoreInventory.GetItemBalance("Coins");

		my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");

		world_playable = new bool[1][];
		world_purchased = new bool[1][];
		stage_playable = new bool[1][,];
		stage_solved = new bool[1][,];
		all_stages_solved = new bool[1];
		dot_tail_turn_on = new bool[1][,];
		stage_stars_score = new int[1][,];
		star_score_in_this_world = new int[1][];
		stars_total_score = new int[1];
		best_int_score_in_this_stage = new int[1][,];
		best_int_score_for_current_player = new int[1];

		incremental_item_current_level= new int[1][];
	
		consumable_item_current_quantity = new int[1][];

		for (int i = 0; i < 1; i++)
		{
			incremental_item_current_level[i] = new int[my_game_master.my_store_item_manager.incremental_item_list.Length];
			
			consumable_item_current_quantity[i] = new int[my_game_master.my_store_item_manager.consumable_item_list.Length];

			world_playable[i] = new bool[my_game_master.total_stages_in_world_n.Length];
			world_purchased[i] = new bool[my_game_master.total_stages_in_world_n.Length];
			stage_playable[i] = new bool[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			stage_solved[i] = new bool[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			stage_stars_score[i] = new int[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			star_score_in_this_world[i] = new int[my_game_master.total_stages_in_world_n.Length];
			best_int_score_in_this_stage[i] = new int[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world]; 
			dot_tail_turn_on[i] = new bool[my_game_master.total_stages_in_world_n.Length,max_stages_in_a_world];
			
			//this_profile_have_a_save_state_in_it[i] = Convert.ToBoolean(PlayerPrefs.GetInt("profile_"+i.ToString()+"_have_a_save_state_in_it")) ;
			/*if (my_store_item_manager)
			{
				incremental_item_current_level[i] = new int[my_store_item_manager.incremental_item_list.Length]; 
				consumable_item_current_quantity[i] = new int[my_store_item_manager.consumable_item_list.Length];
			}*/
		}
		Update_virtual_money (funds);

		if (my_game_master)
		{
			//set ads gui
			my_game_master.music_source.Stop();
			my_game_master.my_ads_master.Initiate_ads();
			my_game_master.my_ads_master.my_feedback_window = my_feedback_window;
			my_game_master.my_ads_master.my_gift_manager = my_gift_manager;
			my_gift_manager.my_game_master = my_game_master;
			if(Application.loadedLevelName != "Home"){
			//my_game_master.Start_music(my_game_master.music_menu,false);
				my_game_master.music_source.enabled  = false;
			}
			else{
				my_game_master.music_source.enabled  = true;
				my_game_master.Start_music(my_game_master.music_menu,false);
			}
			//my_game_master.Start_music(my_game_master.music_menu,false);
			//my_game_master.music_menu =null;
			//star score
			if (!ignore_game_master_preferences)
			{
				show_star_score = my_game_master.show_star_score;
				show_progress_bar = my_game_master.show_progres_bar;
				//int score
				show_int_score = my_game_master.show_int_score;
			}
			show_stage_record = my_game_master.show_int_score_stage_record_in_game_stage;
			
			
			if (my_game_master.score_name != "")
				int_score_ico.GetComponent<Text>().text = my_game_master.score_name;
			
			if (!ignore_game_master_preferences)
			{
				show_debug_messages = my_game_master.show_debug_messages;
				show_debug_warnings = my_game_master.show_debug_warnings;
			}
			
			my_game_master.latest_stage_played_world[my_game_master.current_profile_selected] = n_world;
			my_game_master.latest_stage_played_stage[my_game_master.current_profile_selected] = n_stage;
			
			
			my_game_master.current_world[my_game_master.current_profile_selected] = n_world-1;
		}
		else
		{
			temp_score_name = win_screen_int_score_title.text;
			if (show_debug_warnings)
				Debug.LogWarning("In order to allow saves and play music and menu sfx, you must star from Home scene and open this stage using the in game menu");
		}


		//star score
		if (show_star_score)
			star_container.SetActive(true);
		else
		{
			show_star_count = false;
			star_container.SetActive(false);
		}
		if (show_progress_bar)
		{
			my_progress_bar.Start_me(this);
			my_progress_bar.gameObject.SetActive (true);
		}
		else
			my_progress_bar.gameObject.SetActive (false);
		
		//int score
		if (show_int_score)
		{
			int_score_ico.SetActive(true);
		}
		else
			int_score_ico.SetActive(false);
		
		Reset_me();
		if (Application.loadedLevelName == "W1_Stage_1") {
			temptutorial = temptutorial + 1;
			if(temptutorial <= 1){
			Open_tutorial(true);
			}
		}
	}
Esempio n. 57
0
    // Use this for initialization
    void Start()
    {
        if (game_master.game_master_obj)
        {
            my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
            my_gift_manager.my_game_master = my_game_master;

            if (my_game_master.my_ads_master)
            {
                my_game_master.my_ads_master.my_feedback_window = my_feedback_window;
                my_game_master.my_ads_master.my_gift_manager    = my_gift_manager;
                my_game_master.my_ads_master.my_info_bar        = info_bar;
            }

            score_ranck_ico.SetActive(my_game_master.show_int_score_rank);

            if (my_game_master.my_ads_master.enable_ads)
            {
                Check_internet();
            }
            else
            {
                internet_off_ico.SetActive(false);
            }
        }


        this_script = this.gameObject.GetComponent("manage_menu_uGUI") as manage_menu_uGUI;
        my_options  = options_screen.GetComponent <options_menu>();

        //adjust canvas scale
        my_scale = this.gameObject.GetComponent <CanvasScaler>();
        if (my_scale)
        {
            if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.map)
            {
                my_scale.matchWidthOrHeight = 0.7f;
            }
            else
            {
                my_scale.matchWidthOrHeight = 0.75f;
            }
        }

        //stage pages
        stages_screen_manual = new Transform[manual_stage_screens_list.childCount];
        for (int i = 0; i < stages_screen_manual.Length; i++)
        {
            stages_screen_manual[i] = manual_stage_screens_list.GetChild(i);
        }

        Setup_stage_page();


        if (my_game_master.press_start_and_go_to_selected ==
            game_master.press_start_and_go_to.nested_world_stage_select_screen)
        {
            if (my_game_master.total_stages_in_world_n.Length == 1)
            {
                if (my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.automatic)
                {
                    Generate_stage_screen(my_game_master.current_world[my_game_master.current_profile_selected]);
                }
            }
            else
            {
                if (my_game_master.world_screen_generation_selected == game_master.world_screen_generation.automatic)
                {
                    Generate_world_screen();
                }
                else if (my_game_master.world_screen_generation_selected == game_master.world_screen_generation.manual)
                {
                    my_manual_world_screen.My_start();
                }
            }
        }

        info_bar.Show_info_bar(false);

        if (my_game_master.go_to_this_screen == game_master.this_screen.home_screen)
        //is this scene not is load from a game stage
        {
            //show logo at the start
            if (logo_screen != null && show_logo_for_n_seconds > 0 && !game_master.logo_already_show)
            {
                Mark_current_screen(logo_screen);
                home_screen.gameObject.SetActive(false);
                game_master.logo_already_show = true;

                if (!my_game_master.show_new_profile_window)
                {
                    Update_profile_name(true);
                }
                Invoke("Close_logo", show_logo_for_n_seconds);
            }
            else //don't show logo at the start
            {
                if (!game_master.logo_already_show)
                {
                    game_master.logo_already_show = true;
                    if (!my_game_master.show_new_profile_window)
                    {
                        Update_profile_name(true);
                        if (my_game_master.my_ads_master.Check_app_start_ad_countdown())
                        {
                            my_game_master.my_ads_master.Call_ad(
                                my_game_master.my_ads_master.ads_just_after_logo_when_game_start_as_daily_reward);
                        }
                    }
                }
                //start music when the game start
                my_game_master.Start_music(my_game_master.music_menu, true);
                Show_home_screen();
            }
        }
        else if (my_game_master.go_to_this_screen == game_master.this_screen.stage_screen)
        //return to home stage from a game stage
        {
            if (my_game_master.show_debug_messages)
            {
                Debug.Log("return to home stage from a game stage");
            }

            home_screen.gameObject.SetActive(false);
            //Update_profile_name(true);
            if (my_game_master.press_start_and_go_to_selected ==
                game_master.press_start_and_go_to.nested_world_stage_select_screen)
            {
                if (my_game_master.stage_screen_generation_selected == game_master.stage_screen_generation.automatic)
                {
                    //Mark_current_screen(stages_screen_automatic);
                    Go_to_this_world_stage_menu(
                        my_game_master.current_world[my_game_master.current_profile_selected]);
                    //Generate_stage_screen(my_game_master.current_world[my_game_master.current_profile_selected]);

                    Mark_this_button(stage_screen_target_button);
                }
                else if (my_game_master.stage_screen_generation_selected ==
                         game_master.stage_screen_generation.manual)
                {
                    Mark_current_screen(
                        stages_screen_manual[
                            my_game_master.current_world[my_game_master.current_profile_selected]]);
                }
            }
            else if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.map)
            {
                Mark_current_screen(map_screen);
            }
            else if (my_game_master.press_start_and_go_to_selected ==
                     game_master.press_start_and_go_to.single_screen_with_a_page_for_every_world)
            {
                Mark_current_screen(multi_page_screen);
            }
            else if (my_game_master.press_start_and_go_to_selected ==
                     game_master.press_start_and_go_to.straight_to_the_next_game_stage)
            {
                Mark_current_screen(home_screen);
            }
            else if (my_game_master.press_start_and_go_to_selected == game_master.press_start_and_go_to.level_select_screen)
            {
                if (my_game_master.show_debug_messages)
                {
                    Debug.Log("return to home stage from a game stage");
                }

                Mark_current_screen(level_sclect_screen);
            }

            Update_profile_name(true);

            my_game_master.my_ads_master.Call_ad(
                my_game_master.my_ads_master.ads_when_return_to_home_scene_from_a_stage);

            //start music when retur to home from a game stage
            my_game_master.Start_music(my_game_master.music_menu, true);
        }
    }
Esempio n. 58
0
	// Use this for initialization
	void Start () {

		isfinish=false;

		GooglePlayConnection.ActionPlayerConnected +=  OnPlayerConnected;
		GooglePlayConnection.ActionPlayerDisconnected += OnPlayerDisconnected;		
		GooglePlayConnection.ActionConnectionResultReceived += OnConnectionResult;
		GooglePlayManager.ActionScoreSubmited += OnScoreSbumitted;

		if(GooglePlayConnection.State == GPConnectionState.STATE_CONNECTED) {
			//GooglePlayConnection.Instance.Disconnect ();
		} else {
			GooglePlayConnection.Instance.Connect ();
		}

		my_options = options_screen.GetComponent<options_menu>();
		//normal_emoticon = perfect_target.sprite;

		if (game_master.game_master_obj)
		{
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
			my_game_master.my_ads_master.my_game_uGUI = this;
		}
		
		if (my_game_master)
		{
			//set ads gui
			my_game_master.my_ads_master.Initiate_ads();
			my_game_master.my_ads_master.my_feedback_window = my_feedback_window;
			my_game_master.my_ads_master.my_gift_manager = my_gift_manager;
			my_gift_manager.my_game_master = my_game_master;
			my_game_master.Start_music(stage_music,true);
			//star score
			if (!ignore_game_master_preferences)
			{
				show_star_score = my_game_master.show_star_score;
				show_progress_bar = my_game_master.show_progres_bar;
				//int score
				show_int_score = my_game_master.show_int_score;
			}
			show_stage_record = my_game_master.show_int_score_stage_record_in_game_stage;
			
			
			if (my_game_master.score_name != "")
				int_score_ico.GetComponent<Text>().text = my_game_master.score_name;
			
			if (!ignore_game_master_preferences)
			{
				show_debug_messages = my_game_master.show_debug_messages;
				show_debug_warnings = my_game_master.show_debug_warnings;
			}
			
			my_game_master.latest_stage_played_world[my_game_master.current_profile_selected] = n_world;
			my_game_master.latest_stage_played_stage[my_game_master.current_profile_selected] = n_stage;
			
			
			my_game_master.current_world[my_game_master.current_profile_selected] = n_world-1;
		}
		else
		{
			temp_score_name = win_screen_int_score_title.text;
			if (show_debug_warnings)
				Debug.LogWarning("In order to allow saves and play music and menu sfx, you must star from Home scene and open this stage using the in game menu");
		}
		
		//star score
		if (show_star_score)
			star_container.SetActive(true);
		else
		{
			show_star_count = false;
			star_container.SetActive(false);
		}
		if (show_progress_bar)
		{
			my_progress_bar.Start_me(this);
			my_progress_bar.gameObject.SetActive (true);
		}
		else
			my_progress_bar.gameObject.SetActive (false);
		
		//int score
		if (show_int_score)
		{
			int_score_ico.SetActive(true);
		}
		else
			int_score_ico.SetActive(false);
		
		Reset_me();
	}
Esempio n. 59
0
	public void Start_me_with_ad(ads_master.ad_options target_ad)
	{
		if (game_master.game_master_obj)
			my_game_master = (game_master)game_master.game_master_obj.GetComponent("game_master");
		else
			{
			if (my_game_uGUI.show_debug_warnings)
				Debug.LogWarning("You need to open this stage from Home scene in order to see continue with ads");
			return;
			}

		if (target_ad.ignore_minimum_time_interval_between_ads 
		    || (my_game_master.my_ads_master.minimum_time_interval_between_ads+my_game_master.my_ads_master.time_of_latest_ad_showed) < Time.realtimeSinceStartup)
			{
			if (my_game_uGUI.show_debug_messages)
				Debug.Log("ad pass time check");
			
			if (UnityEngine.Random.Range(1,100) <= target_ad.chance_to_open_an_ad_here)
				{
				my_game_master.my_ads_master.current_ad = target_ad;

				yes_button.SetActive(false);
				watch_button.SetActive(true);

				initial_time_scale = Time.timeScale;
				Time.timeScale = 1 * time_scale_multiplier;

				Update_heading();
				game_uGUI.in_pause = true;
				game_uGUI.allow_game_input = false;
				can_take_input = true;
				
				this.gameObject.SetActive(true);

				if (my_game_master.continue_menu_have_countdown)
				{
					my_timer.text = my_game_master.continue_menu_countdown_seconds.ToString();

					stop_timer = false;
					StartCoroutine(Countdown(my_game_master.continue_menu_countdown_seconds));
					my_timer.gameObject.SetActive(true);
				}
				else
					my_timer.gameObject.SetActive(false);
				}
			else
			{
				if (my_game_uGUI.show_debug_messages)
					Debug.Log("ad - random fail");

				Continue_no(true);
				}
			}
		else
			{
			if (my_game_uGUI.show_debug_messages)
				Debug.Log("ad don't pass time check");

			Continue_no(true);
			}
	}