diff --git a/.gitignore b/.gitignore index e69de29..6cae44f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/.vs/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d85088f --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +DO NOT USE THIS CODE OR LOOK AT IT IF YOU ARE NOT ALLOWED TO +IF YOU DO YOU CAN USE OR TEACH THE KNOWLEAGE YOU ACQUEIRED. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5f624a3 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Skamcraft + +## Start +* Start with live server in VsCode to get full functionnality. +* Start with php : +``` bash + cd /.../Skamcraft + php -S 127.0.0.1:80 +``` + +## Norm +* ``` ; ``` at the end of each line. +* snack_case for functions and variables. +* UpperCamelCase for Classes. +* all in english. diff --git a/assets/contracts/procurement.png b/assets/contracts/procurement.png new file mode 100644 index 0000000..f7cac9b Binary files /dev/null and b/assets/contracts/procurement.png differ diff --git a/assets/contracts/shuttle.png b/assets/contracts/shuttle.png new file mode 100644 index 0000000..92dab5d Binary files /dev/null and b/assets/contracts/shuttle.png differ diff --git a/assets/contracts/transportation.png b/assets/contracts/transportation.png new file mode 100644 index 0000000..7c197ce Binary files /dev/null and b/assets/contracts/transportation.png differ diff --git a/fonts/m42.TTF b/assets/fonts/m42.TTF similarity index 100% rename from fonts/m42.TTF rename to assets/fonts/m42.TTF diff --git a/assets/img/background.jpg b/assets/img/background.jpg new file mode 100644 index 0000000..5d0683d Binary files /dev/null and b/assets/img/background.jpg differ diff --git a/assets/logo/Offre.png b/assets/logo/Offre.png new file mode 100644 index 0000000..70230f5 Binary files /dev/null and b/assets/logo/Offre.png differ diff --git a/img/Skamkraft.png b/assets/logo/logoblanc.png similarity index 100% rename from img/Skamkraft.png rename to assets/logo/logoblanc.png diff --git a/assets/logo/logoblancnotext.png b/assets/logo/logoblancnotext.png new file mode 100644 index 0000000..a48c638 Binary files /dev/null and b/assets/logo/logoblancnotext.png differ diff --git a/assets/logo/logonoir.png b/assets/logo/logonoir.png new file mode 100644 index 0000000..7d4783c Binary files /dev/null and b/assets/logo/logonoir.png differ diff --git a/assets/planets/planetproto.png b/assets/planets/planetproto.png new file mode 100644 index 0000000..3d500b4 Binary files /dev/null and b/assets/planets/planetproto.png differ diff --git a/assets/ressources/ANTIMATTER.png b/assets/ressources/ANTIMATTER.png new file mode 100644 index 0000000..bd8dffe Binary files /dev/null and b/assets/ressources/ANTIMATTER.png differ diff --git a/assets/ressources/medkit.png b/assets/ressources/medkit.png new file mode 100644 index 0000000..4491d9b Binary files /dev/null and b/assets/ressources/medkit.png differ diff --git a/assets/spaceships/spaceship.png b/assets/spaceships/spaceship.png new file mode 100644 index 0000000..acc67df Binary files /dev/null and b/assets/spaceships/spaceship.png differ diff --git a/assets/spaceships/spaceshiporbits.png b/assets/spaceships/spaceshiporbits.png new file mode 100644 index 0000000..344a342 Binary files /dev/null and b/assets/spaceships/spaceshiporbits.png differ diff --git a/assets/spaceships/vaisseau.avif b/assets/spaceships/vaisseau.avif new file mode 100644 index 0000000..6470527 Binary files /dev/null and b/assets/spaceships/vaisseau.avif differ diff --git a/assets/systems/galaxie1.png b/assets/systems/galaxie1.png new file mode 100644 index 0000000..e40e2b2 Binary files /dev/null and b/assets/systems/galaxie1.png differ diff --git a/css/animation.css b/css/animation.css new file mode 100644 index 0000000..3207215 --- /dev/null +++ b/css/animation.css @@ -0,0 +1,15 @@ +/* Copyright © 2023 Entreprise SkamKraft */ + + +.ext-modal[open] { + animation: myFadeIn 2.0s ease normal; +} + +@keyframes myFadeIn{ + from { + bottom: 100%; + } + to { + bottom: 0%; + } +} \ No newline at end of file diff --git a/css/auth.css b/css/auth.css deleted file mode 100644 index 5bb0acb..0000000 --- a/css/auth.css +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright © 2023 Entreprise SkamCraft */ - -/* @font-face { - font-family: M42; - src: url(/fonts/m42.TTF); -} */ - -* { - font-family: "Montserrat", sans-serif; - font-size: 16px; - color: #ffffff; - margin: 0; - padding: 0; - text-decoration: none; - list-style: none; -} - -body { - background-color: #212121; -} - -.logo { - display: flex; - justify-content: center; - align-items: center; -} - -.logo img { - width: 80px; - padding: 20px; -} - -.logo h4 { - font-size: 30px; -} - -.form { - --input-focus: #a37b03; - --font-color: #323232; - --font-color-sub: #666666; - --bg-color: beige; - --main-color: black; - padding: 20px; - background: #eab308; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - text-align: center; - gap: 20px; - border-radius: 20px; - border: 2px solid var(--main-color); - box-shadow: 4px 4px var(--main-color); - width: 20%; - margin: auto; - margin-top: 10%; -} - -.title { - color: var(--font-color); - font-weight: 900; - font-size: 20px; -} - -.title span { - color: var(--font-color-sub); - font-weight: 600; - font-size: 17px; -} - -.input { - width: 250px; - height: 40px; - border-radius: 5px; - border: 2px solid var(--main-color); - background-color: var(--bg-color); - box-shadow: 4px 4px var(--main-color); - font-size: 15px; - font-weight: 600; - color: var(--font-color); - padding: 5px 10px; - outline: none; -} - -.input::placeholder { - color: var(--font-color-sub); - opacity: 0.8; -} - -.input:focus { - border: 2px solid var(--input-focus); -} - -.select * { - color: var(--main-color); -} - -.button-confirm { - width: 120px; - height: 40px; - border-radius: 5px; - border: 2px solid var(--main-color); - background-color: var(--bg-color); - box-shadow: 4px 4px var(--main-color); - font-size: 17px; - font-weight: 600; - color: var(--font-color); - cursor: pointer; -} - -.button-confirm:active { - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -} - -.link-connection { - position: relative; - display: inline-block; -} - -.link-connection:hover { - cursor: pointer; - text-underline-offset: 2px; - text-decoration: underline; - transform: scale(1.1); - transition: 0.3s; -} - -.alert { - position: fixed; - left: 50%; - transform: translateX(-50%); - bottom: 10%; - border-radius: 0.5rem; - border-width: 0.25rem; - border-color: #ef4444; - background-color: #fee2e2; - padding: 1rem; - width: 300px; - max-width: 90%; - text-align: center; -} - -.alert-inner { - display: flex; - align-items: center; - gap: 0.5rem; - color: #ef4444; -} - -.icon { - height: 1.25rem; - width: 1.25rem; - fill: #d94848; -} - -.message { - color: #d94848; - font-weight: 500; -} - -.content { - margin-top: 0.5rem; - font-size: 0.875rem; - color: #d94848; -} diff --git a/css/global.css b/css/global.css deleted file mode 100644 index 485e9ce..0000000 --- a/css/global.css +++ /dev/null @@ -1,112 +0,0 @@ -/*Copyright © 2023 Entreprise SkamCraft */ - -* { - font-family: "Inter", sans-serif; - box-sizing: border-box; - overflow: hidden; - background-color: #272727; -} - -body, -html { - height: 100%; - display: flex; - flex-direction: column; -} - -/* Menu */ -.menu { - display: flex; - align-items: center; - justify-content: space-between; -} - -.title-section { - color: white; - display: flex; - align-items: center; - padding-left: 10px; -} - -.title-section img { - max-width: 80px; - max-height: 50px; -} - -.page-change-button { - padding-left: 10px; -} - -button { - margin: 2px; - color: black; - background-color: white; - border: 2px solid white; - border-radius: 10px; -} - -button:hover { - border-color: #eab308; - background-color: #eab308; - transition: all 1s; -} - -main { - - flex: 1; - overflow-y: scroll; - display: flex; - justify-content: left; - flex-wrap: wrap; - padding-left: 30px; -} - - -.spacer { - margin-bottom: 35px; - margin-left: 100px; - margin-right: 100px; -} - -#credits { - background-color: white; - border: 2px solid white; - border-radius: 10px; - color: black; -} - -/* Footer */ -footer { - color: white; -} - -footer p { - display: flex; - justify-content: center; - margin-bottom: 0px; -} - -/* Modal */ -.modal-content { - color: white; -} - -#exampleModal { - color: white; - background-color: rgba(255, 255, 255, 0.1) -} - -#modal-footer { - background-color: #272727; -} - -#status-onhold { - color: orange; -} - -#status-accepted{ - color: greenyellow; -} -#revenu { - color: white -} \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..1503b8f --- /dev/null +++ b/css/style.css @@ -0,0 +1,195 @@ +/* Copyright © 2023 Entreprise SkamKraft */ + +:root { + --main-back-color: rgb(143, 143, 143); + --second-back-color: black; +} + +@font-face { + font-family: M42; + src: url("/assets/fonts/m42.TTF"); +} + +* { + box-sizing: border-box; +} + +body { + background-image: url("/assets/img/background.jpg"); + font-family: 'M42'; + font-size: 7px; + margin: 0px; + padding: 0px; +} + +/* Main */ +.container { + color: white; + background-color: rgba(0, 0, 0, 0.726); + display: flex; + margin: 10px; + width: fit-content; + margin: auto; + margin-top: 10px; margin-bottom: 30px; + flex-direction: column; + align-items: center; + border: 4px solid rgba(68, 68, 68, 0.575); +} + +.max-container { + background-color: rgba(0, 0, 0, 0.726); + color: white; + display: flex; + margin: 10px; + width: 95%; + margin: auto; + margin-top: 10px; margin-bottom: 30px; + flex-direction: column; + align-items: center; + border: 4px solid rgba(68, 68, 68, 0.575); +} + +.con-title { + font-size: 15px; + border-bottom: 2px solid black; +} + +.btn { + padding: 10px; + font-size: 8px; + font-family: 'M42'; + color: white; + border: none; + border-radius: 10px; +} + +.btn-val { + background-color: rgba(0, 0, 255, 0.637); +} + +.btn-cancel { + background-color: rgba(255, 0, 0, 0.699); +} + +/*footer*/ +footer { + position: fixed; + width: 100%; + bottom: 0; + display: flex; + justify-content: center; + background-color: var(--second-back-color); + color: white; +} + +/*nav bar*/ +.nav-nav { + --nav-img-width: 100px; + background-color: var(--second-back-color); + display: flex; + justify-content: space-between; + align-items: center; +} + +.nav-nav .nav-brand { + display: flex; + justify-content: center; + align-items: center; +} + +.nav-nav .nav-brand img { + width: var(--nav-img-width); +} + +.nav-nav .nav-links { + --links-color: rgb(0,0,0); + --links-backcolor: rgb(255, 123, 71); + --links-border-color: rgb(255, 173, 118); + height: 70%; + display: flex; + justify-content: space-between; +} + +.nav-link { + margin-right: 10px; + background-color: var(--links-backcolor); + color: var(--links-color); + border: 4px solid var(--links-border-color); + list-style: none; + display: flex; + justify-content: center; + align-items: center; + box-shadow: 3px 2px white; +} + +.stats { + color: white; +} + +/* General */ +.smooth { + padding: 5px; + padding-left: 10px; + padding-right: 10px; + border-radius: 5px; +} + +.in-big { + font-family: 'M42'; + font-size: 6px; + padding: 5px; + width: 100%; + margin-bottom: 10px; + border-radius: 5px; + border: none; +} + +.errors p { + background-color: rgba(255, 56, 56, 0.733); + border: 3px solid rgb(255, 111, 111); + padding: 10px; + color: white; + border-radius: 5px; + text-align: center; +} + +/* Modal */ +.ext-modal { + background-color: rgba(255, 255, 255, 0.767); + border-radius: 10px; + padding: 50px; +} + +.my-modal { + display: flex; + flex-direction: column; + align-items: center; +} + +.modal-title { + font-size: 15px; + margin-bottom: 40px; +} + +.show-token { + width: fit-content; + border: 2px solid black; + border-radius: 10px; + padding: 30px; + font-size: 5px; + white-space:pre-wrap; + word-break:break-word; +} + +.my-modal #timer { + text-align: center; + border: 1px solid black; + border-radius: 10px; + width: 10%; + padding: 5px; + margin-bottom: 10px; +} + +#canvas { + border-radius: 10px; +} \ No newline at end of file diff --git a/css/ui.css b/css/ui.css new file mode 100644 index 0000000..085f1e5 --- /dev/null +++ b/css/ui.css @@ -0,0 +1,11 @@ +/* Copyright © 2023 Entreprise SkamKraft */ + +#block-content { + margin: 0; + padding: 0; +} + +.modal-disable::backdrop { + background-color: rgba(0, 0, 0, 0.493); +} + diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..b78bc3c Binary files /dev/null and b/favicon.ico differ diff --git a/html/template.html b/html/template.html new file mode 100644 index 0000000..9821bca --- /dev/null +++ b/html/template.html @@ -0,0 +1,16 @@ + + + + diff --git a/html/templates/auth/login.html b/html/templates/auth/login.html new file mode 100644 index 0000000..81974a4 --- /dev/null +++ b/html/templates/auth/login.html @@ -0,0 +1,11 @@ + + +
Login
+ +Login success
+New Agent
+ + +Login success
+ +Bienvenue sur SkamCraft
+Application client pour l'API Space Tarders.
+Bienvenue sur SkamCraft
+Application client pour l'API Space Tarders.
+Systems
+ +${err}
+ `); + }); + }); + + auth.relog(); +} diff --git a/js/controllers/menu_mod.js b/js/controllers/menu_mod.js new file mode 100644 index 0000000..c626a98 --- /dev/null +++ b/js/controllers/menu_mod.js @@ -0,0 +1,49 @@ +import { My } from "../skama_code/api/agent.js"; +import login from "./login.js"; +import reg from "./reg.js"; +import home from "./home.js"; +import { systems } from "./systems.js"; +import Ship from "./ships.js"; + +function init_menu(temp_engine) { + temp_engine.add_event("#reg-link", "click", () => { + reg(temp_engine); + }); + temp_engine.add_event("#login-link", "click", () => { + login(temp_engine); + }); + temp_engine.add_event("#systems-link", "click", () => { + systems(temp_engine); + }); + temp_engine.add_event(".nav-brand", "click", () => { + home(temp_engine); + }); + temp_engine.add_event("#ships-link", "click", () => { + Ship(temp_engine); + }); +} + +function loged_links() { + $(".nav-links").prepend(` +Agent name : ${My.agent.name}
+Credits : ${My.agent.credits}
+Ships : ${My.agent.ships_cpt}
+Faction : ${My.agent.faction}
+HQ : ${My.agent.hq}
+ `); +} + +export default function menu_mod(temp_engine) { + init_menu(temp_engine); + if (My.agent) { + show_stats(); + loged_links(); + } +} diff --git a/js/controllers/reg.js b/js/controllers/reg.js new file mode 100644 index 0000000..a8b8425 --- /dev/null +++ b/js/controllers/reg.js @@ -0,0 +1,64 @@ +import { Modal } from "../skama_code/ui/modal.js"; +import { Auth } from "../skama_code/auth/auth.js"; +import { My } from "../skama_code/api/agent.js"; +import home from "./home.js"; +import menu_mod from "./menu_mod.js"; + +export default function reg(temp_engine) { + let active = false; + let auth = new Auth(true); + let modal = new Modal("reg-modal", temp_engine); + + function render_reg() { + temp_engine.render(`templates/auth/reg.html`); + modal.load("templates/auth/reg_modal.html") + } + + modal.add_class("ext-modal"); + temp_engine.after_render(menu_mod); + + render_reg(); + + temp_engine.add_event("#ok", "click", () => { + home(temp_engine); + }); + + temp_engine.add_event("#forget_reg", "click", () => { + My.agent = null; + auth.unload_token(); + modal.close(); + render_reg(); + }); + + temp_engine.add_event("#val", "click", () => { + if (!active) { + active = true; + let name = $("#in-name").val(); + let faction = $("#in-faction").val(); + auth.register({ + name: name, + faction: faction + }); + } + }); + + temp_engine.add_event("#cancel", "click", () => { + $("#in-name").val(""); + $("#in-faction").val(""); + }); + + auth.done((agent) => { + $(".show-token").text(agent.token); + modal.show(); + My.agent = agent; + active = false; + }).fail((errs) => { + $(".errors").html(""); + errs.forEach(err => { + $(".errors").append(` +${err}
+ `); + }); + active = false; + }); +} \ No newline at end of file diff --git a/js/controllers/ships.js b/js/controllers/ships.js new file mode 100644 index 0000000..9fd3da7 --- /dev/null +++ b/js/controllers/ships.js @@ -0,0 +1,38 @@ +import menu_mod from "./menu_mod.js"; +import { Modal } from "../skama_code/ui/modal.js"; +import { Ship } from "../skama_code/api/ship.js"; + +export default (temp_engine) => { + let modal = new Modal("ship-modal", temp_engine); + + temp_engine.after_render((temp_engine) => { + menu_mod(temp_engine); + modal.load("templates/ship/ship_modal.html"); + + Ship.list((ship) => { + ship.data.forEach(data => { + console.log(data) + $(".ships").html( + ` +fuel capacity: ${data.fuel.capacity}
+