${i}.
+${agent.name} :
+${agent.credits}
+${agent.hq}
+${agent.faction}
+${agent.ships_cpt}
+diff --git a/css/contracts.css b/css/contracts.css index 2663cc2..c6575df 100644 --- a/css/contracts.css +++ b/css/contracts.css @@ -39,28 +39,7 @@ .card-button{ margin-top: 10px; } -/* .btn-infos{ - background-color: transparent; - border-color: rgb(0,255,0); - font-size: 15pt; - color:rgb(0,255,0); -} -.btn-accept{ - background-color: transparent; - border-color: rgb(0,255,0); - font-size: 15pt; - color: rgb(0,255,0); -} -.btn-accept:hover{ - transition: 0.2s; - color: rgb(208, 255, 0); - border-color: rgb(208, 255, 0); -} -.btn-infos:hover{ - transition: 0.2s; - color: rgb(208, 255, 0); - border-color: rgb(208, 255, 0); -} */ + .img { position: absolute; diff --git a/css/global.css b/css/global.css index 0ceeaa4..e8a86d5 100644 --- a/css/global.css +++ b/css/global.css @@ -89,6 +89,18 @@ select { position: absolute; font-size: 50px; margin-left: 50px; + background-color: rgba(0, 0, 0, 0.363); + border-radius: 5px; + width: fit-content; + padding: 10px; +} + +.cont-center { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; } .title{ diff --git a/css/leaderboard.css b/css/leaderboard.css new file mode 100644 index 0000000..cc5dcc1 --- /dev/null +++ b/css/leaderboard.css @@ -0,0 +1,53 @@ +.container-ldb { + width: 100%; +} + +.head-board { + display: grid; + grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; + margin: auto; + width: 60%; + padding: 20px; + font-size:x-large; + border: 0px solid black; + border-top-color: white; + border-bottom-color: white; + border-bottom-width: 1px; + border-top-right-radius: 5px; + border-top-left-radius: 5px; + background-color: rgba(0, 0, 0, 0.5); +} + +.leaderboard { + display: flex; + margin: auto; + align-items: center; + flex-direction: column; + width: 60%; + height: 50vh; + overflow-y: scroll; + overflow-x: visible; + background-color: rgba(0, 0, 0, 0.5); + padding: 20px; + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; + scrollbar-width: none; +} + +.leaderboard::-webkit-scrollbar { + width: 0 !important +} + +.player { + width: 100%; + display: grid; + grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; + border-bottom: 1px solid rgb(255, 255, 255); +} + +.player p { + padding: 5px; + color: white; + font-size: large; + text-align: start; +} diff --git a/css/modal-ships.css b/css/modal-ships.css index 65381d3..18b5985 100644 --- a/css/modal-ships.css +++ b/css/modal-ships.css @@ -7,7 +7,7 @@ position: relative; margin: auto; padding: 40px; - color: yellow; + color: rgb(255, 255, 255); } .infos-ships { @@ -15,6 +15,13 @@ margin-bottom: 20px; /* Space below the info box */ } +.ship-info { + background-color: rgba(0, 0, 0, 0.363); + border-radius: 5px; + width: fit-content; + padding: 5px; +} + .btn-close-ships { position: absolute; font-size:x-large; @@ -22,7 +29,7 @@ left: 20px; background-color: rgba(255, 255, 255, 0.8); border: none; - color: yellow; + color: rgb(252, 252, 252); padding: 10px 20px; cursor: pointer; border-radius: 5px; diff --git a/css/ships.css b/css/ships.css index d6e7f40..548882a 100644 --- a/css/ships.css +++ b/css/ships.css @@ -7,7 +7,6 @@ font-size:large; text-align: center; margin: auto; - margin-top: 100px; } .ships-modal{ @@ -43,6 +42,11 @@ } .ships-list h5 { font-size:xx-large; + background-color: rgba(0, 0, 0, 0.363); + border-radius: 5px; + width: fit-content; + padding: 10px; + margin:auto; } /* Position the "next button" to the right */ .next { diff --git a/html/templates/home.html b/html/templates/home.html index f48a8fd..0383252 100644 --- a/html/templates/home.html +++ b/html/templates/home.html @@ -1,3 +1,3 @@
Home
+HOME
LEADERBOARD
+Rank
+Name
+Credits
+Headquarters
+Faction
+Ships
+SHIPS
+ \ No newline at end of file diff --git a/index.html b/index.html index 1fcae98..2662bd4 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,8 @@ + + diff --git a/js/controllers/leaderboard.js b/js/controllers/leaderboard.js new file mode 100644 index 0000000..690dfd1 --- /dev/null +++ b/js/controllers/leaderboard.js @@ -0,0 +1,51 @@ +import menu_mod from "./menu_mod.js"; +import { AgentBuilder } from "../skama_code/api/agent.js"; + +export default function ldb(temp_engine) { + temp_engine.after_render((temp_engine) => { + $("body").css("background-image", "url('/assets/img/background.png')") + menu_mod(temp_engine); + let bagents = new AgentBuilder(); + bagents.list_all((agents) => { + drawAgents(agents, sortAgentByCredits); + }); + }); + + temp_engine.render("templates/leaderboard/leaderboard.html"); +} + +function drawAgents(agents, funcSort) { + $(".leaderboard").html(""); + agents.sort(funcSort); + agents.reverse(); + let i = 1; + agents.forEach((agent) => { + $(".leaderboard").append(` +${i}.
+${agent.name} :
+${agent.credits}
+${agent.hq}
+${agent.faction}
+${agent.ships_cpt}
+Name : ${ship.registration.name}
`); - $(".infos-ships").append(`Faction : ${ship.registration.factionSymbol}
`); - $(".infos-ships").append(`Role : ${ship.registration.role}
`); + $(".infos-ships").append(`Name : ${ship.registration.name}
`); + $(".infos-ships").append(`Faction : ${ship.registration.factionSymbol}
`); + $(".infos-ships").append(`Role : ${ship.registration.role}
`); } }) modal.show(); @@ -56,10 +56,10 @@ export default (temp_engine) => { if(ship.symbol==id_ship) { $(".infos-ships").html(""); - $(".infos-ships").append(`Current system : ${ship.nav.systemSymbol}
`); - $(".infos-ships").append(`Current waypoint : ${ship.nav.waypointSymbol}
`); - $(".infos-ships").append(`Current status : ${ship.nav.status}
`); - $(".infos-ships").append(`Flight mode : ${ship.nav.flightMode}
`); + $(".infos-ships").append(`Current system : ${ship.nav.systemSymbol}
`); + $(".infos-ships").append(`Current waypoint : ${ship.nav.waypointSymbol}
`); + $(".infos-ships").append(`Current status : ${ship.nav.status}
`); + $(".infos-ships").append(`Flight mode : ${ship.nav.flightMode}
`); } }) modal.show(); @@ -70,10 +70,10 @@ export default (temp_engine) => { if(ship.symbol==id_ship) { $(".infos-ships").html(""); - $(".infos-ships").append(`Current member : ${ship.crew.current}
`); - $(".infos-ships").append(`Capacity : ${ship.crew.capacity}
`); - $(".infos-ships").append(`required member : ${ship.crew.required}
`); - $(".infos-ships").append(`Moral : ${ship.crew.morale}
`); + $(".infos-ships").append(`Current member : ${ship.crew.current}
`); + $(".infos-ships").append(`Capacity : ${ship.crew.capacity}
`); + $(".infos-ships").append(`required member : ${ship.crew.required}
`); + $(".infos-ships").append(`Moral : ${ship.crew.morale}
`); } }) modal.show(); @@ -84,12 +84,12 @@ export default (temp_engine) => { if(ship.symbol==id_ship) { $(".infos-ships").html(""); - $(".infos-ships").append(`Name : ${ship.frame.name}
`); - $(".infos-ships").append(`Description : ${ship.frame.description}
`); - $(".infos-ships").append(`Fuel capacity : ${ship.frame.fuelCapacity}
`); - $(".infos-ships").append(`Condition : ${ship.frame.condition}
`); - $(".infos-ships").append(`Power : ${ship.frame.requirements.power}
`); - $(".infos-ships").append(`Crew : ${ship.frame.requirements.crew}
`); + $(".infos-ships").append(`Name : ${ship.frame.name}
`); + $(".infos-ships").append(`Description : ${ship.frame.description}
`); + $(".infos-ships").append(`Fuel capacity : ${ship.frame.fuelCapacity}
`); + $(".infos-ships").append(`Condition : ${ship.frame.condition}
`); + $(".infos-ships").append(`Power : ${ship.frame.requirements.power}
`); + $(".infos-ships").append(`Crew : ${ship.frame.requirements.crew}
`); } }) @@ -101,27 +101,11 @@ export default (temp_engine) => { if(ship.symbol==id_ship) { $(".infos-ships").html(""); - $(".infos-ships").append(`Name : ${ship.reactor.name}
`); - $(".infos-ships").append(`Description : ${ship.reactor.description}
`); - $(".infos-ships").append(`Condition : ${ship.reactor.condition}
`); - $(".infos-ships").append(`Power : ${ship.reactor.powerOutput}
`); - $(".infos-ships").append(`Crew : ${ship.reactor.requirements.crew}
`); - } - }) - modal.show(); - }); - temp_engine.add_event(".engine", "click", (e) => { - const id_ship = $(e.target).attr("data-symbol"); - ships.forEach(ship =>{ - if(ship.symbol==id_ship) - { - $(".infos-ships").html(""); - $(".infos-ships").append(`Name : ${ship.engine.name}
`); - $(".infos-ships").append(`Description : ${ship.engine.description}
`); - $(".infos-ships").append(`Condition : ${ship.engine.condition}
`); - $(".infos-ships").append(`Speed : ${ship.engine.speed}
`); - $(".infos-ships").append(`Crew : ${ship.engine.requirements.crew}
`); - $(".infos-ships").append(`Power : ${ship.engine.requirements.power}
`); + $(".infos-ships").append(`Name : ${ship.reactor.name}
`); + $(".infos-ships").append(`Description : ${ship.reactor.description}
`); + $(".infos-ships").append(`Condition : ${ship.reactor.condition}
`); + $(".infos-ships").append(`Power : ${ship.reactor.powerOutput}
`); + $(".infos-ships").append(`Crew : ${ship.reactor.requirements.crew}
`); } }) modal.show(); @@ -132,10 +116,10 @@ export default (temp_engine) => { if(ship.symbol==id_ship) { $(".infos-ships").html(""); - $(".infos-ships").append(`current fuel : ${ship.fuel.current}
`); - $(".infos-ships").append(`Description : ${ship.fuel.capacity}
`); - $(".infos-ships").append(`Condition : ${ship.fuel.consumed.amount}
`); - $(".infos-ships").append(`Speed : ${ship.fuel.consumed.timestamp}
`); + $(".infos-ships").append(`current fuel : ${ship.fuel.current}
`); + $(".infos-ships").append(`Description : ${ship.fuel.capacity}
`); + $(".infos-ships").append(`Condition : ${ship.fuel.consumed.amount}
`); + $(".infos-ships").append(`Speed : ${ship.fuel.consumed.timestamp}
`); } }) modal.show(); diff --git a/js/skama_code b/js/skama_code index 69a0cb7..ba1e1d8 160000 --- a/js/skama_code +++ b/js/skama_code @@ -1 +1 @@ -Subproject commit 69a0cb7793bc81dbe53fdaf1a078d7a8d696bb7e +Subproject commit ba1e1d88709df819706bd463de60a58105ac3830