public void OnDrop(PointerEventData eventData) { if (!item) { Debug.Log ("Ingresa a item diferente de NULL"); DragBehaviourMenuOfSteps.itemBeingDragged.transform.SetParent (transform); drag_controller = item.GetComponent<DragBehaviourMenuOfSteps> (); if (drag_controller != null) { phase_from_button_being_dragged = drag_controller.phase_number; id_of_step_in_slot = drag_controller.phase_number; Debug.Log ("Fase del boton seleccionado: " + phase_from_button_being_dragged + " en slot: " + phase_for_slot); if (phase_from_button_being_dragged == phase_for_slot) { slot_con_objeto_correcto = true; Debug.Log ("El item se ha colocado en el lugar correcto !!"); } else { slot_con_objeto_correcto = false; Debug.Log ("El item NO se ha colocado correctamente"); } //invocando al metodo HasChanged del script MenuOfStepsPhaseTwoManagerEval para notificar que un objeto se ha ubicado en el slot: ExecuteEvents.ExecuteHierarchy<IHasChangedInMenuStepsPhase2> (gameObject, null, (x,y) => x.HasChanged ()); } else Debug.Log ("SlotsBehaviourMenuOfSteps: NO se ha podido obtener el componente DragBehaviour"); } else { slot_con_objeto_correcto = false; Debug.Log ("En slot: " + this.gameObject.name + " tiene slot_con_objeto_correcto= " + slot_con_objeto_correcto); } }
// Use this for initialization void Start() { Debug.Log ("Llamado al metodo START de MenuOfStepsPhase2 - Instancia:" + this.gameObject.GetInstanceID() + " name:" + this.gameObject.name); //inicializando variable que controla si todos los items estan en los slots: items_ubicados_correctamente = false; //inicializando la variable que indica si se ha pedido organizar automaticamente los pasos //por el appmanager: //steps_organized_from_manager = false; //desactivando el tick de orden correcto hasta que se obtenga el orden correcto: if (tickCorrectOrder != null) tickCorrectOrder.enabled = false; //cargando la imagen del tick y del boton warning: img_tick = Resources.Load<Sprite> ("Sprites/buttons/tick"); img_warning = Resources.Load<Sprite> ("Sprites/buttons/warning_order"); //obteniendo el componente del encabezado de la imagen: imagen_header = GameObject.Find ("header_image_menuphase2_eval"); if (imagen_header != null) { Debug.Log ("La imagen del HEADER es: " + image_header_phase1); sprite_image_header_phase1 = Resources.Load<Sprite> (image_header_phase1); imagen_header.GetComponent<Image>().sprite = sprite_image_header_phase1; } //obteniendo el componente text que se llama titulo en el prefab: //titulo_object = GameObject.Find ("title_menu_steps_phase2_text_eval"); if (titulo_object != null) { Debug.LogError ("Se va a cambiar el TITULO de la interfaz es: " + titulo); titulo_object.GetComponent<Text> ().text = titulo; } else { Debug.LogError("Error: No se encuentra el objeto TITULO para la interfaz en MenuOfStepsPhaseTwoManagerEval"); } //colocando el texto de la introduccion: //introduction_object = GameObject.Find ("introduction_steps_of_phase1_interface"); if (introduction_object != null) { Debug.LogError ("Se va a cambiar el texto de la INTRODUCCION"); introduction_asset = Resources.Load (introduction_text_path) as TextAsset; introduction_object.GetComponent<Text> ().text = introduction_asset.text; } else { Debug.LogError("Error: No se encuentra el objeto INTRODUCCION para la interfaz en MenuOfStepsPhaseTwoManagerEval"); } //accion regresar en el boton if(regresar != null){ Debug.LogError("Se agrega la accion al boton REGRESAR"); regresar.onClick.AddListener(()=>{ActionButton_goBackToMenuPhases();}); } //accion ir al Step1 del Phase //colocando las imagenes de las fases despues del encabezado (guia del proceso completo para los estudiantes) //image_phase1_object = GameObject.Find ("image_phase1"); if (image_phase1_object != null) { image_phase1_sprite = Resources.Load<Sprite> (image_phase1_path); image_phase1_object.GetComponent<Image> ().sprite = image_phase1_sprite; } else { Debug.LogError("No se ha podido obtener el OBJETO IMAGEN DE FASE EN ENCABEZADO en MenuOfStepsPhaseTwoManagerEval"); } //image_phase2_object = GameObject.Find ("image_phase2"); if (image_phase2_object != null) { image_phase2_sprite = Resources.Load<Sprite>(image_phase2_path); image_phase2_object.GetComponent<Image>().sprite = image_phase2_sprite; }else { Debug.LogError("No se ha podido obtener el OBJETO IMAGEN DE FASE EN ENCABEZADO en MenuOfStepsPhaseTwoManagerEval"); } //image_phase3_object = GameObject.Find ("image_phase3"); if (image_phase3_object != null) { image_phase3_sprite = Resources.Load<Sprite>(image_phase3_path); image_phase3_object.GetComponent<Image>().sprite = image_phase3_sprite; }else { Debug.LogError("No se ha podido obtener el OBJETO IMAGEN DE FASE EN ENCABEZADO en MenuOfStepsPhaseTwoManagerEval"); } //image_phase4_object = GameObject.Find ("image_phase4"); if (image_phase4_object != null) { image_phase4_sprite = Resources.Load<Sprite>(image_phase4_path); image_phase4_object.GetComponent<Image>().sprite = image_phase4_sprite; }else { Debug.LogError("No se ha podido obtener el OBJETO IMAGEN DE FASE EN ENCABEZADO en MenuOfStepsPhaseTwoManagerEval"); } //image_phase5_object = GameObject.Find ("image_phase5"); if (image_phase5_object != null) { image_phase5_sprite = Resources.Load<Sprite>(image_phase5_path); image_phase5_object.GetComponent<Image>().sprite = image_phase5_sprite; }else { Debug.LogError("No se ha podido obtener el OBJETO IMAGEN DE FASE EN ENCABEZADO en MenuOfStepsPhaseTwoManagerEval"); } //image_phase6_object = GameObject.Find ("image_phase6"); if (image_phase6_object != null) { image_phase6_sprite = Resources.Load<Sprite>(image_phase6_path); image_phase6_object.GetComponent<Image>().sprite = image_phase6_sprite; }else { Debug.LogError("No se ha podido obtener el OBJETO IMAGEN DE FASE EN ENCABEZADO en MenuOfStepsPhaseTwoManagerEval"); } if (btn_one_to_order != null) { image_button_sprite_uno = Resources.Load<Sprite> (img_one_to_order); btn_one_to_order.GetComponent<Image>().sprite = image_button_sprite_uno; ////Agregando la accion para ir al step1 - phase 1 (buscar capo del carro): btn_one_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnOne();}); drag_controller = btn_one_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_one; } if (btn_two_to_order != null) { image_button_sprite_dos = Resources.Load<Sprite> (img_two_to_order); btn_two_to_order.GetComponent<Image>().sprite = image_button_sprite_dos; //Agregando la accion para ir al conjunto de actividades (2. limpieza): btn_two_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnTwo();}); drag_controller = btn_two_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_two; } if (btn_three_to_order != null) { image_button_sprite_tres = Resources.Load<Sprite> (img_three_to_order); btn_three_to_order.GetComponent<Image>().sprite = image_button_sprite_tres; //Agregando la accion para ir al conjunto de actividades (3. secado): btn_three_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnThree();}); drag_controller = btn_three_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_three; } if (btn_four_to_order != null) { image_button_sprite_cuatro = Resources.Load<Sprite> (img_four_to_order); btn_four_to_order.GetComponent<Image>().sprite = image_button_sprite_cuatro; //Agregando la accion para ir al conjunto de actividades (4. localizar irregularidades): btn_four_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnFour();}); drag_controller = btn_four_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_four; } if (btn_five_to_order != null) { image_button_sprite_cinco = Resources.Load<Sprite> (img_five_to_order); btn_five_to_order.GetComponent<Image>().sprite = image_button_sprite_cinco; //Agregando la accion para ir al conjunto de actividades (5. corregir irregularidades): btn_five_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnFive();}); drag_controller = btn_five_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_five; } if (btn_six_to_order != null) { image_button_sprite_seis = Resources.Load<Sprite> (img_six_to_order); btn_six_to_order.GetComponent<Image>().sprite = image_button_sprite_seis; //Agregando la accion para ir al conjunto de actividades (5. corregir irregularidades): btn_six_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnSix();}); drag_controller = btn_six_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_six; } if (btn_seven_to_order != null) { image_button_sprite_siete = Resources.Load<Sprite> (img_seven_to_order); btn_seven_to_order.GetComponent<Image>().sprite = image_button_sprite_siete; //Agregando la accion para ir al conjunto de actividades (5. corregir irregularidades): btn_seven_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnSeven();}); drag_controller = btn_seven_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_seven; } if (btn_eight_to_order != null) { image_button_sprite_ocho = Resources.Load<Sprite> (img_eight_to_order); btn_eight_to_order.GetComponent<Image>().sprite = image_button_sprite_ocho; //Agregando la accion para ir al conjunto de actividades (5. corregir irregularidades): btn_eight_to_order.onClick.AddListener(()=>{ActionButton_goToActionBtnEight();}); drag_controller = btn_eight_to_order.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = step_number_btn_eight; } //colocando los textos en los botones: if(text_btn_one_to_order != null){ text_btn_one_to_order.text = this.string_btn_one_text; } if(text_btn_two_to_order != null){ text_btn_two_to_order.text = this.string_btn_two_text; } if(text_btn_three_to_order != null){ text_btn_three_to_order.text = this.string_btn_three_text; } if(text_btn_four_to_order != null){ text_btn_four_to_order.text = this.string_btn_four_text; } if(text_btn_five_to_order != null){ text_btn_five_to_order.text = this.string_btn_five_text; } if(text_btn_six_to_order != null){ text_btn_six_to_order.text = this.string_btn_six_text; } if(text_btn_seven_to_order != null){ text_btn_seven_to_order.text = this.string_btn_seven_text; } if(text_btn_eight_to_order != null){ text_btn_eight_to_order.text = this.string_btn_eight_text; } //llamado al metodo hasChanged para verificar si hay algun cambio los slots de pasos: HasChanged (); }
// Use this for initialization void Start() { Debug.Log ("Llamado al metodo START de MenuOfStepsPhase1 - Instancia:" + this.gameObject.GetInstanceID() + " name:" + this.gameObject.name); //inicializando variable que controla si todos los items estan en los slots: items_ubicados_correctamente = false; //inicializando la variable que indica si se ha pedido organizar automaticamente los pasos //por el appmanager: //steps_organized_from_manager = false; //desactivando el tick de orden correcto hasta que se obtenga el orden correcto: if (tickCorrectOrder != null) tickCorrectOrder.enabled = false; //cargando la imagen del tick y del boton warning: img_tick = Resources.Load<Sprite> ("Sprites/buttons/tick"); img_warning = Resources.Load<Sprite> ("Sprites/buttons/warning_order"); //obteniendo el componente del encabezado de la imagen: imagen_header = GameObject.Find ("header_image_menuphase1"); if (imagen_header != null) { Debug.Log ("La imagen del HEADER es: " + image_header_phase1); sprite_image_header_phase1 = Resources.Load<Sprite> (image_header_phase1); imagen_header.GetComponent<Image>().sprite = sprite_image_header_phase1; } //obteniendo el componente text que se llama titulo en el prefab: //titulo_object = GameObject.Find ("title_menu_steps_phase1_text"); if (titulo_object != null) { Debug.LogError ("Se va a cambiar el TITULO de la interfaz es: " + titulo); titulo_object.GetComponent<Text> ().text = titulo; } else { Debug.LogError("ERROR: El objeto que debe mostrar el titulo de la interfaz es NULL"); } //colocando el texto de la introduccion: introduction_object = GameObject.Find ("introduction_steps_of_phase1_interface"); if (introduction_object != null) { Debug.LogError("Se va a cambiar el texto de la INTRODUCCION con path=" + introduction_text_path); introduction_asset = Resources.Load(introduction_text_path) as TextAsset; introduction_object.GetComponent<Text>().text = introduction_asset.text; Debug.LogError("Despues de cambiar el texto de la intro: " + introduction_asset.text); } //accion regresar en el boton if(regresar != null){ Debug.LogError("Se agrega la accion al boton REGRESAR"); regresar.onClick.AddListener(()=>{ActionButton_goBackToMenuPhases();}); } //accion ir al Step1 del Phase //colocando las imagenes de las fases despues del encabezado (guia del proceso completo para los estudiantes) //image_phase1_object = GameObject.Find ("image_phase1"); if (image_phase1_object != null) { image_phase1_sprite = Resources.Load<Sprite> (image_phase1_path); image_phase1_object.GetComponent<Image> ().sprite = image_phase1_sprite; } else { Debug.LogError ("---> Error: El objeto que debe mostrar la imagen de FASE en el encabezado es NULL"); } //image_phase2_object = GameObject.Find ("image_phase2"); if (image_phase2_object != null) { image_phase2_sprite = Resources.Load<Sprite>(image_phase2_path); image_phase2_object.GetComponent<Image>().sprite = image_phase2_sprite; }else { Debug.LogError ("---> Error: El objeto que debe mostrar la imagen de FASE en el encabezado es NULL"); } //image_phase3_object = GameObject.Find ("image_phase3"); if (image_phase3_object != null) { image_phase3_sprite = Resources.Load<Sprite>(image_phase3_path); image_phase3_object.GetComponent<Image>().sprite = image_phase3_sprite; }else { Debug.LogError ("---> Error: El objeto que debe mostrar la imagen de FASE en el encabezado es NULL"); } //image_phase4_object = GameObject.Find ("image_phase4"); if (image_phase4_object != null) { image_phase4_sprite = Resources.Load<Sprite>(image_phase4_path); image_phase4_object.GetComponent<Image>().sprite = image_phase4_sprite; }else { Debug.LogError ("---> Error: El objeto que debe mostrar la imagen de FASE en el encabezado es NULL"); } //image_phase5_object = GameObject.Find ("image_phase5"); if (image_phase5_object != null) { image_phase5_sprite = Resources.Load<Sprite>(image_phase5_path); image_phase5_object.GetComponent<Image>().sprite = image_phase5_sprite; }else { Debug.LogError ("---> Error: El objeto que debe mostrar la imagen de FASE en el encabezado es NULL"); } //image_phase6_object = GameObject.Find ("image_phase6"); if (image_phase6_object != null) { image_phase6_sprite = Resources.Load<Sprite>(image_phase6_path); image_phase6_object.GetComponent<Image>().sprite = image_phase6_sprite; } if (capoCarroButton != null) { image_button_sprite_uno = Resources.Load<Sprite> (image_uno_capo_carro); capoCarroButton.GetComponent<Image>().sprite = image_button_sprite_uno; ////Agregando la accion para ir al step1 - phase 1 (buscar capo del carro): capoCarroButton.onClick.AddListener(()=>{ActionButton_goToActivitiesPhase1Step1();}); drag_controller = capoCarroButton.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_one; } if (limpiezaButton != null) { image_button_sprite_dos = Resources.Load<Sprite> (image_dos_limpieza); limpiezaButton.GetComponent<Image>().sprite = image_button_sprite_dos; //Agregando la accion para ir al conjunto de actividades (2. limpieza): limpiezaButton.onClick.AddListener(()=>{ActionButton_goToActivitiesPhase1Step2();}); drag_controller = limpiezaButton.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_two; } if (secadoButton != null) { image_button_sprite_tres = Resources.Load<Sprite> (image_tres_secado); secadoButton.GetComponent<Image>().sprite = image_button_sprite_tres; //Agregando la accion para ir al conjunto de actividades (3. secado): secadoButton.onClick.AddListener(()=>{ActionButton_goToActivitiesPhase1Step3();}); drag_controller = secadoButton.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_three; } if (irregularidadesButton != null) { image_button_sprite_cuatro = Resources.Load<Sprite> (image_cuatro_irregularidades); irregularidadesButton.GetComponent<Image>().sprite = image_button_sprite_cuatro; //Agregando la accion para ir al conjunto de actividades (4. localizar irregularidades): irregularidadesButton.onClick.AddListener(()=>{ActionButton_goToActivitiesPhase1Step4();}); drag_controller = irregularidadesButton.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_four; } if (corregirButton != null) { image_button_sprite_cinco = Resources.Load<Sprite> (image_cinco_corregir); corregirButton.GetComponent<Image>().sprite = image_button_sprite_cinco; //Agregando la accion para ir al conjunto de actividades (5. corregir irregularidades): corregirButton.onClick.AddListener(()=>{ActionButton_goToActivitiesPhase1Step5();}); drag_controller = corregirButton.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_five; } if (desengrasadoButton != null) { image_button_sprite_seis = Resources.Load<Sprite> (image_seis_desengrasar); desengrasadoButton.GetComponent<Image>().sprite = image_button_sprite_seis; //Agregando la accion para ir al conjunto de actividades (5. corregir irregularidades): desengrasadoButton.onClick.AddListener(()=>{ActionButton_goToActivitiesPhase1Step6();}); drag_controller = desengrasadoButton.GetComponent<DragBehaviourMenuOfSteps>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_six; } //colocando los textos en los botones: if(textUnocapoCarro != null){ textUnocapoCarro.text = this.button_uno_text_capo_carro; } if(textDosLimpieza != null){ textDosLimpieza.text = this.button_dos_text_limpieza; } if(textTresSecado != null){ textTresSecado.text = this.button_tres_text_secado; } if(textCuatroIrregularidades != null){ textCuatroIrregularidades.text = this.button_cuatro_text_irregularidades; } if(textCincoCorregir != null){ textCincoCorregir.text = this.button_cinco_text_corregir; } if(textSeisDesengrasar != null){ textSeisDesengrasar.text = this.button_seis_text_desengrasar; } //llamado al metodo hasChanged para verificar si hay algun cambio los slots de pasos: HasChanged (); }