inicio do dia 06-04-26

This commit is contained in:
Ronaldo
2026-04-06 10:05:22 +00:00
parent 0687e194ad
commit 7b9fb34462
6 changed files with 211 additions and 163 deletions

View File

@@ -42,6 +42,9 @@ angular.module('app.controllers', [])
// Carregar os dados de parametrização global e aplicar ao tema
$http.get('dados/config.json').then(function (response) {
S.themeConfig = response.data;
S.transitionDuration = S.themeConfig.tema.transitionDuration || 3500;
S.feedbackDelay = S.themeConfig.tema.feedbackDelay || 3000;
S.initDelay = S.themeConfig.tema.initDelay || 500;
console.log(S.themeConfig)
if (S.themeConfig.debug) {
@@ -95,6 +98,7 @@ angular.module('app.controllers', [])
rootNode.style.setProperty('--cor-acerto', S.themeConfig.cores.corAcerto);
rootNode.style.setProperty('--cor-erro', S.themeConfig.cores.corErro);
rootNode.style.setProperty('--cor-fundo-resultado', S.themeConfig.cores.corFundoResultado);
rootNode.style.setProperty('--cor-transition-bg', S.themeConfig.tema.transitionBackgroundColor || '#000000');
Object.keys(S.themeConfig.cores.alternativas).forEach(key => {
rootNode.style.setProperty(`--cor-alt-${key.toLowerCase()}`, S.themeConfig.cores.alternativas[key]);
@@ -139,7 +143,11 @@ S.derrotas = 0;
$http.get('dados/perguntas.json').then(function (response) {
// Atribuir os dados ao escopo
$scope.quizDataOriginal = response.data;
// Revelar a tela inicial após o carregamento completo
$timeout(() => {
S.setupTransitionOut();
}, S.initDelay);
});
@@ -171,10 +179,14 @@ S.derrotas = 0;
});
S.correctList = S.generateNonRepeatingRandomNumbers(5, 5)
S.wrongList = S.generateNonRepeatingRandomNumbers(5, 5)
S.showGame = true
S.setupTransitionOut(S.start)
S.play('startgame', 0)
S.setupTransitionIn();
$timeout(() => {
S.showStart = false;
S.showGame = true;
S.setupTransitionOut();
}, S.transitionDuration);
}
// Função para configurar a transição de entrada
@@ -187,6 +199,7 @@ S.derrotas = 0;
];
var i = Math.floor(Math.random() * inList.length);
el.attr('transition-style', inList[i]);
el.css('--transition__duration', (S.transitionDuration / 1000) + 's');
}
// Função para configurar a transição de saída
@@ -199,6 +212,7 @@ S.derrotas = 0;
];
var i = Math.floor(Math.random() * outList.length);
el.attr('transition-style', outList[i]);
el.css('--transition__duration', (S.transitionDuration / 1000) + 's');
S.botoesAtivos = true;
}
@@ -259,30 +273,35 @@ S.derrotas = 0;
S.chamaResultado = function () {
if ($scope.quiz.pontuacao >= 3) {
$timeout(() => {
S.vitorias++
S.salvarDadosJogos();
S.victory = true
S.showGame = false
if (S.quiz.pontuacao === 5) {
S.v5by5 = true
S.play("success2", 1)
} else {
S.play("success1", 1)
S.v5by5 = false
}
S.setupTransitionIn();
$timeout(() => {
S.vitorias++
S.salvarDadosJogos();
S.victory = true
S.showGame = false
if (S.quiz.pontuacao === 5) {
S.v5by5 = true
S.play("success2", 1)
} else {
S.play("success1", 1)
S.v5by5 = false
}
S.setupTransitionOut();
}, S.transitionDuration);
}, 3000)
} else {
$timeout(_ => {
S.derrotas++
S.salvarDadosJogos();
S.criarListaDinamica(10, '.circles2')
S.victory = false
S.showGame = false
S.lose = true
S.play('wawawa', 0.5)
S.setupTransitionIn();
$timeout(() => {
S.derrotas++
S.salvarDadosJogos();
S.victory = false
S.showGame = false
S.lose = true
S.play('wawawa', 0.5)
S.setupTransitionOut();
}, S.transitionDuration);
}, 3000)
// Adicione aqui qualquer outra lógica que você queira executar quando o jogador perder.
}
};
@@ -327,8 +346,6 @@ S.derrotas = 0;
S.botoesAtivos = false
S.respostaAtual = $scope.quiz.perguntas[$scope.quiz.perguntaAtual].respostas[indiceResposta];
S.botaoClicado = angular.element($evento.currentTarget);
S.transition.removeClass('resposta-correta').removeClass('resposta-incorreta')
// Verifica se a resposta está correta
if (S.respostaAtual.correta) {
// Se a resposta estiver correta, altera a classe para verde
@@ -336,7 +353,6 @@ S.derrotas = 0;
var pontuacaoDaResposta = 1
S.play('correct')
S.botaoClicado.addClass('resposta-correta');
S.transition.addClass('resposta-correta')
} else {
@@ -345,7 +361,6 @@ S.derrotas = 0;
S.botaoClicado.addClass('resposta-incorreta');
S.destacarRespostaCorreta()
S.erros++
S.transition.addClass('resposta-incorreta')
var pontuacaoDaResposta = 0
}
@@ -354,26 +369,28 @@ S.derrotas = 0;
S.chamaResultado()
}
// Aguarda 4 segundos antes de passar para a próxima pergunta
// Aguarda o tempo de feedback antes de passar para a próxima pergunta
$timeout(function () {
// Remove a classe para garantir que ela seja aplicada corretamente na próxima vez
S.botaoClicado.removeClass('resposta-correta').removeClass('resposta-incorreta');
// Iniciar transição entre perguntas
S.setupTransitionIn();
// Atualizar pontuação
$timeout(function () {
// No meio da transição (quando a tela estiver coberta), trocamos a pergunta
// Remove a classe para garantir que ela seja aplicada corretamente na próxima vez
S.botaoClicado.removeClass('resposta-correta').removeClass('resposta-incorreta');
// Passa para a próxima pergunta
$scope.quiz.perguntaAtual++;
$scope.quiz.perguntasRespondidas++;
// Passa para a próxima pergunta
$scope.quiz.perguntaAtual++;
$scope.quiz.perguntasRespondidas++;
}, 3000);
$timeout(()=>{
S.checarAlturaResposta()
},3100)
$timeout(() => S.setupTransitionIn(), 2000);
// Reseta posições e alturas se necessário
S.checarAlturaResposta();
$timeout(() => S.setupTransitionOut(), 3250);
// Retira a transição
S.setupTransitionOut();
}, S.transitionDuration); // Tempo dinâmico baseado no config.json
}, S.feedbackDelay);
};
@@ -477,5 +494,5 @@ S.derrotas = 0;
}
])