Exemplo n.º 1
0
 /// <summary>
 /// This function will parse the device parameters from a device descriptor json file.
 ///
 /// Returns a DeviceDescriptor object containing stored json values.
 /// </summary>
 public DeviceDescriptor GetDisplayParameters(TextAsset jsonDescriptor)
 {
     _deviceDescriptorJson = jsonDescriptor.text;
     return GetDeviceDescription();
 }
    // 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 ();
    }
Exemplo n.º 3
0
 public SpriteFont(Platform platform, Engine engine, TextAsset fntUvAsset, TextureAsset fntTexAsset)
 {
     fntUvData = fntUvAsset.Text;
     fntTex = platform.Graphics.CreateTexture (fntTexAsset);
     Init (platform, engine);
 }
    // Use this for initialization
    void Start()
    {
        //inicializando variable que controla si todos los items estan en los slots:
        items_ubicados_correctamente = false;

        //desactivando el tick de orden correcto hasta que se obtenga el orden correcto:
        if (tickCorrectOrder != null)
            tickCorrectOrder.enabled = false;

        //cargando la imagen del warning que se muestra en cambio del tick cuando el orden no es correcto:
        img_warning = Resources.Load<Sprite> ("Sprites/buttons/warning_order");

        //cargando la imagen del tick:
        img_tick = Resources.Load<Sprite> ("Sprites/buttons/tick");

        //lamado al metodo que verifica si los items estan ubicados correctamente o no:

        //obteniendo el componente text que se llama titulo en el prefab:
        titulo_object = GameObject.Find ("title_process_phases_interface");
        if (titulo_object != null) {
            Debug.LogError("Se va a cambiar el titulo de la interfaz!!");
            titulo_object.GetComponent<Text>().text = titulo;
        }

        introduction_object = GameObject.Find ("introduction_process_phases_interface");
        if (introduction_object != null) {
            Debug.LogError("Se va a cambiar el texto central!!");
            introduction_asset = Resources.Load(introduction_text_path) as TextAsset;
            introduction_object.GetComponent<Text>().text = introduction_asset.text;

        }

        if (limpiezaButton != null) {
            image_button_sprite_uno = Resources.Load<Sprite> (image_uno_limpieza);
            limpiezaButton.GetComponent<Image>().sprite = image_button_sprite_uno;
            //Agregando la accion del boton: esta accion apunta al Action definido desde AppManager
            limpiezaButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase1();});
            drag_controller = limpiezaButton.GetComponent<DragBehaviour>();
            if(drag_controller != null)
                drag_controller.phase_number = phase_number_button_one;
            Debug.Log("CanvasProcessManagerEval: Se asigna el numero de fase: " + phase_number_button_one + " al btn LIMPIEZA");
        }

        if (matizadoButton != null) {
            image_button_sprite_dos = Resources.Load<Sprite> (image_dos_matizado);
            matizadoButton.GetComponent<Image>().sprite = image_button_sprite_dos;
            matizadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase2();});
            drag_controller = matizadoButton.GetComponent<DragBehaviour>();
            if(drag_controller != null)
                drag_controller.phase_number = phase_number_button_two;
        }

        if (masilladoButton != null) {
            image_button_sprite_tres = Resources.Load<Sprite> (image_tres_masillado);
            masilladoButton.GetComponent<Image>().sprite = image_button_sprite_tres;
            masilladoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase3();});
            drag_controller = masilladoButton.GetComponent<DragBehaviour>();
            if(drag_controller != null)
                drag_controller.phase_number = phase_number_button_three;
        }

        if (aparejadoButton != null) {
            image_button_sprite_cuatro = Resources.Load<Sprite> (image_cuatro_aparejado);
            aparejadoButton.GetComponent<Image>().sprite = image_button_sprite_cuatro;
            aparejadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase4();});
            drag_controller = aparejadoButton.GetComponent<DragBehaviour>();
            if(drag_controller != null)
                drag_controller.phase_number = phase_number_button_four;
        }

        if (pintadoButton != null) {
            image_button_sprite_cinco = Resources.Load<Sprite> (image_cinco_pintado);
            pintadoButton.GetComponent<Image>().sprite = image_button_sprite_cinco;
            pintadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase5();});
            drag_controller = pintadoButton.GetComponent<DragBehaviour>();
            if(drag_controller != null)
                drag_controller.phase_number = phase_number_button_five;
        }

        if (barnizadoButton != null) {
            image_button_sprite_seis = Resources.Load<Sprite> (image_seis_barnizado);
            barnizadoButton.GetComponent<Image>().sprite = image_button_sprite_seis;
            barnizadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase6();});
            drag_controller = barnizadoButton.GetComponent<DragBehaviour>();
            if(drag_controller != null)
                drag_controller.phase_number = phase_number_button_six;
        }

        if (regresar != null) {
            regresar.onClick.AddListener(()=>{ActionButton_goToSelectionMode();});
        }

        //colocando los textos en los botones:
        if(textUnoLimpieza != null){
            textUnoLimpieza.text = this.button_uno_text_limpieza;
        }

        if(textDosMatizado != null){
            textDosMatizado.text = this.button_dos_text_matizado;
        }

        if(textTresMasillado != null){
            textTresMasillado.text = this.button_tres_text_masillado;
        }

        if(textCuatroAparejado != null){
            textCuatroAparejado.text = this.button_cuatro_text_aparejado;
        }

        if(textCincoPintado != null){
            textCincoPintado.text = this.button_cinco_text_pintado;
        }

        if(textSeisBarnizado != null){
            textSeisBarnizado.text = this.button_seis_text_barnizado;
        }
        /*
        //Agrrgando los textos que van dentro de los slots donde se organizan:
        if (slot1_Ordenado != null)
            this.slot1_Ordenado.text = texto_slot1_ordenar;

        if (slot2_Ordenado != null)
            this.slot2_Ordenado.text = texto_slot2_ordenar;

        if (slot3_Ordenado != null)
            this.slot3_Ordenado.text = texto_slot3_ordenar;

        if (slot4_Ordenado != null)
            this.slot4_Ordenado.text = texto_slot4_ordenar;

        if (slot5_Ordenado != null)
            this.slot5_Ordenado.text = texto_slot5_ordenar;

        if (slot6_Ordenado != null)
            this.slot6_Ordenado.text = texto_slot6_ordenar;
        */

        HasChanged ();
    }
