Esempio n. 1
0
    public void Reset_me()
    {
        if (show_debug_messages)
        {
            Debug.Log("reset stage game gui");
        }

        Time.timeScale = 1;

        if (my_game_master)
        {
            //music
            my_game_master.Start_music(stage_music, true);

            //lives
            if (my_game_master.infinite_lives)
            {
                lives_ico.SetActive(false);
            }
            else
            {
                Update_lives(0);
            }

            my_game_master.star_score_difference = 0;

            if (!keep_money_taken_in_this_stage_only_if_you_win)
            {
                virtual_money_count.text = my_game_master.current_virtual_money[my_game_master.current_profile_selected].ToString();
            }
        }


        //reset int score
        double_score.SetActive(false);
        score_doubled        = false;
        int_score            = 0;
        int_score_count.text = (0).ToString("N0");
        win_screen_int_score_title.gameObject.SetActive(false);
        int_score_record_anim.SetActive(false);
        if (my_game_master)
        {
            win_screen_int_score_title.text = my_game_master.score_name;
        }
        else
        {
            win_screen_int_score_title.text = temp_score_name;
        }
        win_screen_int_score_count.text = (0).ToString("N0");
        new_record = false;
        win_screen_int_score_record.gameObject.SetActive(new_record);
        win_screen_int_score_record.text = "";
        if (show_stage_record && my_game_master && !ignore_game_master_preferences)
        {
            int_score_record.text = (my_game_master.best_int_score_in_this_stage [my_game_master.current_profile_selected] [n_world - 1, n_stage - 1]).ToString("N0");
            int_score_record_ico.SetActive(true);
        }
        else
        {
            int_score_record_ico.SetActive(false);
        }

        //virtual money
        temp_money_count = 0;
        if (keep_money_taken_in_this_stage_only_if_you_win || !my_game_master)
        {
            virtual_money_count.text = temp_money_count.ToString();
        }

        //reset star score
        star_number = 0;
        if (show_star_count)
        {
            stars_count.text = (0).ToString();
            stars_ico.gameObject.SetActive(true);
        }
        else
        {
            stars_ico.gameObject.SetActive(false);
        }

        //reset win screen
        win_screen.gameObject.SetActive(false);
        perfect_target.sprite = normal_emoticon;
        for (int i = 0; i < 3; i++)
        {
            stars_on[i].transform.localScale = Vector3.zero;
            stars_on[i].SetActive(false);
        }

        //reset lose screen
        lose_screen.gameObject.SetActive(false);


        loading_screen.gameObject.SetActive(false);
        pause_screen.gameObject.SetActive(false);

        //start
        allow_game_input = true;
        in_pause         = false;
        stage_end        = false;
        play_screen.gameObject.SetActive(true);

        if (my_game_master)
        {
            my_game_master.my_ads_master.Call_ad(my_game_master.my_ads_master.ads_when_stage_start);
        }
    }
Esempio n. 2
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. 3
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);
        }
    }