public void TrocaTela()
    {
        ObjectPool.Clear();
        ObjectPool.CreatePool<Flecha>(flechaPrefab);
        ObjectPool.CreatePool<Maca>(macaPrefab);
        switch (telaAtual) {
        case Tela.TITULO :
            Application.LoadLevel("Ingame");
            telaAtual = Tela.INGAME;
            score = 0;

            break;
        case Tela.INGAME :
            if(gameOver){
                Application.LoadLevel("GameOver");
                ObjectPool.Clear();
                telaAtual = Tela.GAMEOVER;
                gameOver = false;
            }
            else {
                Application.LoadLevel("Titulo");
                telaAtual = Tela.TITULO;
                gameOver = false;
            }
            break;
        case Tela.GAMEOVER :
            Application.LoadLevel("Titulo");
            telaAtual = Tela.TITULO;
            gameOver = false;
            break;
        default:
            break;
        }
    }
Beispiel #2
0
 public void Remove(Tela obj)
 {
     throw new System.NotImplementedException();
 }
Beispiel #3
0
 public Tela GetTela(Tela tela)
 {
     return(bd.Get(tela));
 }
Beispiel #4
0
 public void Add(Tela obj)
 {
     _telaRepository.Add(obj);
 }
Beispiel #5
0
 public void Modificar(Tela tela)
 {
     bd.Modificar(tela);
 }
Beispiel #6
0
 public void Baja(Tela tela)
 {
     bd.Baja(tela);
 }
Beispiel #7
0
 public TelaGeraDados(string Nome, Tela anterior)
 {
     this.Nome     = "Gera Dados";
     this.anterior = anterior;
 }
Beispiel #8
0
 public void Alta(Tela tela)
 {
     bd.Alta(tela);
 }