Exemplo n.º 5
0
            public void AddAssets()
            {
                if (cla == null)
                {
                    CreateNewCLA();
                }

                OpenFileDialog dlg_open_asset = new OpenFileDialog();
                dlg_open_asset.Filter = "Asset Files|*.png;*.jpg;*.txt|Any Files|*.*";
                dlg_open_asset.Multiselect = true;
                DialogResult result = dlg_open_asset.ShowDialog();
                if (result == DialogResult.Cancel)
                {
                    return;
                }

                foreach (var fileName in dlg_open_asset.FileNames)
                {
                    FileStream stream = File.OpenRead(fileName);
                    if(stream != null)
                    {
                        StreamReader reader = new StreamReader(stream);
                        if(reader != null)
                        {
                            string ext = Path.GetExtension(fileName);

                            if (ext == ".txt")
                            {
                                TextAsset textAsset = new TextAsset();
                                textAsset.SourceFile = fileName;
                                textAsset.Text = reader.ReadToEnd().Replace("\r\n", "\n"); ;

                                AddAsset(textAsset);
                            }
                            else if (ext == ".png" || ext == ".jpg")
                            {
                                Bitmap bitmap = new Bitmap(stream);
                                byte[] textureData = new byte[bitmap.Width * bitmap.Height * 4];
                                BitmapData bitmapData = bitmap.LockBits(Rectangle.FromLTRB(0, 0, bitmap.Width, bitmap.Height),
                                        ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
                                Marshal.Copy(bitmapData.Scan0, textureData, 0, bitmap.Width * bitmap.Height * 4);
                                bitmap.UnlockBits(bitmapData);

                                TextureAsset textureAsset = new TextureAsset();
                                textureAsset.SourceFile = fileName;
                                textureAsset.Width = bitmap.Width;
                                textureAsset.Height = bitmap.Height;
                                textureAsset.TextureData = textureData;

                                AddAsset(textureAsset, bitmap);
                            }
                        }
                    }
                }
            }
    // 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 ();
    }
Exemplo n.º 7
0
            public void ReadFrom(BinaryReader reader)
            {
                block.ReadFrom(reader);

                List<AssetData> tempAssets = new List<AssetData>();

                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AssetClass type = (AssetClass)reader.ReadByte();
                    AssetData asset = null;
                    switch (type)
                    {
                        case AssetClass.TEXT:
                            asset = new TextAsset();
                            break;
                        case AssetClass.TEXTURE:
                            asset = new TextureAsset();
                            break;
                        case AssetClass.REFERENCE:
                            asset = new ReferenceAsset();
                            break;
                    }

                    if (asset != null)
                    {
                        asset.headerBlock.ReadFrom(reader);
                        tempAssets.Add(asset);
                    }
                }
                foreach (var asset in tempAssets)
                {
                    asset.dataBlock.ReadFrom(reader);
                }
                foreach (var asset in tempAssets)
                {
                    if (asset.Type() == AssetClass.TEXT)
                    {
                        program.AddAsset(asset);
                    }
                    else
                    {
                        TextureAsset texture = (TextureAsset)asset;
                        Bitmap bitmap = null;
                        using (var ms = new MemoryStream(texture.TextureData))
                        {
                            bitmap = new Bitmap(texture.Width, texture.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                            var bitmapData = bitmap.LockBits(Rectangle.FromLTRB(0, 0, texture.Width, texture.Height),
                                ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                            Marshal.Copy(texture.TextureData, 0, bitmapData.Scan0, texture.Length());
                            bitmap.UnlockBits(bitmapData);

                            program.AddAsset(asset, bitmap);
                        }
                    }
                }
            }