Esempio n. 1
0
    public void mostraQuadroAtual()
    {
        texto.text = atual.obterTexto();
        //obter os links possíveis
        List <Quadro> links = proximos();

        foreach (var botao in botoesContainer.GetComponentsInChildren <Button>())
        {
            DestroyImmediate(botao.gameObject);
        }
        if (atual.obterImagem() != "")
        {
            mostrarImagem();
        }


        if (atual.obterAudio() != "")
        {
            tocaSom();
        }

        if (atual.obterBgm() != "")
        {
            tocaBgm(atual.obterBgm());
        }

        if (atual.obterTexto() == "")
        {
            objTexto.SetActive(false);
        }
        else
        {
            objTexto.SetActive(true);
        }

        if (atual.obterLinks().Count == 1)
        {
            btnProximo.SetActive(true);
            grupoBotoes.SetActive(false);
        }
        else if (atual.obterLinks().Count == 0)
        {
            SceneManager.LoadScene("telaInicial");
        }
        else
        {
            btnProximo.SetActive(false);
            grupoBotoes.SetActive(true);
            foreach (var link in atual.obterLinks())
            {
                GameObject botao = Instantiate(botaoLinkPrefab);
                botao.GetComponentInChildren <Text>().text = link.Value;
                if (botao.GetComponentInChildren <Text>().text == "")
                {
                    botao.GetComponentInChildren <Text>().text = "Continuar";
                }
                botao.GetComponent <LinkQuadro>().textoLink = link.Value;
                botao.GetComponent <LinkQuadro>().chaveLink = link.Key;
                botao.transform.SetParent(botoesContainer);
                botao.transform.localScale = Vector3.one;
                botao.transform.position   = Vector3.zero;
            }
        }
    }