Beispiel #9
0
        static void Main(string[] args)
        {
            string inputPasta = @"C:\Users\alvar\OneDrive\Workspaces\ws-vs2019\cs-vs2019-secao-15-exercicio-sets\io\";

            FileStream        fsAlunos    = null;
            StreamReader      srAlunos    = null;
            StreamWriter      swAlunos    = null;
            SortedSet <Aluno> alunos      = new SortedSet <Aluno>();
            string            inputAlunos = @"inputAlunos.txt";

            FileStream        fsCursos    = null;
            StreamReader      srCursos    = null;
            StreamWriter      swCursos    = null;
            SortedSet <Curso> cursos      = new SortedSet <Curso>();
            string            inputCursos = @"inputCursos.txt";

            FileStream            fsInstrutores = null;
            StreamReader          srInstrutores = null;
            StreamWriter          swInstrutores = null;
            SortedSet <Instrutor> instrutores   = new SortedSet <Instrutor>();
            string inputInstrutores             = @"inputInstutores.txt";

            try
            {
                // Leitura dos alunos
                fsAlunos = new FileStream(inputPasta + inputAlunos, FileMode.OpenOrCreate);
                srAlunos = new StreamReader(fsAlunos);
                while (!srAlunos.EndOfStream)
                {
                    string[] linha = srAlunos.ReadLine().Split(',');
                    int      id    = int.Parse(linha[0]);
                    string   nome  = linha[1];
                    Aluno    aluno = new Aluno(id, nome);

                    for (int i = 2; i < linha.Length; i++)
                    {
                        int cursoId = int.Parse(linha[i]);
                        aluno.AddCurso(new Curso(cursoId, "Temp"));
                    }
                    alunos.Add(aluno);
                }
                // Fim da leitura dos alunos

                // Leitura dos cursos
                fsCursos = new FileStream(inputPasta + inputCursos, FileMode.OpenOrCreate);
                srCursos = new StreamReader(fsCursos);
                while (!srCursos.EndOfStream)
                {
                    string[] linha       = srCursos.ReadLine().Split(',');
                    int      id          = int.Parse(linha[0]);
                    string   nome        = linha[1];
                    int      idInstrutor = int.Parse(linha[2]);
                    Curso    curso       = new Curso(id, nome);
                    for (int i = 3; i < linha.Length; i++)
                    {
                        int alunoId = int.Parse(linha[i]);
                        foreach (Aluno aluno in alunos)
                        {
                            if (alunoId == aluno.Id)
                            {
                                curso.AddAluno(new Aluno(aluno.Id, aluno.Nome));
                                foreach (Curso cursoX in aluno.Cursos)
                                {
                                    if (id == cursoX.Id)
                                    {
                                        cursoX.SetNome(nome);
                                    }
                                }
                            }
                        }
                    }
                    cursos.Add(curso);
                }
                // Fim da leitura dos cursos

                // Leitura dos instrutores
                fsInstrutores = new FileStream(inputPasta + inputInstrutores, FileMode.OpenOrCreate);
                srInstrutores = new StreamReader(fsInstrutores);
                while (!srInstrutores.EndOfStream)
                {
                    string[]  linha     = srInstrutores.ReadLine().Split(',');
                    int       id        = int.Parse(linha[0]);
                    string    nome      = linha[1];
                    Instrutor instrutor = new Instrutor(id, nome);

                    for (int i = 2; i < linha.Length; i++)
                    {
                        int cursoId = int.Parse(linha[i]);
                        foreach (Curso curso in cursos)
                        {
                            if (cursoId == curso.Id)
                            {
                                curso.SetInstrutor(instrutor);
                                instrutor.AddCursoMinistrado(curso);
                            }
                        }
                    }
                    instrutores.Add(instrutor);
                }
                // Fim da leitura dos instrutores
            }
            catch (IOException e)
            {
                Console.WriteLine("Erro: " + e.Message);
            }
            finally
            {
                if (srAlunos != null)
                {
                    srAlunos.Close();
                }

                if (srCursos != null)
                {
                    srCursos.Close();
                }

                if (srInstrutores != null)
                {
                    srInstrutores.Close();
                }
            }

            bool loop = true;

            while (loop)
            {
                //Console.Clear();
                Console.WriteLine("====  Seção 15: Exercícios sets  ====");
                Console.WriteLine();
                loop = Tela.MenuPrincipal(alunos, instrutores, cursos);
            }

            try
            {
                fsAlunos = new FileStream(inputPasta + inputAlunos, FileMode.Create);
                using (swAlunos = new StreamWriter(fsAlunos))
                {
                    foreach (Aluno aluno in alunos)
                    {
                        swAlunos.Write($"{aluno.Id},{aluno.Nome}");
                        foreach (Curso cursoAluno in aluno.Cursos)
                        {
                            swAlunos.Write($",{cursoAluno.Id}");
                        }
                        swAlunos.WriteLine();
                    }
                }

                fsInstrutores = new FileStream(inputPasta + inputInstrutores, FileMode.Create);
                using (swInstrutores = new StreamWriter(fsInstrutores))
                {
                    foreach (Instrutor instrutor in instrutores)
                    {
                        swInstrutores.Write($"{instrutor.Id},{instrutor.Nome}");
                        foreach (Curso cursoInstrutor in instrutor.CursosMinistrados)
                        {
                            swInstrutores.Write($",{cursoInstrutor.Id}");
                        }
                        swInstrutores.WriteLine();
                    }
                }

                fsCursos = new FileStream(inputPasta + inputCursos, FileMode.Create);
                using (swCursos = new StreamWriter(fsCursos))
                {
                    foreach (Curso curso in cursos)
                    {
                        swCursos.Write($"{curso.Id},{curso.Nome},{curso.Instrutor.Id}");
                        foreach (Aluno cursoAluno in curso.Alunos)
                        {
                            swCursos.Write($",{cursoAluno.Id}");
                        }
                        swCursos.WriteLine();
                    }
                }
            }
            catch (IOException e)
            {
                Console.WriteLine("Erro: " + e.Message);
            }
            finally
            {
                if (fsAlunos != null)
                {
                    fsAlunos.Close();
                }
                if (swAlunos != null)
                {
                    swAlunos.Close();
                }

                if (fsCursos != null)
                {
                    fsCursos.Close();
                }
                if (swCursos != null)
                {
                    swCursos.Close();
                }

                if (fsInstrutores != null)
                {
                    fsInstrutores.Close();
                }
                if (swInstrutores != null)
                {
                    swInstrutores.Close();
                }
            }
        }
Beispiel #10
0
 private void LimparTela()
 {
     Tela.LimparTela(tbPrincipal);
 }
