Compare commits
10 Commits
main
...
agent_sach
Author | SHA1 | Date |
---|---|---|
|
c16052c3d2 | ago%!(EXTRA string=1 year) |
|
e49df1cbde | ago%!(EXTRA string=1 year) |
|
2a2f25edcf | ago%!(EXTRA string=1 year) |
|
301d03a612 | ago%!(EXTRA string=1 year) |
|
28cf9a8926 | ago%!(EXTRA string=1 year) |
|
52fa64e4e3 | ago%!(EXTRA string=1 year) |
|
b3c2858bc7 | ago%!(EXTRA string=1 year) |
|
7df8951fa1 | ago%!(EXTRA string=1 year) |
|
a4fc7e0afb | ago%!(EXTRA string=1 year) |
|
6eadb2a471 | ago%!(EXTRA string=1 year) |
@ -1,5 +1,5 @@ |
||||
/* Copyright © 2023 Entreprise SpaceTarders */ |
||||
canvas { |
||||
width: 50%; |
||||
border: 2px solid black; |
||||
border: 2px solid rgb(7, 18, 41); |
||||
border-radius: 5px; |
||||
} |
@ -0,0 +1,40 @@ |
||||
/* Copyright © 2023 Entreprise SpaceTarders */ |
||||
html{ |
||||
background-color: rgb(7, 18, 41); |
||||
cursor: crosshair; |
||||
} |
||||
main{ |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
#title{ |
||||
font-family: M42; |
||||
font-size:15px; |
||||
margin-left: 10px; |
||||
margin-top: 10px; |
||||
color: white; |
||||
display: flex; |
||||
justify-content: left; |
||||
} |
||||
|
||||
#menu { |
||||
display: flex; |
||||
justify-content: center; |
||||
justify-content: space-between; |
||||
} |
||||
#menu button{ |
||||
margin-top: 15px; |
||||
font-family: M42; |
||||
color: white; |
||||
font-size: 11px; |
||||
background-color: rgb(20, 20, 32); |
||||
cursor: pointer; |
||||
} |
||||
#canvas { |
||||
border: 2px solid rgb(7, 18, 41); |
||||
border-radius: 5px; |
||||
} |
||||
@font-face { |
||||
font-family: M42; |
||||
src: url(/fonts/m42.TTF); |
||||
} |
@ -0,0 +1,50 @@ |
||||
/* Copyright © 2023 Entreprise SpaceTarders */ |
||||
html{ |
||||
background-color: rgb(7, 18, 41); |
||||
} |
||||
img{ |
||||
width: 10%; |
||||
margin-right: 30px; |
||||
} |
||||
.text{ |
||||
font-size:8px; |
||||
font-family: M42; |
||||
color: white; |
||||
} |
||||
header p{ |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
#title{ |
||||
font-family: M42; |
||||
font-size:20px; |
||||
margin-left: 10px; |
||||
margin-top: 50px; |
||||
color: white; |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
#menu { |
||||
display: flex; |
||||
justify-content: center; |
||||
justify-content: space-between; |
||||
} |
||||
#menu button{ |
||||
margin-top: 15px; |
||||
font-family: M42; |
||||
color: white; |
||||
font-size: 15px; |
||||
background-color: rgb(20, 20, 32); |
||||
} |
||||
footer p{ |
||||
position: fixed; |
||||
bottom: 0; |
||||
} |
||||
canvas { |
||||
border: 2px solid rgb(7, 18, 41); |
||||
border-radius: 5px; |
||||
} |
||||
@font-face { |
||||
font-family: M42; |
||||
src: url(/fonts/m42.TTF); |
||||
} |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 969 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 315 KiB |
After Width: | Height: | Size: 203 KiB |
After Width: | Height: | Size: 135 B |
After Width: | Height: | Size: 767 B |
After Width: | Height: | Size: 579 B |
After Width: | Height: | Size: 729 B |
After Width: | Height: | Size: 675 B |
@ -0,0 +1,118 @@ |
||||
let token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGlmaWVyIjoiUEVVU0RPU0FDSEEiLCJ2ZXJzaW9uIjoidjIuMS40IiwicmVzZXRfZGF0ZSI6IjIwMjMtMTItMDIiLCJpYXQiOjE3MDI1Mzk4NjUsInN1YiI6ImFnZW50LXRva2VuIn0.QL4rSruHd8pjNczeZQ3S7gof7TRnwZKqQBvkojUXgmzRrWiDZVw65kt1UBns0zHAhZF-m-bvxfUBik01uIzc-_jSO63ZndquPFmv_UY3HBkVK7UKoSaxAp_NveJsE1TOpTotUChlMd1Sv7RuyeR9fso2eN3-mBEoE5ukWmGVDfnOYefuWORhisqIkh4ti3QpaV-obycZ4XGV2ukqkiNdHqR3MQJR99e2nCEZEsarNKTgm6mgn-qCCNv4xQUGwhNbD5_p-jPqQ088vuFCeZi8j6kf7-fmT5sysBxEA5nvNPDIEL1XMuzs7N66WpiP1uc7I1Ph164m2epV9vmEvzthCw"; |
||||
//décalage |
||||
let offset = { |
||||
x: 2, |
||||
y: 2 |
||||
}; |
||||
let max = 40; |
||||
let min = 35; |
||||
let w = 1260; |
||||
let h = 830; |
||||
|
||||
const canvas = new fabric.Canvas("canvas",{ |
||||
width: w, |
||||
height: h, |
||||
backgroundColor:"rgb(7, 18, 41)", |
||||
renderOnAddRemove: false, |
||||
defaultCursor :'crosshair', |
||||
hoverCursor :'pointer' |
||||
}); |
||||
canvas.renderAll(); |
||||
let planets = []; |
||||
|
||||
function getAgent() { |
||||
const settings = { |
||||
async: true, |
||||
crossDomain: true, |
||||
url: 'https://api.spacetraders.io/v2/my/agent', |
||||
method: 'GET', |
||||
headers: { |
||||
Accept: 'application/json', |
||||
Authorization: `Bearer ${token}` |
||||
} |
||||
}; |
||||
$.ajax(settings).done(function (reponse) { |
||||
let metaSystem = reponse.data.headquarters.split("-"); |
||||
getSystem(metaSystem[0] + "-" + metaSystem[1]); |
||||
}); |
||||
} |
||||
|
||||
function getSystem(system) { |
||||
const settings = { |
||||
async: true, |
||||
crossDomain: true, |
||||
url: `https://api.spacetraders.io/v2/systems/${system}`, |
||||
method: 'GET', |
||||
headers: { |
||||
Accept: 'application/json' |
||||
} |
||||
}; |
||||
|
||||
$.ajax(settings).done(function (response) { |
||||
offsetOrbits(response.data.waypoints); |
||||
drawSystem(response.data.waypoints); |
||||
}); |
||||
} |
||||
function offsetOrbits(waypoints){ |
||||
waypoints.forEach((waypoint) => { |
||||
if (waypoint.orbits) { |
||||
let x = Math.floor(Math.random() * max - Math.random() * max); |
||||
let y = Math.floor(Math.random() * max - Math.random() * max); |
||||
waypoint.orbitaldistance = { |
||||
x: x, |
||||
y: y |
||||
}; |
||||
waypoint.rotation = 3; |
||||
} |
||||
}); |
||||
} |
||||
function drawSystem(wayPoints) { |
||||
if(wayPoints) { |
||||
wayPoints.forEach(wayPoint => { |
||||
drawWaypoint(wayPoint); |
||||
//TestPlanetClicked(wayPoint); |
||||
}); |
||||
} |
||||
} |
||||
function drawWaypoint(wayPoint) { |
||||
let shadow = new fabric.Shadow({ |
||||
color: "white", |
||||
blur: 5, |
||||
offsetX: 0, |
||||
offsetY: 0, |
||||
}); |
||||
|
||||
fabric.Image.fromURL('http://127.0.0.1:5500/img/planets/planetproto.png', function(planet) { |
||||
//FABRICJS |
||||
planet.set({selectable: false}); |
||||
planet.set({shadow: shadow}); |
||||
//AJOUT DES PROPRIÉTÉS DES WAYPOINT SUR LES PLANETES |
||||
planet.set({left: wayPoint.x/offset.x + w/2}); |
||||
planet.set({top: wayPoint.y/offset.y+ h/2}); |
||||
planet.set({name: wayPoint.symbol}); |
||||
planet.set({type: wayPoint.type}); |
||||
canvas.add(planet); |
||||
}); |
||||
planets.push(wayPoint); |
||||
} |
||||
function movePlanets() { |
||||
planets.forEach(waypoint => { |
||||
if(waypoint.rotation != 0){ |
||||
} |
||||
}); |
||||
} |
||||
getAgent(); |
||||
setTimeout(function animate() { |
||||
movePlanets(); |
||||
canvas.renderAll(); |
||||
setTimeout(animate, 1000); |
||||
}, 10); |
||||
|
||||
canvas.on('mouse:up', function (e) { |
||||
if(e.target.shadow.color == "red"){ |
||||
e.target.shadow.color = "white" |
||||
} |
||||
else{ |
||||
e.target.shadow.color = "red" |
||||
} |
||||
}) |
@ -0,0 +1,6 @@ |
||||
const canvas = new fabric.Canvas("canvas",{ |
||||
width: 500, |
||||
height: 500, |
||||
backgroundColor:"black" |
||||
}); |
||||
canvas.renderAll(); |
@ -1,19 +1,32 @@ |
||||
<!-- Copyright © 2023 Entreprise SpaceTarders --> |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<link rel="stylesheet" href="../css/style.css"> |
||||
<link rel="stylesheet" href="../css/styleindex.css"> |
||||
<link rel="icon" type="image/png" href="/img/spaceships/spaceship.png"> |
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
||||
<script src="../js/main.js"></script> |
||||
<title>Space traders</title> |
||||
<script src ="/js/fabric.min.js" defer></script> |
||||
<script src="/js/TEST_F.JS" defer></script> |
||||
<title>Space Traders : by SKAMKRAFT</title> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div id="title">SpaceTraders</div> |
||||
</header> |
||||
<main class="main-window"> |
||||
<input id="token" type="text"> |
||||
<br> |
||||
<canvas id="canvas"></canvas> |
||||
</main> |
||||
<footer> |
||||
<div id="menu"> |
||||
<button id="agentbutton">Agent</button> |
||||
<button id="factionbutton">Faction</button> |
||||
<button id="shipbutton">Ships</button> |
||||
<button id="contractbutton">Contracts</button> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
@ -0,0 +1,24 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<link rel="stylesheet" href="../css/stylelogin.css"> |
||||
<title>Login</title> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div id="title"> |
||||
<img src="/img/logo/logoblancnotext.png" alt="logo"> |
||||
<h1>SpaceTraders</h1> |
||||
</div> |
||||
<p class="text">API loaded with SKAMKRAFT</p> |
||||
</header> |
||||
<main> |
||||
|
||||
</main> |
||||
<footer> |
||||
<p class="text">Copyright 2023 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