@sem_5_pi_grupo100/sgrai-game
v1.0.5
Published
- 1161360 - Alexandre Ametller - 1141270 - Álvaro Franco - 1180005 - Breno Leonhardt Pacheco - 1020507 - Bruno Resende
Downloads
6
Readme
SGRAI - Representacao gráfica da rede social
- 1161360 - Alexandre Ametller
- 1141270 - Álvaro Franco
- 1180005 - Breno Leonhardt Pacheco
- 1020507 - Bruno Resende
Install
npm install @sem_5_pi_grupo100/sgrai-game
Import
import * as Game from '@sem_5_pi_grupo100/sgrai-game';
Game.start(data);
Embed
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="./build/style.css" rel="stylesheet" />
<style>
#canvas {
background-color: #ccccff;
width: 90vw;
height: 90vh;
margin: auto;
margin-top: 5vh;
}
</style>
</head>
<body>
<div id="canvas" />
<script type="module">
import * as Game from "/node_modules/@sem_5_pi_grupo100/sgrai-game/build/bundle.min.js";
Game.start();
</script>
</body>
</html>
Develop
# install local server
npm install
npm start
# build module
npm run build
# publish package
npm publish --access public
API
// Game.start(data = DEFAULT_DATA)
// inicia o jogo em um div com id="canvas"
//
// Exemplo de data:
const data = {
"jogador": 0,
"rede": [
{
"id": 1,
"name": "Anna",
"email": "[email protected]",
"tags": ["musica", "video"],
"connections": [
{ "id": 2, "force": 20 },
{ "id": 4, "force": 20 },
{ "id": 6, "force": 20 },
{ "id": 7, "force": 20 },
]
},
{
"id": 2,
"name": "João",
"tags": ["cinema", "video", "musica"],
"email": "[email protected]",
"connections": [
{ "id": 1, "force": 20 },
{ "id": 3, "force": 20 },
]
}
// ...
}