コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Gabinete gabinete = db.Gabinetes.Find(id);

            db.Gabinetes.Remove(gabinete);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public PcComumFacede()
 {
     this.processador = new Processador();
     this.discoRigido = new DiscoRigido();
     this.memoriaRAM  = new MemoriaRAM();
     this.fonte       = new Fonte();
     this.gabinete    = new Gabinete();
     this.placaMae    = new PlacaMae();
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Nome,Descricao,Marca,PrecoMedio,ConsumoWatts,Link")] Gabinete gabinete)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gabinete).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gabinete));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "GabineteId,Nome,Preco")] Gabinete gabinete)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gabinete).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gabinete));
 }
コード例 #5
0
        public ActionResult Create([Bind(Include = "Id,Nome,Descricao,Marca,PrecoMedio,ConsumoWatts,Link")] Gabinete gabinete)
        {
            if (ModelState.IsValid)
            {
                db.Gabinetes.Add(gabinete);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gabinete));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "GabineteId,Nome,Preco")] Gabinete gabinete)
        {
            if (ModelState.IsValid)
            {
                db.Gabinetes.Add(gabinete);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gabinete));
        }
コード例 #7
0
        // GET: Gabinete/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Gabinete gabinete = db.Gabinetes.Find(id);

            if (gabinete == null)
            {
                return(HttpNotFound());
            }
            return(View(gabinete));
        }
コード例 #8
0
    //Testa a compatibilidade entre o gabinete e a placa-mãe baseado no formato
    public static bool GabineteConectaPlacaMae(GameObject Panel)
    {
        //Verifica se os objetos estão ativos, se não estiverem não haverá como comparar
        if ((Panel.GetComponentInChildren <DisplayGabinete>() != null) && (Panel.GetComponentInChildren <DisplayPlacaMae>() != null))
        {
            Gabinete gabinete = Panel.GetComponentInChildren <DisplayGabinete>().gabinete;
            PlacaMae placamae = Panel.GetComponentInChildren <DisplayPlacaMae>().placaMae;

            //Verifica se o formato da placa-mãe está entre os fomatos suportados pelo gabinete
            if (gabinete.FormatoPlacaMae.Trim().ToLowerInvariant().Contains(placamae.Formato.Trim().ToLowerInvariant()))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            Debug.Log("Não há elementos suficientes para determinar a compatibilidade entre o gabinete e a placa-mãe");
            return(false);
        }
    }
