mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-28 01:30:17 +01:00
Restructuration of the project folders
This commit is contained in:
48
server/traque-front/util/configurations.js
Normal file
48
server/traque-front/util/configurations.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { ZoneTypes, Colors } from "./types";
|
||||
|
||||
export const mapLocations = {
|
||||
paris: [48.86, 2.33]
|
||||
}
|
||||
|
||||
export const mapZooms = {
|
||||
low: 4,
|
||||
high: 15,
|
||||
}
|
||||
|
||||
export const mapStyles = {
|
||||
default: {
|
||||
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
||||
arrowColor: "black",
|
||||
currentZoneColor: "red",
|
||||
nextZoneColor: "green",
|
||||
placementZoneColor: "blue",
|
||||
playerColor: "blue"
|
||||
},
|
||||
satellite: {
|
||||
url: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
||||
attribution: 'Tiles © Esri',
|
||||
arrowColor: "white",
|
||||
currentZoneColor: "red",
|
||||
nextZoneColor: "#0F0",
|
||||
placementZoneColor: "#0FF",
|
||||
playerColor: "blue"
|
||||
},
|
||||
}
|
||||
|
||||
export const defaultZoneSettings = {
|
||||
circle: {type: ZoneTypes.CIRCLE, min: null, max: null, reductionCount: 4, duration: 10},
|
||||
polygon: {type: ZoneTypes.POLYGON, polygons: []}
|
||||
}
|
||||
|
||||
export const teamStatus = {
|
||||
default: { label: "Indisponible", color: Colors.black },
|
||||
playing: { label: "En jeu", color: Colors.green },
|
||||
captured: { label: "Capturée", color: Colors.red },
|
||||
outofzone: { label: "Hors zone", color: Colors.orange },
|
||||
ready: { label: "Placée", color: Colors.green },
|
||||
notready: { label: "Non placée", color: Colors.red },
|
||||
waiting: { label: "En attente", color: Colors.grey },
|
||||
victory: { label: "Victoire", color: Colors.green },
|
||||
defeat: { label: "Défaite", color: Colors.red },
|
||||
}
|
||||
18
server/traque-front/util/functions.js
Normal file
18
server/traque-front/util/functions.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { GameState } from './types';
|
||||
import { teamStatus } from './configurations';
|
||||
|
||||
export function getStatus(team, gamestate) {
|
||||
if (!team) return null;
|
||||
switch (gamestate) {
|
||||
case GameState.SETUP:
|
||||
return teamStatus.waiting;
|
||||
case GameState.PLACEMENT:
|
||||
return team.ready ? teamStatus.ready : teamStatus.notready;
|
||||
case GameState.PLAYING:
|
||||
return team.captured ? teamStatus.captured : team.outOfZone ? teamStatus.outofzone : teamStatus.playing;
|
||||
case GameState.FINISHED:
|
||||
return team.captured ? teamStatus.defeat : teamStatus.victory;
|
||||
default:
|
||||
return teamStatus.default;
|
||||
}
|
||||
}
|
||||
19
server/traque-front/util/types.js
Normal file
19
server/traque-front/util/types.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export const Colors = {
|
||||
black: "#000000",
|
||||
grey: "#808080",
|
||||
green: "#19e119",
|
||||
red: "#e11919",
|
||||
orange: "#fa6400"
|
||||
}
|
||||
|
||||
export const GameState = {
|
||||
SETUP: "setup",
|
||||
PLACEMENT: "placement",
|
||||
PLAYING: "playing",
|
||||
FINISHED: "finished"
|
||||
}
|
||||
|
||||
export const ZoneTypes = {
|
||||
CIRCLE: "circle",
|
||||
POLYGON: "polygon"
|
||||
}
|
||||
Reference in New Issue
Block a user