Select Git revision
Alexandre authored
hub.html 6.16 KiB
<html>
<head>
<meta charset="utf-8">
<title>hub</title>
<link rel="stylesheet" href="css/hub.css">
<link rel="stylesheet" href="css/window.css">
<!-- <script src="js/jquery-3.6.0.js" type="text/javascript"></script> -->
</head>
<body>
<div id="infoText" class="infoText" style="display: none;">
<span>Appuies sur</span>
<div class="icon">
<icon class="keyboard-key f dark"></icon>
</div>
<span>pour rejoindre l'épreuvre <span id="gameName"></span>.</span>
</div>
<script src="js/uiHandler.js" type="text/javascript"></script>
<script type="text/javascript">
var aWindowsHasBeenOpened = false;
function showGameTextInfo(game){
if(game == "skateboard"){
gameName = "Sakteboard";
}else{
gameName = "Jeu inconnu";
}
document.getElementById("gameName").innerHTML = gameName;
document.getElementById("infoText").style.display = "flex";
}
function hideGameTextInfo(){
document.getElementById("infoText").style.display = "none";
}
function showGameWindow(game){
if(!aWindowsHasBeenOpened){
if(game == "skateboard"){
// On créé la fenêtre pour la liste des parties
var uiWindowGameList = new UIWindow();
// On défini quelques paramètres
uiWindowGameList.showAnimation = "animate__zoomIn";
//uiWindowGameList.hideAnimation = "animate__zoomOut";
uiWindowGameList.debug = false;
uiWindowGameList.preferHide = true; // Pemet de ne pas supprimer le code html au moment de la fermeture de la fenêtre
uiWindowGameList.closeAction = "reEnableHubInput();aWindowsHasBeenOpened = false;"; // Fonction créée au runtime par UI.cs
// Puis on l'initialise (pour la créer et prendre en compte les paramètres)
uiWindowGameList.init();
// On ajoute les éléments à la fenêtre
uiWindowGameList.addElement("title", "Skateboard", null);
var uiWindowContainer = uiWindowGameList.addElement("horizontalContainer", null, null);
document.getElementById(uiWindowContainer).style.height = "100%";
uiWindowGameList.addElement("presentationImage", "images/presentations/skateboard.png", uiWindowContainer);
var textBox = uiWindowGameList.addElement("textBox", "Cette partie est un jeu de skateboard", uiWindowContainer);
document.getElementById(textBox).style.height = "100%";
document.getElementById(textBox).style.flexGrow = "1";
document.getElementById(textBox).style.marginLeft = "1%";
uiWindowGameList.show();
aWindowsHasBeenOpened = true;
}else{
console.log("Une uiWindow a déjà été ouverte!");
}
}
}
//---------AFFICHAGE DES CLASSEMENTS
function showScoreWindowTmp(str){
var scores = str.split(",");
let textAfficher = "\tJoueur \tScore";
if(scores[scores.length-1] == ("tmp")){
scores.pop();
console.log(scores);
// On créé la fenêtre pour la liste des parties
var uiWindowGameList = new UIWindow();
// On défini quelques paramètres
uiWindowGameList.showAnimation = "animate__zoomIn";
//uiWindowGameList.hideAnimation = "animate__zoomOut";
uiWindowGameList.debug = false;
uiWindowGameList.preferHide = true; // Pemet de ne pas supprimer le code html au moment de la fermeture de la fenêtre
uiWindowGameList.closeAction = "reEnableHubInput();"; // Fonction créée au runtime par UI.cs
// Puis on l'initialise (pour la créer et prendre en compte les paramètres)
uiWindowGameList.init();
// On ajoute les éléments à la fenêtre
uiWindowGameList.addElement("title", "LeaderBoard temporaire", null);
// Récupérer les données du JSON et les concaténer
scores.sort();
scores.forEach(score => {
textAfficher += "<br>\tAnonyme \t" + score;
});
//Ajouter les données à la fenetres
var scoresElem = uiWindowGameList.addElement("textBox", textAfficher, null);
document.getElementById(scoresElem).style.overflowY = "auto";
// var container = uiWindow.addHTMLElement(new HTMLUIElement("div", {
// id: "scoreContainer"
// }, ""), null);
// var containerElement = document.getElementById("scoreContainer");
// var scoresElem = uiWindowGameList.addElement("table", tableCreate, null);
// var elementTable = document.getElementById(scoresElem);
// elementTable.style.overflowY = "auto";
// elementTable.insertRow();
// elementTable.insertCell("Joueur");
// elementTable.insertCell("Score");
// scores.forEach(score => {
// elementTable.insertRow();
// elementTable.insertCell("Anonyme");
// elementTable.insertCell(score);
// });
uiWindowGameList.show();
}
}
function removeElement(str)
{
}
</script>
</body>
</html>