コード例 #9
0
ファイル: Trocar.cs プロジェクト: luissimas/HardEasy
    public void TrocarCartas(string componente, GameObject Panel)
    {
        //Verifica se o jogador que jogou a carta tem HardCash suficiente para trocar
        if (Panel.gameObject.tag == "PlayerCard")
        {
            if (HardCash.HardCashJogador == 0)
            {
                Debug.Log("HardCash insuficiente!");
                return;
            }
        }
        else if (Panel.gameObject.tag == "OpponentCard")
        {
            if (HardCash.HardCashOponente == 0)
            {
                Debug.Log("HardCash insuficiente!");
                return;
            }
        }

        Manager.PodeInteragir = false;

        GameObject OutroPanel;

        //Encontra o panel do jogador adversário se baseando no panel do jogador que jogou a carta
        if (Panel.gameObject.tag == "PlayerCard")
        {
            OutroPanel = Informacoes.PanelOponente;
        }
        else
        {
            OutroPanel = Informacoes.PanelJogador;
        }

        //Armazena a rodada que o jogador jogou a carta baseado no parâmetro recebido pela função
        if (StateMachine.EstadoAtual == StateMachine.Estados.VezDoJogador)
        {
            switch (componente)
            {
            case "PlacaMae":
                RodadaPlacaMaeJogador = StateMachine.Rodada;

                PlacaMae placamaeAleatoria = Lista.ListaPlacaMae[Random.Range(0, Lista.ListaPlacaMae.Count)];                         //Gera uma placa-mãe aleatória da lista

                //Verifica se a carta é igual a carta que o jogador já tinha ou a carta do jogador adversário
                while ((placamaeAleatoria == GetComponentInChildren <DisplayPlacaMae>().placaMae) || (placamaeAleatoria == OutroPanel.GetComponentInChildren <DisplayPlacaMae>().placaMae))
                {
                    placamaeAleatoria = Lista.ListaPlacaMae[Random.Range(0, Lista.ListaPlacaMae.Count)];
                }

                GetComponentInChildren <DisplayPlacaMae>().placaMae = placamaeAleatoria;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaPlacaMaeMudou = true;
                HardCash.HardCashJogador--;

                break;

            case "Processador":
                RodadaProcessadorJogador = StateMachine.Rodada;

                Processador processadorAleatorio = Lista.ListaProcessador[Random.Range(0, Lista.ListaProcessador.Count)];                         //Gera um processador aleatório da lista

                while ((processadorAleatorio == GetComponentInChildren <DisplayProcessador>().processador) || (processadorAleatorio == OutroPanel.GetComponentInChildren <DisplayProcessador>().processador))
                {
                    processadorAleatorio = Lista.ListaProcessador[Random.Range(0, Lista.ListaProcessador.Count)];
                }

                GetComponentInChildren <DisplayProcessador>().processador = processadorAleatorio;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaProcessadorMudou = true;
                HardCash.HardCashJogador--;

                break;

            case "Memoria":
                RodadaMemoriaJogador = StateMachine.Rodada;

                Memoria memoriaAleatoria = Lista.ListaMemoria[Random.Range(0, Lista.ListaMemoria.Count)];                         //Gera uma memória aleatória da lista

                while ((memoriaAleatoria == GetComponentInChildren <DisplayMemoria>().memoria) || (memoriaAleatoria == OutroPanel.GetComponentInChildren <DisplayMemoria>().memoria))
                {
                    memoriaAleatoria = Lista.ListaMemoria[Random.Range(0, Lista.ListaMemoria.Count)];
                }

                GetComponentInChildren <DisplayMemoria>().memoria = memoriaAleatoria;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaMemoriaMudou = true;
                HardCash.HardCashJogador--;

                break;

            case "PlacaDeVideo":
                RodadaPlacaDeVideoJogador = StateMachine.Rodada;

                PlacaDeVideo placadevideoAleatoria = Lista.ListaPlacaDeVideo[Random.Range(0, Lista.ListaPlacaDeVideo.Count)];                         //Gera uma placa de vídeo aleatória da lista

                while ((placadevideoAleatoria == GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo) || (placadevideoAleatoria == OutroPanel.GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo))
                {
                    placadevideoAleatoria = Lista.ListaPlacaDeVideo[Random.Range(0, Lista.ListaPlacaDeVideo.Count)];
                }

                GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo = placadevideoAleatoria;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaPlacaDeVideoMudou = true;
                HardCash.HardCashJogador--;

                break;

            case "Disco":
                RodadaDiscoJogador = StateMachine.Rodada;

                Disco discoAleatorio = Lista.ListaDisco[Random.Range(0, Lista.ListaDisco.Count)];                         //Gera um disco aleatório da lista

                while ((discoAleatorio == GetComponentInChildren <DisplayDisco>().disco) || (discoAleatorio == OutroPanel.GetComponentInChildren <DisplayDisco>().disco))
                {
                    discoAleatorio = Lista.ListaDisco[Random.Range(0, Lista.ListaDisco.Count)];
                }

                GetComponentInChildren <DisplayDisco>().disco = discoAleatorio;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaDiscoMudou = true;
                HardCash.HardCashJogador--;

                break;

            case "Fonte":
                RodadaFonteJogador = StateMachine.Rodada;

                Fonte fonteAleatoria = Lista.ListaFonte[Random.Range(0, Lista.ListaFonte.Count)];                         //Gera uma fonte aleatória da lista

                while ((fonteAleatoria == GetComponentInChildren <DisplayFonte>().fonte) || (fonteAleatoria == OutroPanel.GetComponentInChildren <DisplayFonte>().fonte))
                {
                    fonteAleatoria = Lista.ListaFonte[Random.Range(0, Lista.ListaFonte.Count)];
                }

                GetComponentInChildren <DisplayFonte>().fonte = fonteAleatoria;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaFonteMudou = true;
                HardCash.HardCashJogador--;

                break;

            case "Gabinete":
                RodadaGabineteJogador = StateMachine.Rodada;

                Gabinete gabineteAleatorio = Lista.ListaGabinete[Random.Range(0, Lista.ListaGabinete.Count)];                         //Gera um gabinete aleatório da lista

                while ((gabineteAleatorio == GetComponentInChildren <DisplayGabinete>().gabinete) || (gabineteAleatorio == OutroPanel.GetComponentInChildren <DisplayGabinete>().gabinete))
                {
                    gabineteAleatorio = Lista.ListaGabinete[Random.Range(0, Lista.ListaGabinete.Count)];
                }

                GetComponentInChildren <DisplayGabinete>().gabinete = gabineteAleatorio;

                //Informa que houve alteração na carta
                Informacoes.JogadorCartaGabineteMudou = true;
                HardCash.HardCashJogador--;

                break;
            }
        }
        else if (StateMachine.EstadoAtual == StateMachine.Estados.VezDoOponente)
        {
            switch (componente)
            {
            case "PlacaMae":
                RodadaPlacaMaeOponente = StateMachine.Rodada;

                PlacaMae placamaeAleatoria = Lista.ListaPlacaMae[Random.Range(0, Lista.ListaPlacaMae.Count)];                         //Gera uma placa-mãe aleatória da lista

                //Verifica se a carta é igual a carta que o jogador já tinha ou a carta do jogador adversário
                while ((placamaeAleatoria == GetComponentInChildren <DisplayPlacaMae>().placaMae) || (placamaeAleatoria == OutroPanel.GetComponentInChildren <DisplayPlacaMae>().placaMae))
                {
                    placamaeAleatoria = Lista.ListaPlacaMae[Random.Range(0, Lista.ListaPlacaMae.Count)];
                }

                GetComponentInChildren <DisplayPlacaMae>().placaMae = placamaeAleatoria;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaPlacaMaeMudou = true;
                HardCash.HardCashOponente--;

                break;

            case "Processador":
                RodadaProcessadorOponente = StateMachine.Rodada;

                Processador processadorAleatorio = Lista.ListaProcessador[Random.Range(0, Lista.ListaProcessador.Count)];                         //Gera um processador aleatório da lista

                while ((processadorAleatorio == GetComponentInChildren <DisplayProcessador>().processador) || (processadorAleatorio == OutroPanel.GetComponentInChildren <DisplayProcessador>().processador))
                {
                    processadorAleatorio = Lista.ListaProcessador[Random.Range(0, Lista.ListaProcessador.Count)];
                }

                GetComponentInChildren <DisplayProcessador>().processador = processadorAleatorio;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaProcessadorMudou = true;
                HardCash.HardCashOponente--;

                break;

            case "Memoria":
                RodadaMemoriaOponente = StateMachine.Rodada;

                Memoria memoriaAleatoria = Lista.ListaMemoria[Random.Range(0, Lista.ListaMemoria.Count)];                         //Gera uma memória aleatória da lista

                while ((memoriaAleatoria == GetComponentInChildren <DisplayMemoria>().memoria) || (memoriaAleatoria == OutroPanel.GetComponentInChildren <DisplayMemoria>().memoria))
                {
                    memoriaAleatoria = Lista.ListaMemoria[Random.Range(0, Lista.ListaMemoria.Count)];
                }

                GetComponentInChildren <DisplayMemoria>().memoria = memoriaAleatoria;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaMemoriaMudou = true;
                HardCash.HardCashOponente--;

                break;

            case "PlacaDeVideo":
                RodadaPlacaDeVideoOponente = StateMachine.Rodada;

                PlacaDeVideo placadevideoAleatoria = Lista.ListaPlacaDeVideo[Random.Range(0, Lista.ListaPlacaDeVideo.Count)];                         //Gera uma placa de vídeo aleatória da lista

                while ((placadevideoAleatoria == GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo) || (placadevideoAleatoria == OutroPanel.GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo))
                {
                    placadevideoAleatoria = Lista.ListaPlacaDeVideo[Random.Range(0, Lista.ListaPlacaDeVideo.Count)];
                }

                GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo = placadevideoAleatoria;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaPlacaDeVideoMudou = true;
                HardCash.HardCashOponente--;

                break;

            case "Disco":
                RodadaDiscoOponente = StateMachine.Rodada;

                Disco discoAleatorio = Lista.ListaDisco[Random.Range(0, Lista.ListaDisco.Count)];                         //Gera um disco aleatório da lista

                while ((discoAleatorio == GetComponentInChildren <DisplayDisco>().disco) || (discoAleatorio == OutroPanel.GetComponentInChildren <DisplayDisco>().disco))
                {
                    discoAleatorio = Lista.ListaDisco[Random.Range(0, Lista.ListaDisco.Count)];
                }

                GetComponentInChildren <DisplayDisco>().disco = discoAleatorio;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaDiscoMudou = true;
                HardCash.HardCashOponente--;

                break;

            case "Fonte":
                RodadaFonteOponente = StateMachine.Rodada;

                Fonte fonteAleatoria = Lista.ListaFonte[Random.Range(0, Lista.ListaFonte.Count)];                         //Gera uma fonte aleatória da lista

                while ((fonteAleatoria == GetComponentInChildren <DisplayFonte>().fonte) || (fonteAleatoria == OutroPanel.GetComponentInChildren <DisplayFonte>().fonte))
                {
                    fonteAleatoria = Lista.ListaFonte[Random.Range(0, Lista.ListaFonte.Count)];
                }

                GetComponentInChildren <DisplayFonte>().fonte = fonteAleatoria;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaFonteMudou = true;
                HardCash.HardCashOponente--;

                break;

            case "Gabinete":
                RodadaGabineteOponente = StateMachine.Rodada;

                Gabinete gabineteAleatorio = Lista.ListaGabinete[Random.Range(0, Lista.ListaGabinete.Count)];                         //Gera um gabinete aleatório da lista

                while ((gabineteAleatorio == GetComponentInChildren <DisplayGabinete>().gabinete) || (gabineteAleatorio == OutroPanel.GetComponentInChildren <DisplayGabinete>().gabinete))
                {
                    gabineteAleatorio = Lista.ListaGabinete[Random.Range(0, Lista.ListaGabinete.Count)];
                }

                GetComponentInChildren <DisplayGabinete>().gabinete = gabineteAleatorio;

                //Informa que houve alteração na carta
                Informacoes.OponenteCartaGabineteMudou = true;
                HardCash.HardCashOponente--;

                break;
            }
        }

        Trocou = true;
    }
コード例 #10
0
    //Gerencia o sistema de rodadas
    public void GerenciadorDeRodadas()
    {
        //Identifica qual o estado atual do jogo
        switch (EstadoAtual)
        {
        case (Estados.Inicio):
            Manager.PodeInteragir = false;
            Lista.CarregarListas();                                                         //Carega as listas dos componentes
            IniciarCartas.IniciarBaralho(Informacoes.PanelJogador);                         //Embaralha e inicia as cartas do jogador
            IniciarCartas.IniciarBaralho(Informacoes.PanelOponente);                        //Embaralha e inicia as cartas do oponente
            Verificar.VerificarCartas(Informacoes.PanelJogador, Informacoes.PanelOponente); //Verifica se as cartas do jogador e do oponente são iguais e as embaralha novamente

            resetarRodadas();

            Manager.PodeInteragir = true;
            EstadoMudou           = true;
            Rodada++;                                       //Avança uma rodada
            EstadoAtual = EstadoAtual + Random.Range(1, 3); //Escolhe quem irá começar jogando de forma aleatória
            break;

        case (Estados.VezDoJogador):
            Manager.JogadorPodeInteragir  = true;
            Manager.OponentePodeInteragir = false;
            TextVez = "Vez de: " + Informacoes.NomeJogador;
            break;

        case (Estados.VezDoOponente):
            Manager.JogadorPodeInteragir  = false;
            Manager.OponentePodeInteragir = true;
            TextVez = "Vez de: " + Informacoes.NomeOponente;
            break;

        case (Estados.Fim):
            Manager.JogadorPodeInteragir  = false;
            Manager.OponentePodeInteragir = false;
            Manager.PodeInteragir         = false;

            if (EstadoVitorioso == Estados.VezDoJogador)
            {
                NomeDoVencedor = Informacoes.NomeJogador;

                ProcessadorVitorioso  = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayProcessador>().processador;
                MemoriaVitorioso      = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayMemoria>().memoria;
                PlacaMaeVitorioso     = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayPlacaMae>().placaMae;
                PlacaDeVideoVitorioso = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo;
                DiscoVitorioso        = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayDisco>().disco;
                FonteVitorioso        = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayFonte>().fonte;
                GabineteVitorioso     = Informacoes.PanelJogador.gameObject.GetComponentInChildren <DisplayGabinete>().gabinete;
            }
            else if (EstadoVitorioso == Estados.VezDoOponente)
            {
                NomeDoVencedor = Informacoes.NomeOponente;

                ProcessadorVitorioso  = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayProcessador>().processador;
                MemoriaVitorioso      = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayMemoria>().memoria;
                PlacaMaeVitorioso     = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayPlacaMae>().placaMae;
                PlacaDeVideoVitorioso = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayPlacaDeVideo>().placaDeVideo;
                DiscoVitorioso        = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayDisco>().disco;
                FonteVitorioso        = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayFonte>().fonte;
                GabineteVitorioso     = Informacoes.PanelOponente.gameObject.GetComponentInChildren <DisplayGabinete>().gabinete;
            }

            StartCoroutine(CarregarATelaFinal());

            break;
        }
    }