Beispiel #11
0
        public override void Editar()
        {
            try
            {
                Tela.LimparTela(tbPrincipal);
                LimparTela();

                _recadoApp = new RecadoApp();
                var model = _recadoApp.Editar(Funcoes.IdUsuario, Grade.RetornarId(ref dgvDados, "Rec_Id"));
                btnSalvar.Enabled = Funcoes.PermitirEditar(model.Mensagem);

                base.Editar();

                _Id = model.Id;
                txtCodigo.txtValor.Text = model.Id.ToString("000000");
                usrData.txtData.Text = model.Data.ToString();
                txtHora.Text = model.Hora.ToString();

                UsrUsuarioLcto.txtId.Text = model.UsuarioLctoId.ToString();
                UsrUsuarioLcto.SetCodigoMask(model.CodigoUsuarioLcto.ToString());
                UsrUsuarioLcto.txtNome.Text = model.NomeUsuarioLancamento;

                UsrUsuarioDestino.txtId.Text = model.UsuarioDestinoId.ToString();
                UsrUsuarioDestino.SetCodigoMask(model.CodigoUsuarioDest.ToString());
                UsrUsuarioDestino.txtNome.Text = model.NomeUsuarioDestino;

                UsrCliente.txtId.Text = model.ClienteId.ToString();
                UsrCliente.SetCodigoMask(model.CodigoCliente.ToString());
                UsrCliente.txtNome.Text = model.NomeCliente;

                txtRazao.Text = model.RazaoSocial;
                txtFantasia.Text = model.Fantasia;
                txtEndereco.Text = model.Endereco;
                txtTelefone.Text = model.Telefone;
                txtContato.Text = model.Contato;

                UsrTipo.txtId.Text = model.TipoId.ToString();
                UsrTipo.SetCodigoMask(model.CodigoTipo.ToString());
                UsrTipo.txtNome.Text = model.NomeTipo;

                UsrStatus.txtId.Text = model.StatusId.ToString();
                UsrStatus.SetCodigoMask(model.CodigoStatus.ToString());
                UsrStatus.txtNome.Text = model.NomeStatus;

                rbBaixo.Checked = (model.Nivel.Value == 1);
                rbNormal.Checked = (model.Nivel.Value == 2);
                rbAlto.Checked = (model.Nivel.Value == 3);
                rbCritico.Checked = (model.Nivel.Value == 4);

                RecadoEncerrado(model);

                txtDescricaoInicial.Text = model.DescricaoInicial;
                txtDescricaoFinal.Text = model.DescricaoFinal;

                if (model.DataFinal != null)
                    txtDataFinal.txtData.Text = model.DataFinal.Value.ToShortDateString();

                if (model.HoraFinal != null)
                    txtHoraFinal.Text = model.HoraFinal.Value.ToString();

                usrData.txtData.Focus();
                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #12
0
 public Corte(int id, string codigo, string talle, int tiempo, DateTime fecha, int cantidadTela, int dimensiones, Tela tela)
 {
     Id           = id;
     Codigo       = codigo;
     Talle        = talle;
     Tiempo       = tiempo;
     Fecha        = fecha;
     CantidadTela = cantidadTela;
     Dimensiones  = dimensiones;
     Tela         = tela;
 }
Beispiel #13
0
        public CategoriaViewModel Pesquisar(int codigo, string descricao, TipoPesquisa tipoPesquisa)
        {
            if (codigo == 0 && tipoPesquisa == TipoPesquisa.Id)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(descricao) && tipoPesquisa == TipoPesquisa.Descricao)
            {
                return(null);
            }

            if (tipoPesquisa == TipoPesquisa.Tela)
            {
                frmCategoria formulario = new frmCategoria("");
                if (Tela.AbrirFormularioModal(formulario))
                {
                    if (Funcoes.IdSelecionado == 0)
                    {
                        return(null);
                    }

                    return(_categoriaApp.ObterPorId(Funcoes.IdSelecionado));
                }
            }

            if (tipoPesquisa == TipoPesquisa.Id && codigo > 0)
            {
                var model = _categoriaApp.ObterPorCodigo(codigo);
                if (model == null || model.Codigo == 0)
                {
                    throw new Exception("Registro não encontrado!");
                }
                return(model);
            }

            if (tipoPesquisa == TipoPesquisa.Descricao && descricao.Length > 0)
            {
                var model = _categoriaApp.Filtrar("Cat_Nome", descricao);
                if (model == null)
                {
                    frmCategoria formulario = new frmCategoria();
                    if (Tela.AbrirFormularioModal(formulario))
                    {
                        return(_categoriaApp.ObterPorId(Funcoes.IdSelecionado));
                    }
                    return(null);
                }
                else
                {
                    if (model.Count() == 1)
                    {
                        return(_categoriaApp.ObterPorId(model.First().Id));
                    }
                    else
                    {
                        frmCategoria formulario = new frmCategoria(descricao);
                        if (Tela.AbrirFormularioModal(formulario))
                        {
                            return(_categoriaApp.ObterPorId(Funcoes.IdSelecionado));
                        }
                    }
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }