Example #1
0
        // GET: Mascota
        public ActionResult Index()
        {
            List <TipoMascota>       tipos = new List <TipoMascota>();
            TipoMascotaBusinessLayer tbl   = new TipoMascotaBusinessLayer();

            tipos = tbl.getTipoMascotas();

            List <TiposVista> ltv = new List <TiposVista>();

            foreach (TipoMascota t in tipos)
            {
                /*creo el objeto tipo vista*/
                TiposVista tv = new TiposVista();

                tv.codigo       = t.codigo_tipo_mascota;
                tv.tipo_mascota = t.nombre_tipo_mascota;

                ltv.Add(tv); //agrego tv a lista TiposVista

                Debug.Write("\n" + t.codigo_tipo_mascota + " " + t.nombre_tipo_mascota);
            }

            ListaTipos datosVista = new ListaTipos();

            datosVista.tipos = ltv;

            return(View("Index", datosVista));
        }
        public FiltrosMelhoresProdutosModel()
        {
            ListaCampoOrdem = Utilidades.RetornarListaOpcaoOrdenacaoMelhoresProdutos();
            ListaTipos      = Utilidades.RetornarListaTiposProduto();

            ListaTipos.Insert(0, new SelectListItem()
            {
                Text     = "Todos",
                Value    = "0",
                Selected = true
            });
        }
        public FiltrosListagemPedidoModel()
        {
            ListaTipos = Utilidades.RetornarListaTiposPedido();
            ListaTipos.Insert(0, new SelectListItem()
            {
                Selected = true,
                Text     = "Todos",
                Value    = "0"
            });

            ListaInativo[1].Text = "Apenas não cancelados";
            ListaInativo[2].Text = "Apenas cancelados";

            ListaOpcoesIFood = Utilidades.RetornarListaOpcaoIFood();
            ListaCampoOrdem  = Utilidades.RetornarListaOpcaoOrdenacaoPedido();
        }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.LabelField("Insira o prefab das Opções :");
        EditorGUILayout.PropertyField(Prefabricavel, true);

        EditorGUILayout.LabelField("Insira a quantidade de Opções abaixo.");
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(Tamanho, true);
        if (Tamanho.intValue < 1)
        {
            Tamanho.intValue = 1;
        }

        if (Tamanho.intValue > 0)
        {
            mostrarTipos = true;
        }
        else
        {
            mostrarTipos = false;
        }
        EditorGUILayout.Space();
        #region Resize
        if (Tamanho.intValue != ListaNomes.arraySize)
        {
            while (Tamanho.intValue > ListaNomes.arraySize)
            {
                ListaNomes.InsertArrayElementAtIndex(ListaNomes.arraySize);
            }
            while (Tamanho.intValue < ListaNomes.arraySize)
            {
                ListaNomes.DeleteArrayElementAtIndex(ListaNomes.arraySize - 1);
            }
        }
        if (Tamanho.intValue != ListaDestinos.arraySize)
        {
            while (Tamanho.intValue > ListaDestinos.arraySize)
            {
                ListaDestinos.InsertArrayElementAtIndex(ListaDestinos.arraySize);
            }
            while (Tamanho.intValue < ListaDestinos.arraySize)
            {
                ListaDestinos.DeleteArrayElementAtIndex(ListaDestinos.arraySize - 1);
            }
        }
        if (Tamanho.intValue != ListaTipos.arraySize)
        {
            while (Tamanho.intValue > ListaTipos.arraySize)
            {
                ListaTipos.InsertArrayElementAtIndex(ListaTipos.arraySize);
            }
            while (Tamanho.intValue < ListaTipos.arraySize)
            {
                ListaTipos.DeleteArrayElementAtIndex(ListaTipos.arraySize - 1);
            }
        }
        if (Tamanho.intValue != Objetos.arraySize)
        {
            while (Tamanho.intValue > Objetos.arraySize)
            {
                Objetos.InsertArrayElementAtIndex(Objetos.arraySize);
            }
            while (Tamanho.intValue < Objetos.arraySize)
            {
                Objetos.DeleteArrayElementAtIndex(Objetos.arraySize - 1);
            }
        }
        if (Tamanho.intValue != IndexSize.arraySize)
        {
            while (Tamanho.intValue > IndexSize.arraySize)
            {
                IndexSize.InsertArrayElementAtIndex(IndexSize.arraySize);
            }
            while (Tamanho.intValue < IndexSize.arraySize)
            {
                IndexSize.DeleteArrayElementAtIndex(IndexSize.arraySize - 1);
            }
        }
        #endregion


        #region Arrumar
        EditorGUILayout.Space();
        #region Elementos
        EditorGUILayout.LabelField("----Começo----");
        try
        {
            for (int i = 0; i < Tamanho.intValue; i++)
            {
                EditorGUILayout.LabelField("Escreva o nome: ");
                EditorGUILayout.PropertyField(ListaNomes.GetArrayElementAtIndex(i), mostrarTipos);
                EditorGUILayout.LabelField("Seleciona o tipo: ");
                EditorGUILayout.PropertyField(ListaTipos.GetArrayElementAtIndex(i), mostrarTipos);
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.AtivarGameObject)
                {
                    EditorGUILayout.LabelField("Coloque o GameObject à ser ativado: ");
                    if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                    {
                        menu.Destino.RemoveAt(i);
                    }
                    EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                }
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.AtivarScript)
                {
                    EditorGUILayout.LabelField("Coloque o GameObject aonde está o script: ");

                    EditorGUILayout.PropertyField(Objetos.GetArrayElementAtIndex(i));
                    if (menu.obj[i] != null)
                    {
                        string[] opcoes = new string[menu.obj[i].GetComponents <MonoBehaviour>().Length];
                        for (int j = 0; j < opcoes.Length; j++)
                        {
                            opcoes[j] = menu.obj[i].GetComponents <MonoBehaviour>()[j].ToString();
                        }

                        IndexSize.GetArrayElementAtIndex(i).intValue = EditorGUILayout.Popup(IndexSize.GetArrayElementAtIndex(i).intValue, opcoes);
                        menu.Destino[i] = menu.obj[i].GetComponents <MonoBehaviour>()[IndexSize.GetArrayElementAtIndex(i).intValue];
                        EditorGUILayout.LabelField("Script selecionado : " + menu.Destino[i]);
                    }
                }
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.Back)
                {
                    if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                    {
                        menu.Destino.RemoveAt(i);
                    }
                    EditorGUILayout.LabelField("Coloque o destino para voltar: ");
                    EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                }
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.Confirm)
                {
                    EditorGUILayout.LabelField("Coloque o GameObject aonde está o script: ");

                    EditorGUILayout.PropertyField(Objetos.GetArrayElementAtIndex(i));
                    if (menu.obj[i] != null)
                    {
                        string[] opcoes = new string[menu.obj[i].GetComponents <MonoBehaviour>().Length];
                        for (int j = 0; j < opcoes.Length; j++)
                        {
                            opcoes[j] = menu.obj[i].GetComponents <MonoBehaviour>()[j].ToString();
                        }

                        IndexSize.GetArrayElementAtIndex(i).intValue = EditorGUILayout.Popup(IndexSize.GetArrayElementAtIndex(i).intValue, opcoes);
                        menu.Destino[i] = menu.obj[i].GetComponents <MonoBehaviour>()[IndexSize.GetArrayElementAtIndex(i).intValue];
                        EditorGUILayout.LabelField("Script selecionado : " + menu.Destino[i]);
                    }
                    if (menu.TipoDeOpcoes[i] == TipoOpcoes.Sair)
                    {
                        if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                        {
                            menu.Destino.RemoveAt(i);
                        }
                        EditorGUILayout.LabelField("Coloque o destino para sair: ");
                        EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                    }
                    if (menu.TipoDeOpcoes[i] == TipoOpcoes.SairTotalmente)
                    {
                        if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                        {
                            menu.Destino.RemoveAt(i);
                        }
                        EditorGUILayout.LabelField("Coloque o destino para ser desativado: ");
                        EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                    }
                    EditorGUILayout.Space();
                    if (i + 1 == Tamanho.intValue)
                    {
                        EditorGUILayout.LabelField("----Fim----");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("----Outro----");
                    }
                }
            }
        }
        catch
        {
        }
        #endregion
        #endregion
        serializedObject.ApplyModifiedProperties();
    }