Compare commits

...

16 Commits

Author SHA1 Message Date
Rudy Masson 24508d811e composant player 2024-02-24 17:35:24 +01:00
afornerot 0566cde540 svg 2024-02-24 16:34:16 +01:00
Rudy Masson fd552afef9 png 2024-02-24 16:08:19 +01:00
afornerot 1e3468f2e7 svg 2024-02-24 15:32:36 +01:00
Rudy Masson 9c6377bc43 sound 2024-02-24 15:19:55 +01:00
afornerot 2060492ab6 svg 2024-02-24 15:12:54 +01:00
Rudy Masson ab084d515a svg 2024-02-24 15:05:23 +01:00
afornerot 80bdf4afb5 svg 2024-02-24 12:59:30 +01:00
afornerot 39ae7a4fb0 svg 2024-02-24 12:34:14 +01:00
afornerot 61191bf0bc svg 2024-02-24 12:20:14 +01:00
afornerot 8674fd506d svg 2024-02-24 12:15:58 +01:00
afornerot 68891dc445 svg 2024-02-24 12:00:53 +01:00
afornerot c3aca4a2b8 svg 2024-02-24 11:09:19 +01:00
afornerot ca53930b51 svg 2024-02-24 03:13:02 +01:00
Rudy Masson bae336b31b add function tile, tilelevel 2024-02-23 23:05:35 +01:00
afornerot e853921fcd svg 2024-02-23 22:37:46 +01:00
12 changed files with 620 additions and 193 deletions

71
doc/data.json Normal file
View File

@ -0,0 +1,71 @@
# card
var obj = initCard(ctx, { _id: "lose10", image: "images/cards/loose10.png", title: "Hey ! t'avais pas un billet de 10 ?", description: "Vous perdez 10€" effect: "-10", sound: "looser" });
var obj = initCard(ctx, { _id: "lose20", image: "images/cards/loose20.png", title: "On t'as vu balancer ton papier dans la rue !", description: "Vous perdez 20€" effect: "-20", sound: "looser" });
var obj = initCard(ctx, { _id: "lose30", image: "images/cards/loose30.png", title: "T'as oublié l'anniversaire de ta mère !", description: "Vous perdez 30€" effect: "-30", sound: "looser" });
var obj = initCard(ctx, { _id: "brokenglass", image: "images/cards/borken-glass.png", title: "T'as deux mains gauches ? Attention les verres !", description: "Tu rembourses un verre cassé, valeur 10€" effect: "-10", sound: "looser" });
var obj = initCard(ctx, { _id: "lownight", image: "images/cards/lownight.png", title: "C'est mort ce soir ! Personne dans le rad !", description: "Tu perds 50€" effect: "-50", sound: "looser" });
var obj = initCard(ctx, { _id: "flood", image: "images/cards/flood.png", title: "Soirée piscine ! Enfin soirée plomberie surtout !", description: "Tu perds 40€" effect: "-40", sound: "looser" });
var obj = initCard(ctx, { _id: "robber", image: "images/cards/robber.png", title: "Il a tapé dans la caisse !", description: "On t'as volé 60€" effect: "-60", sound: "looser" });
var obj = initCard(ctx, { _id: "tomuch", image: "images/cards/tomuch.png", title: "Un p'tit dernier pour la route !", description: "Le verre de trop, amande de 80€" effect: "-80", sound: "looser" });
var obj = initCard(ctx, { _id: "somethingiswrong", image: "images/cards/somethingiswrong.png", title: "Tu ne sais pas rendre la monnaie !", description: "Tu rends 20€ de trop a un client chanceux !" effect: "-20", sound: "looser" });
var obj = initCard(ctx, { _id: "rebuild", image: "images/cards/rebuild.png", title: "On refait la déco !", description: "Rénove ton bar pour la modique somme de 50€" effect: "-50", sound: "looser" });
var obj = initCard(ctx, { _id: "shortage", image: "images/cards/shortage.png", title: "Dévalisé !", description: "Tu t'es fait dévaliser, plus rien en stock" effect: "100", sound: "winner" });
var obj = initCard(ctx, { _id: "luckyday", image: "images/cards/luckyday.png", title: "C'est un billet de 10 non ?", description: "Tu trouves 10€ devant ton bar" effect: "10", sound: "winner" });
var obj = initCard(ctx, { _id: "rushhour", image: "images/cards/rushhour.png", title: "C'est la folie dans ton bar !", description: "Tu gagnes 50€ !" effect: "50", sound: "winner" });
var obj = initCard(ctx, { _id: "blindtest", image: "images/cards/blindtest.png", title: "Tu gagnes la soirée blind test !", description: "Premier prix 20€ !" effect: "20", sound: "winner" });
var obj = initCard(ctx, { _id: "bigtip", image: "images/cards/bigtip.png", title: "Tes clients t'adores !", description: "20€ de pourboire !" effect: "20", sound: "winner" });
var obj = initCard(ctx, { _id: "baroftheweek", image: "images/cards/baroftheweek.png", title: "Tu gagnes le concours du bar de la semaine !", description: "Premier prix 50€ !" effect: "50", sound: "winner" });
var obj = initCard(ctx, { _id: "goodnight", image: "images/cards/goodnight.png", title: "On t'en a trop rendus !", description: "Tu gagnes 30€ !" effect: "30", sound: "winner" });
var obj = initCard(ctx, { _id: "yourdadishere", image: "images/cards/yourdadishere.png", title: "Ton père est là ! Paye une tournée de plus !", description: "Payer 30€ de plus !" effect: "-30", sound: "looser" });
var obj = initCard(ctx, { _id: "dontdrive", image: "images/cards/dontdrive.png", title: "Le ballon a dit non !", description: "Paye un taxi pour rentrer 10€ !" effect: "-10", sound: "looser" });
var obj = initCard(ctx, { _id: "flambeur", image: "images/cards/flambeur.png", title: "Tournée générale !", description: "Paye 60€ !" effect: "-60", sound: "looser" });
var obj = initCard(ctx, { _id: "cuteashell", image: "images/cards/cuteashell.png", title: "Tu es de toute beauté !", description: "On t'offres 40€ !" effect: "40", sound: "winner" });
var obj = initCard(ctx, { _id: "loseitall", image: "images/cards/loseitall.png", title: "Tu as oublié ton portefeuille !", description: "Tu perds 50€ !" effect: "-50", sound: "looser" });
# Types de tile
var obj = initTiletype(ctx, { _id: "bar", description: "bar" });
var obj = initTiletype(ctx, { _id: "meetup", description: "Rencontre" });
var obj = initTiletype(ctx, { _id: "happyHour", description: "Happy Hour" });
var obj = initTiletype(ctx, { _id: "prison", description: "Cellule de dégrisement"});
var obj = initTiletype(ctx, { _id: "start", description: "Week-end"});
# Level de bars
var obj = initTilelevel(ctx, { _id: "pmu", order: 1, description: "PMU" });
var obj = initTilelevel(ctx, { _id: "bistro", order: 2, description: "Bistro de quartien"});
var obj = initTilelevel(ctx, { _id: "brasserie", order: 3, description: "Brasserie" });
var obj = initTilelevel(ctx, { _id: "barabiere", order: 4, description: "Bar à bières" });
var obj = initTilelevel(ctx, { _id: "baravin", order: 5, description: "Bar à vin" });
var obj = initTilelevel(ctx, { _id: "cocktails", order: 6, description: "Bar a cocktails" });
var obj = initTilelevel(ctx, { _id: "lounge", order: 7, description: "Lounge" });
var obj = initTilelevel(ctx, { _id: "clubprive", order: 8, description: "Club privé" });
# Cases
var obj = initTile(ctx, { _id: "st", position: "0", tiletype: "start", name: "Week-end" });
var obj = initTile(ctx, { _id: "b1", position: "1", tiletype: "bar", name: "Les hirondelles", prixDeBase: "1" });
var obj = initTile(ctx, { _id: "b2", position: "2", tiletype: "bar", name: "Le cheval blanc", prixDeBase: "1" });
var obj = initTile(ctx, { _id: "meetup1", position: "3", tiletype: "meetup", name: "Rencontre" });
var obj = initTile(ctx, { _id: "b3", position: "4", tiletype: "bar", name: "L'ABC", prixDeBase: "2" });
var obj = initTile(ctx, { _id: "b4", position: "5", tiletype: "bar", name: "La taverne", prixDeBase: "2" });
var obj = initTile(ctx, { _id: "hh1", position: "6", tiletype: "happyHour", name: "Happy hour" });
var obj = initTile(ctx, { _id: "b6", position: "7", tiletype: "bar", name: "La fine mousse", prixDeBase: "3" });
var obj = initTile(ctx, { _id: "b7", position: "8", tiletype: "bar", name: "Le barboteur", prixDeBase: "3" });
var obj = initTile(ctx, { _id: "b7", position: "9", tiletype: "bar", name: "Le palais de la bière", prixDeBase: "3" });
var obj = initTile(ctx, { _id: "meetup2", position: "10", tiletype: "meetup", name: "Rencontre" });
var obj = initTile(ctx, { _id: "b8", position: "11", tiletype: "bar", name: "Le comptoir des bières", prixDeBase: "4" });
var obj = initTile(ctx, { _id: "b9", position: "12", tiletype: "bar", name: "Les moulins bleus", prixDeBase: "4" });
var obj = initTile(ctx, { _id: "b10", position: "13", tiletype: "bar", name: "Le fourquet", prixDeBase: "4" });
var obj = initTile(ctx, { _id: "prs", position: "14", tiletype: "prison", name: "Cellule de dégrisement" });
var obj = initTile(ctx, { _id: "b11", position: "15", tiletype: "bar", name: "Au beaux fûts", prixDeBase: "5" });
var obj = initTile(ctx, { _id: "b12", position: "16", tiletype: "bar", name: "Le Bacchus", prixDeBase: "5" });
var obj = initTile(ctx, { _id: "b13", position: "17", tiletype: "bar", name: "Matusalém", prixDeBase: "5" });
var obj = initTile(ctx, { _id: "meetup3", position: "18", tiletype: "meetup", name: "Rencontre" });
var obj = initTile(ctx, { _id: "b14", position: "19", tiletype: "bar", name: "Bloody Marianne", prixDeBase: "6" });
var obj = initTile(ctx, { _id: "b15", position: "20", tiletype: "bar", name: "Shake it up", prixDeBase: "6" });
var obj = initTile(ctx, { _id: "b16", position: "21", tiletype: "bar", name: "Le mixologue", prixDeBase: "6" });
var obj = initTile(ctx, { _id: "hh2", position: "22", tiletype: "happyHour", name: "Happy hour" });
var obj = initTile(ctx, { _id: "b17", position: "23", tiletype: "bar", name: "Le senateur", prixDeBase: "7" });
var obj = initTile(ctx, { _id: "b18", position: "24", tiletype: "bar", name: "La dame blanche", prixDeBase: "7" });
var obj = initTile(ctx, { _id: "meetup4", position: "25", tiletype: "meetup", name: "Rencontre" });
var obj = initTile(ctx, { _id: "b19", position: "26", tiletype: "bar", name: "Le Kube", prixDeBase: "8" });
var obj = initTile(ctx, { _id: "b20", position: "27", tiletype: "bar", name: "L'amirauté", prixDeBase: "8" });

View File

@ -17,8 +17,79 @@ function setFixures() {
}
// Config
console.log("Fixures Config");
console.log("Fixtures Config");
var obj = initConfig(ctx, {"_id": "version", "default": "0.0.0","visible":false});
// Card
var obj = initCard(ctx, { _id: "lose10", image: "images/cards/loose10.png", title: "Hey ! t'avais pas un billet de 10 ?", description: "Vous perdez 10€", effect: "-10", sound: "looser" });
var obj = initCard(ctx, { _id: "lose20", image: "images/cards/loose20.png", title: "On t'as vu balancer ton papier dans la rue !", description: "Vous perdez 20€", effect: "-20", sound: "looser" });
var obj = initCard(ctx, { _id: "lose30", image: "images/cards/loose30.png", title: "T'as oublié l'anniversaire de ta mère !", description: "Vous perdez 30€", effect: "-30", sound: "looser" });
var obj = initCard(ctx, { _id: "brokenglass", image: "images/cards/borken-glass.png", title: "T'as deux mains gauches ? Attention les verres !", description: "Tu rembourses un verre cassé, valeur 10€", effect: "-10", sound: "looser" });
var obj = initCard(ctx, { _id: "lownight", image: "images/cards/lownight.png", title: "C'est mort ce soir ! Personne dans le rad !", description: "Tu perds 50€", effect: "-50", sound: "looser" });
var obj = initCard(ctx, { _id: "flood", image: "images/cards/flood.png", title: "Soirée piscine ! Enfin soirée plomberie surtout !", description: "Tu perds 40€", effect: "-40", sound: "looser" });
var obj = initCard(ctx, { _id: "robber", image: "images/cards/robber.png", title: "Il a tapé dans la caisse !", description: "On t'as volé 60€", effect: "-60", sound: "looser" });
var obj = initCard(ctx, { _id: "tomuch", image: "images/cards/tomuch.png", title: "Un p'tit dernier pour la route !", description: "Le verre de trop, amande de 80€", effect: "-80", sound: "looser" });
var obj = initCard(ctx, { _id: "somethingiswrong", image: "images/cards/somethingiswrong.png", title: "Tu ne sais pas rendre la monnaie !", description: "Tu rends 20€ de trop a un client chanceux !", effect: "-20", sound: "looser" });
var obj = initCard(ctx, { _id: "rebuild", image: "images/cards/rebuild.png", title: "On refait la déco !", description: "Rénove ton bar pour la modique somme de 50€", effect: "-50", sound: "looser" });
var obj = initCard(ctx, { _id: "shortage", image: "images/cards/shortage.png", title: "Dévalisé !", description: "Tu t'es fait dévaliser, plus rien en stock", effect: "100", sound: "winner" });
var obj = initCard(ctx, { _id: "luckyday", image: "images/cards/luckyday.png", title: "C'est un billet de 10 non ?", description: "Tu trouves 10€ devant ton bar", effect: "10", sound: "winner" });
var obj = initCard(ctx, { _id: "rushhour", image: "images/cards/rushhour.png", title: "C'est la folie dans ton bar !", description: "Tu gagnes 50€ !", effect: "50", sound: "winner" });
var obj = initCard(ctx, { _id: "blindtest", image: "images/cards/blindtest.png", title: "Tu gagnes la soirée blind test !", description: "Premier prix 20€ !", effect: "20", sound: "winner" });
var obj = initCard(ctx, { _id: "bigtip", image: "images/cards/bigtip.png", title: "Tes clients t'adores !", description: "20€ de pourboire !", effect: "20", sound: "winner" });
var obj = initCard(ctx, { _id: "baroftheweek", image: "images/cards/baroftheweek.png", title: "Tu gagnes le concours du bar de la semaine !", description: "Premier prix 50€ !", effect: "50", sound: "winner" });
var obj = initCard(ctx, { _id: "goodnight", image: "images/cards/goodnight.png", title: "On t'en a trop rendus !", description: "Tu gagnes 30€ !", effect: "30", sound: "winner" });
var obj = initCard(ctx, { _id: "yourdadishere", image: "images/cards/yourdadishere.png", title: "Ton père est là ! Paye une tournée de plus !", description: "Payer 30€ de plus !", effect: "-30", sound: "looser" });
var obj = initCard(ctx, { _id: "dontdrive", image: "images/cards/dontdrive.png", title: "Le ballon a dit non !", description: "Paye un taxi pour rentrer 10€ !", effect: "-10", sound: "looser" });
var obj = initCard(ctx, { _id: "flambeur", image: "images/cards/flambeur.png", title: "Tournée générale !", description: "Paye 60€ !", effect: "-60", sound: "looser" });
var obj = initCard(ctx, { _id: "cuteashell", image: "images/cards/cuteashell.png", title: "Tu es de toute beauté !", description: "On t'offres 40€ !", effect: "40", sound: "winner" });
var obj = initCard(ctx, { _id: "loseitall", image: "images/cards/loseitall.png", title: "Tu as oublié ton portefeuille !", description: "Tu perds 50€ !", effect: "-50", sound: "looser" });
// Tiletype
var obj = initTiletype(ctx, { _id: "bar", description: "bar" });
var obj = initTiletype(ctx, { _id: "meetup", description: "Rencontre" });
var obj = initTiletype(ctx, { _id: "happyHour", description: "Happy Hour" });
var obj = initTiletype(ctx, { _id: "prison", description: "Cellule de dégrisement"});
var obj = initTiletype(ctx, { _id: "start", description: "Week-end"});
// Titlelevel
var obj = initTilelevel(ctx, { _id: "pmu", order: 1, description: "PMU" });
var obj = initTilelevel(ctx, { _id: "bistro", order: 2, description: "Bistro de quartien"});
var obj = initTilelevel(ctx, { _id: "brasserie", order: 3, description: "Brasserie" });
var obj = initTilelevel(ctx, { _id: "barabiere", order: 4, description: "Bar à bières" });
var obj = initTilelevel(ctx, { _id: "baravin", order: 5, description: "Bar à vin" });
var obj = initTilelevel(ctx, { _id: "cocktails", order: 6, description: "Bar a cocktails" });
var obj = initTilelevel(ctx, { _id: "lounge", order: 7, description: "Lounge" });
var obj = initTilelevel(ctx, { _id: "clubprive", order: 8, description: "Club privé" });
// Case
var obj = initTile(ctx, { _id: "st", position: 0, tiletype: "start", size:"big", name: "Week-end", img: "https://static.actu.fr/uploads/2017/05/rue-de-la-soif-Rennes-960x640.jpg" });
var obj = initTile(ctx, { _id: "b1", position: 1, tiletype: "bar", size:"small", name: "Les hirondelles", price: "1", img: "https://media-cdn.tripadvisor.com/media/photo-s/08/99/ef/5a/les-hirondelles.jpg" });
var obj = initTile(ctx, { _id: "b2", position: 2, tiletype: "bar", size:"small", name: "Le cheval blanc", price: "1", img: "https://media-cdn.tripadvisor.com/media/photo-s/14/f4/ed/0f/le-cheval-blanc.jpg" });
var obj = initTile(ctx, { _id: "meetup1", position: 3, tiletype: "meetup", size:"small", name: "Rencontre", img: "https://hoptodate.com/wp-content/uploads/2022/10/Depositphotos_331369428_XL-scaled.jpg" });
var obj = initTile(ctx, { _id: "b3", position: 4, tiletype: "bar", size:"small", name: "L'ABC", price: "2", img: "https://www.pagesjaunes.fr/media/agc/52/85/77/00/00/d1/00/ab/e8/ca/62bc5285770000d100abe8ca/62bc5285770000d100abe8cc.jpg" });
var obj = initTile(ctx, { _id: "b4", position: 5, tiletype: "bar", size:"small", name: "La taverne", price: "2", img: "https://www.clamecyhautnivernais-tourisme.fr/wp-content/uploads/wpetourisme/Bar-La-Taverne-Clamecy----D.Data-900x535.jpg" });
var obj = initTile(ctx, { _id: "hh1", position: 6, tiletype: "happyHour", size:"small", name: "Happy hour", img: "https://blog.laddition.com/sites/default/files/2022-03/sans-titre-17_0.png" });
var obj = initTile(ctx, { _id: "b6", position: 7, tiletype: "bar", size:"small", name: "La fine mousse", price: "3", img: "https://cdn.eat-list.fr/establishment/photo/gallery_photo/75011-paris-11/la-fine-mousse_91615_c4c.jpg" });
var obj = initTile(ctx, { _id: "b7", position: 8, tiletype: "bar", size:"small", name: "Le barboteur", price: "3", img: "https://storage.googleapis.com/statics-wp/sites/lebarboteurlille.com/Le-Barboteur-0-1-1.jpg" });
var obj = initTile(ctx, { _id: "b8", position: 9, tiletype: "bar", size:"small", name: "Le palais de la bière", price: "3", img: "https://www.tourisme-pontaudemer-rislenormande.com/wp-content/uploads/2017/03/Palais-de-la-bi%C3%A8re.jpeg" });
var obj = initTile(ctx, { _id: "meetup2", position: 10, tiletype: "meetup", size:"small", name: "Rencontre", img: "https://www.monpetitdate.fr/wp-content/uploads/2022/01/rencontre-trans-paris.jpg" });
var obj = initTile(ctx, { _id: "b9", position: 11, tiletype: "bar", size:"small", name: "Le comptoir des bières", price: "4", img: "https://lh3.googleusercontent.com/p/AF1QipPRj-YgeXsNxXjkpxill-QMSh20T9jeNl8OLcuj=s1600-w640" });
var obj = initTile(ctx, { _id: "b10", position: 12, tiletype: "bar", size:"small", name: "Les moulins bleus", price: "4", img: "https://www.brunnenbraeu.org/Alben2/MoulinsBleusDijon/album/slides/Les%20Moulins%20Bleus%20%E2%80%93%20Craft%20Beer%20and%20Food%20%281%29.jpg" });
var obj = initTile(ctx, { _id: "b11", position: 13, tiletype: "bar", size:"small", name: "Le fourquet", price: "4", img: "https://media-cdn.tripadvisor.com/media/photo-s/0c/ce/ca/87/le-fourquet.jpg" });
var obj = initTile(ctx, { _id: "prs", position: 14, tiletype: "prison", size:"big", name: "Cellule de dégrisement", sound: "/medias/sound/goat.mp3", img: "https://lvdneng.rosselcdn.net/sites/default/files/dpistyles_v2/ena_16_9_extra_big/2022/09/05/node_1224621/55601340/public/2022/09/05/B9732002324Z.1_20220905182824_000%2BGBHL6LBT5.1-0.jpg?itok=UqmdxUiM1662450019" });
var obj = initTile(ctx, { _id: "b12", position: 15, tiletype: "bar", size:"small", name: "Au beaux fûts", price: "5", img: "https://because-gus.com/wp-content/uploads/2020/02/Bars-MaryRebeccaElliott.jpg" });
var obj = initTile(ctx, { _id: "b13", position: 16, tiletype: "bar", size:"small", name: "Le Bacchus", price: "5", img: "https://media-cdn.tripadvisor.com/media/photo-s/10/f6/a8/75/facade.jpg" });
var obj = initTile(ctx, { _id: "b14", position: 17, tiletype: "bar", size:"small", name: "Matusalém", price: "5", img: "https://foodforthought.com.my/wp-content/uploads/Franks-Bar-Matusalem-Rum-x-Franks-Food-For-Thought-1024x731.jpeg" });
var obj = initTile(ctx, { _id: "meetup3", position: 18, tiletype: "meetup", size:"small", name: "Rencontre", img: "https://test.psychologies.com/var/tests/storage/images/2/3/3/1/11332-2-fre-FR/Test-pret-rencontre_thumb_434_265.jpg" });
var obj = initTile(ctx, { _id: "b15", position: 19, tiletype: "bar", size:"small", name: "Bloody Marianne", price: "6", img: "https://lh3.googleusercontent.com/p/AF1QipPAS0edvVXEiY7_ttg_wBIegJs1Nz2lxIXmqmr3=s1600-w640" });
var obj = initTile(ctx, { _id: "b16", position: 20, tiletype: "bar", size:"small", name: "Shake it up", price: "6", img: "https://images.barrons.com/im-839994?width=700&height=466" });
var obj = initTile(ctx, { _id: "b17", position: 21, tiletype: "bar", size:"small", name: "Le mixologue", price: "6", img: "https://www.ciga.fr/img/cms/le-mixologue/mise-en-situation-le-mixologue.jpg" });
var obj = initTile(ctx, { _id: "hh2", position: 22, tiletype: "happyHour", size:"small", name: "Happy hour", img: "https://img.freepik.com/vecteurs-libre/fond-dessin-anime-happy-hours_52683-81243.jpg" });
var obj = initTile(ctx, { _id: "b18", position: 23, tiletype: "bar", size:"small", name: "Le senateur", price: "7", img: "https://media-cdn.tripadvisor.com/media/photo-s/0f/72/99/b4/montreal-marriott-chateau.jpg" });
var obj = initTile(ctx, { _id: "b19", position: 24, tiletype: "bar", size:"small", name: "La dame blanche", price: "7", img: "https://decibelles-data.media.tourinsoft.eu/upload/dame-jour.jpeg" });
var obj = initTile(ctx, { _id: "meetup4", position: 25, tiletype: "meetup", size:"small", name: "Rencontre", img: "https://www.commeuncamion.com/content/uploads/2015/08/Rencontre-Couple-Bar.jpg" });
var obj = initTile(ctx, { _id: "b20", position: 26, tiletype: "bar", size:"small", name: "Le Kube", price: "8", img: "https://www.lesbarres.com/media/image/slideshow/726a6f8ea266c7c0cbb72cbc261d3520bf8f90df.jpg" });
var obj = initTile(ctx, { _id: "b21", position: 27, tiletype: "bar", size:"small", name: "L'amirauté", price: "8", img: "https://www.lamiraute-restaurant-saintes-maries-de-la-mer.com/media/cache/resolve/l800/websites/b510beeb640a5dc50a78118b3c8f7ce2/img/restaurant-amiraute-saintes-maries-de-la-mer-04_20210927172840.jpg" });
}
// La fonction "onInit()" (si déclarée) est automatiquement
@ -35,6 +106,24 @@ function onInit() {
rpc.register("getConfig");
rpc.register("upsertConfig");
rpc.register("getCard");
rpc.register("upsertCard");
rpc.register("initCard");
rpc.register("getTiles");
rpc.register("getTile");
rpc.register("getTilebyorder");
rpc.register("upsertTile");
rpc.register("initTile");
rpc.register("getTiletype");
rpc.register("upsertTiletype");
rpc.register("initTiletype");
rpc.register("getTilelevel");
rpc.register("upsertTilelevel");
rpc.register("initTilelevel");
rpc.register("getPartys");
rpc.register("getPartyswait");
rpc.register("getParty");
@ -45,6 +134,13 @@ function onInit() {
rpc.register("getPlayer");
rpc.register("initPlayer");
rpc.register("upsertPlayer");
rpc.register("getPlayerParty");
rpc.register("upsertPlayerParty");
rpc.register("getPlayerPartys");
rpc.register("getPlayerPartyTile");
rpc.register("upsertlayerPartyTile");
}
// Repository Auth
@ -89,6 +185,78 @@ async function upsertConfig(ctx,config) {
return obj;
}
// Repository Card
async function getCard(ctx,id) {
var obj = await store.get(ctx, "Card",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function upsertCard(ctx,card) {
var obj = await store.upsert(ctx, "Card", config);
return obj;
}
function initCard(ctx,card) {
var obj = store.get(ctx, "Card",card._id);
if(obj) card.value=obj.value;
var obj = store.upsert(ctx, "Card", card);
return obj;
}
// Repository Tile
async function getTiles(ctx) {
var obj = await store.query(ctx, "Tile", {"neq":{ "_id": "" }}, { orderBy: "position" });
return obj;
}
async function getTile(ctx,id) {
var obj = await store.get(ctx, "Tile",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function getTilebyorder(ctx,position) {
var obj = await store.query(ctx, "Tile",{"eq":{ "position": position }},);
return obj[0];
}
async function upsertTile(ctx,tile) {
var obj = await store.upsert(ctx, "Tile", tile);
return obj;
}
function initTile(ctx,tile) {
var obj = store.get(ctx, "Tile",tile._id);
if(obj) tile.value=obj.value;
var obj = store.upsert(ctx, "Tile", tile);
}
// Repository TileType
async function getTiletype(ctx,id) {
var obj = await store.get(ctx, "Tiletype",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function upsertTiletype(ctx,card) {
var obj = await store.upsert(ctx, "Tiletype", config);
return obj;
}
function initTiletype(ctx,tiletype) {
var obj = store.get(ctx, "Tiletype",tiletype._id);
if(obj) tiletype.value=obj.value;
var obj = store.upsert(ctx, "Tiletype", tiletype);
}
// Repository Tilelevel
async function getTilelevel(ctx,id) {
var obj = await store.get(ctx, "Tilelevel",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function upsertTilelevel(ctx,titlelevel) {
var obj = await store.upsert(ctx, "Tilelevel", titlelevel);
return obj;
}
function initTilelevel(ctx,tilelevel) {
var obj = store.get(ctx, "Tilelevel",tilelevel._id);
if(obj) tilelevel.value=obj.value;
var obj = store.upsert(ctx, "Tilelevel", tilelevel);
}
// Repository Party
async function getPartys(ctx) {
var obj = await store.query(ctx, "Party");
@ -145,6 +313,50 @@ async function upsertPlayer(ctx,player) {
return obj;
}
// Repository PlayerParty
async function getPlayerParty(ctx,ids) {
var obj = await store.query(ctx, "PlayerParty",
{
"and": [
{"eq":{ "playerid": ids.playerid }},
{"eq":{ "partyid": ids.partyid }}
]
}
);
return obj[0];
}
// Repository PlayerPartys
async function getPlayerPartys(ctx,partyid) {
var obj = await store.query(ctx, "PlayerParty",
{"eq":{ "partyid": partyid }}
);
return obj;
}
async function upsertPlayerParty(ctx,playerparty) {
var obj = await store.upsert(ctx, "PlayerParty", playerparty);
return obj;
}
// Repository PlayerPartyCase
async function getPlayerPartyTile(ctx,ids) {
var obj = await store.query(ctx, "PlayerPartyTile",
{
"and": [
{"eq":{ "playerid": ids.playerid }},
{"eq":{ "partyid": ids.partyid }},
{"eq":{ "tileid": ids.tileid }}
]
}
);
return obj[0];
}
async function upsertPlayerPartyCase(ctx,playerpartycase) {
var obj = await store.upsert(ctx, "PlayerPartyCase", playerpartycase);
return obj;
}
// La fonction "onClientMessage(ctx, message)" est automatiquement
// exécutée quand le serveur de votre application reçoit un
// message en provenance du client.

View File

@ -318,8 +318,15 @@
.bigtile, .tile, .tilenone {
height: 200px;
background-position: center;
background-size:cover;
border: 1px red solid;
}
.tilenone {border: none;}
.rencontre{border: 1px 5px}
.sortable > span {
-webkit-touch-callout:none;
-ms-touch-action:none; touch-action:none;

View File

@ -1,7 +1,6 @@
<script>
import { createEventDispatcher } from 'svelte';
export let id;
export let selected;
export let value;
const dispatch = createEventDispatcher();
@ -25,9 +24,7 @@
}
</script>
{#if !selected}
<span id={id} class="dice cursor-pointer text-3xl flex justify-center items-center bg-red-600 text-white rounded-lg m-1 w-14 h-14">
{value}
</span>
{/if}

34
src/lib/Player.svelte Normal file
View File

@ -0,0 +1,34 @@
<script>
import { get } from "svelte/store";
export let partyid;
export let playerid;
var player;
var tile;
async function getPlayer() {
player = await Edge.Client.rpc("getPlayerParty",{"partyid": partyid, "playerid": playerid });
tile = await Edge.Client.rpc("getTile", player.tileid)
}
let promise = getPlayer();
</script>
<div style="color: white; padding: 5px; background-color: rgba(0,0,0,0.8); text-align: center">
{#await promise}
<p>waiting ...</p>
{:then ok}
<div class="flex flex-col p-1 w-20 h-80 md:w-auto md:h-auto items-center justify-center mx-1 text-black" style="background-color: {player.color}">
<img src="./medias/logo/arnold.png" alt="arnold">
{player.player.name}<br>
Argent: {player.cash}<br>
Position: {tile.name}
<!-- <span class="text-xs text-center">Joueur<br><span class="{(player._id==my._id?"text-3xl":"")}">{(player._id==my._id?"MOI":player.name)}</span></span> -->
</div>
{:catch err}
{err.message}
{/await}
</div>

34
src/lib/Tile.svelte Normal file
View File

@ -0,0 +1,34 @@
<script>
export let size;
export let _id;
export let position;
export let img;
export let name;
export let price;
export let tiletype;
export let partyid;
export let playerposition;
var style="tile";
if(size=="big") style="bigtile";
var promise = Edge.Client.rpc("getPlayerPartys",partyid);
</script>
<div class="{style} {tiletype}" style="background-image: url({img});">
<div style="color: white; padding: 5px; background-color: rgba(0,0,0,0.8); text-align: center">{name}</div>
{#await promise}
<p>waiting ...</p>
{:then players}
{#each players as player}
{#if player.tileid == _id }
<div style="width: 80px;height: 80px; background: url(./medias/logo/arnold.png) no-repeat {player.color}; background-size: 52px; background-position: center; border-radius: 50px"></div>
{/if}
{/each}
{:catch err}
{err.message}
{/await}
</div>

View File

@ -7,49 +7,16 @@ export async function load({ params }) {
let party;
let players;
let tiles;
if(player.partyid) {
party = await Edge.Client.rpc("getParty",player.partyid).catch(err => console.error(err));
players= await Edge.Client.rpc("getPartyplayers",party._id).catch(err => console.error(err));
tiles= await Edge.Client.rpc("getTiles",party._id).catch(err => console.error(err));
}
else window.location.href = '/';
if(party.status=="playerwait") {
let plateau=[
{"_id":0 ,"type":"week" ,"buyable":false,"value":50 ,"owner":[],update:0,"name":"WEEK END"},
{"_id":1 ,"type":"bar" ,"buyable":true ,"value":2 ,"owner":[],update:0,"name":"BAR 1-1"},
{"_id":2 ,"type":"bar" ,"buyable":true ,"value":2 ,"owner":[],update:0,"name":"BAR 1-2"},
{"_id":3 ,"type":"question" ,"buyable":false,"value":null ,"owner":[],update:0,"name":"Chance - Malchance"},
{"_id":4 ,"type":"bar" ,"buyable":true ,"value":4 ,"owner":[],update:0,"name":"BAR 3-1"},
{"_id":5 ,"type":"bar" ,"buyable":true ,"value":4 ,"owner":[],update:0,"name":"BAR 3-2"},
{"_id":6 ,"type":"bar" ,"buyable":true ,"value":4 ,"owner":[],update:0,"name":"BAR 3-3"},
{"_id":7 ,"type":"happy" ,"buyable":false,"value":null ,"owner":[],update:0,"name":"Happy Hour"},
{"_id":8 ,"type":"bar" ,"buyable":true ,"value":6 ,"owner":[],update:0,"name":"BAR 3-1"},
{"_id":9 ,"type":"bar" ,"buyable":true ,"value":6 ,"owner":[],update:0,"name":"BAR 3-2"},
{"_id":10,"type":"bar" ,"buyable":true ,"value":6 ,"owner":[],update:0,"name":"BAR 3-3"},
{"_id":11,"type":"prison" ,"buyable":false,"value":null ,"owner":[],update:0,"name":"Cellule de Dégrissement"},
{"_id":12,"type":"bar" ,"buyable":true ,"value":8 ,"owner":[],update:0,"name":"BAR 4-1"},
{"_id":13,"type":"bar" ,"buyable":true ,"value":8 ,"owner":[],update:0,"name":"BAR 4-2"},
{"_id":14,"type":"bar" ,"buyable":true ,"value":8 ,"owner":[],update:0,"name":"BAR 4-3"},
{"_id":15,"type":"happy" ,"buyable":false,"value":null ,"owner":[],update:0,"name":"Happy Hour"},
{"_id":16,"type":"bar" ,"buyable":true ,"value":10 ,"owner":[],update:0,"name":"BAR 5-1"},
{"_id":17,"type":"bar" ,"buyable":true ,"value":10 ,"owner":[],update:0,"name":"BAR 5-2"},
{"_id":18,"type":"bar" ,"buyable":true ,"value":10 ,"owner":[],update:0,"name":"BAR 5-3"},
{"_id":19,"type":"question" ,"buyable":false,"value":null ,"owner":[],update:0,"name":"Chance - Malchance"},
{"_id":20,"type":"bar" ,"buyable":true ,"value":12 ,"owner":[],update:0,"name":"BAR 6-1"},
{"_id":21,"type":"bar" ,"buyable":true ,"value":12 ,"owner":[],update:0,"name":"BAR 6-2"},
];
let score=[];
players.forEach(async(player) => {
score.push({"_id":player._id,"money":100,"plateauid":0});
});
party.score=score;
let dices=[
{"id":1,"value":""},
{"id":2,"value":""},
];
party.dices=dices;
console.log("wait");
}
let data = {
@ -57,7 +24,9 @@ export async function load({ params }) {
party,
players,
player,
tiles,
};
console.log(data);
Edge.Client.send({ [party._id]: data });

View File

@ -1,5 +1,7 @@
<script>
import Dice from '$lib/Dice.svelte';
import Tile from '$lib/Tile.svelte';
import Player from '$lib/Player.svelte';
import { goto } from '$app/navigation';
import { enableBodyScroll, disableBodyScroll } from 'body-scroll-lock';
import { sortable } from 'svelte-agnostic-draggable' ;
@ -24,12 +26,9 @@
let dice1;
let dice2;
let dice3;
let dice4;
let dice5;
let results=[];
Edge.Client.addEventListener("message", function(evt) {
Edge.Client.addEventListener("message", async function(evt) {
if(evt.detail.hasOwnProperty(data.party._id)) {
console.log("RECEPTION MESSAGE");
@ -55,25 +54,75 @@
// Action retour
if(my._id===data.party.playercurrent._id) {
console.log("here");
console.log("ACTION = "+data.party.playerstatus);
switch (data.party.playerstatus) {
case "":
case "dice":
data.party.playerparty = await Edge.Client.rpc("getPlayerParty", {playerid: data.party.playercurrent._id, partyid: data.party._id}).catch(err => console.error(err));
console.log(data.party.playerparty.tileid);
data.party.playertile = await Edge.Client.rpc("getTile",data.party.playerparty.tileid).catch(err => console.error(err));
console.log(data.party.playerparty);
console.log(data.party.playertile);
break;
case "diceroll":
data.party.playerdice+=data.party.dices[0].value+data.party.dices[1].value;
if(data.party.dices[0].value>0&&data.party.dices[1].value>0) {
data.party.playerdice+=data.party.dices[0].value;
data.party.playerdice+=data.party.dices[1].value;
// si resulat > 0 et non double = on passe à l'étape suivant sinon on peut rejeter
if(data.party.playerdice&&data.party.dices[0].value!=data.party.dices[1].value)
data.party.playerstatus="move";
else
data.party.playerstatus="dice";
// si resulat > 0 et non double = on passe à l'étape suivant sinon on peut rejeter
if(data.party.playerdice&&data.party.dices[0].value!=data.party.dices[1].value)
data.party.playerstatus="move";
else
data.party.playerstatus="dice";
sendMessage("DICEROLL to "+data.party.playerstatus);
}
break;
sendMessage("DICEROLL to "+data.party.playerstatus);
case "move":
let position=parseInt(data.party.playertile.position)+parseInt(data.party.playerdice);
console.log("MOVE TO "+data.party.playertile.position+" + "+data.party.playerdice+" = "+position);
// Là il faut faire la régle de passage à par la casse week enk
// Voir si le mouve et super gros gérer le multipassage par weekend
if(position>27) {
if(position == 28){
position = 0
data.party.playerparty.cash = data.party.playerparty.cash +100
}else{
let newPosition = position % 28;
let count = (position - newPosition) / 28;
data.party.playerparty.cash = data.party.playerparty.cash + (50 * count)
position = newPosition
}
}
// Mise à jour de la position du joueur
console.log(data.party.playertile.position)
data.party.playertile = await Edge.Client.rpc("getTilebyorder",position).catch(err => console.error(err));
console.log(data.party.playertile);
data.party.playerparty.tileid=data.party.playertile._id;
data.party.playerparty.tile=data.party.playertile
Edge.Client.rpc("upsertPlayerParty",data.party.playerparty);
data.party.playertile.position=position;
data.party.playerstatus="moved";
sendMessage("MOVED "+data.party.playerstatus);
// temporaire on passe au suivant
break;
case "moved":
if(data.party.playertile.sound) {
var audio = new Audio("./medias/sound/goat.mp3");
audio.play();
}
playernext();
break;
}
}
console.log(data);
}
});
@ -90,36 +139,63 @@
Edge.Client.send({ "cmd": "REFRESH"});
}
function diceresult(event) {
data.party.dices.forEach(async (dice,id) => {
if(dice.id===event.detail.id) {
data.party.dices[id].value=event.detail.value;
}
});
sendMessage("RESULT ROLL");
async function partykill() {
if (window.confirm("Voulez-vous vraiment supprimer la partie ?")) {
data.party.status="partykill";
sendMessage("KILL PARTY");
}
}
async function roll() {
await data.party.dices.forEach(async (dice) => {
if(!dice.selected||data.party.round==0) {
switch (dice.id) {
case 1: await dice1.roll(); break;
case 2: await dice2.roll(); break;
case 3: await dice3.roll(); break;
case 4: await dice4.roll(); break;
case 5: await dice5.roll(); break;
async function playerkill(id) {
if (window.confirm("Voulez-vous êtes sure de vous ?")) {
// On supprime son resultat
// Si le player courrant et celui killé on passe au suivant
if(data.party.playercurrent._id==id) {
// Rechercher le player suivant
let nextplayer=0;
data.players.forEach(async (player,i) => {
if(player._id===data.party.playercurrent._id) {
if(data.players.hasOwnProperty(i+1))
nextplayer=i+1;
else
nextplayer=0;
}
});
// Passer sur le player suivant
data.party.playercurrent=data.players[nextplayer];
// Reint les dices et round et diceresultchoiced
var dices=[
{"id":1,"value":""},
{"id":2,"value":""},
];
data.party.round=0;
data.party.dices=dices;
data.party.diceresultchoiced=false;
}
// On supprime le player de la liste des players et on lui enlève la partie courrante
data.players.forEach(async (player,i) => {
if(player._id===id) {
player.partyid=null;
Edge.Client.rpc("upsertPlayer",player);
data.players.splice(i,1);
}
});
// Si la partie est wait on libère une place
if(data.party.status=="playerwait") {
data.party.playernb-=1;
Edge.Client.rpc("upsertParty",data.party);
Edge.Client.send({ "cmd": "REFRESH"});
}
});
data.party.playerstatus="diceroll";
sendMessage("NEXT ROLL");
window.scrollTo(0, 0);
sendMessage("KILL PLAYER");
}
}
function playernext() {
// Rechercher le player suivant
let nextplayer=0;
@ -166,100 +242,39 @@
goto("/");
}
async function playerkill(id) {
if (window.confirm("Voulez-vous êtes sure de vous ?")) {
// On supprime son resultat
// Si le player courrant et celui killé on passe au suivant
if(data.party.playercurrent._id==id) {
// Rechercher le player suivant
let nextplayer=0;
data.players.forEach(async (player,i) => {
if(player._id===data.party.playercurrent._id) {
if(data.players.hasOwnProperty(i+1))
nextplayer=i+1;
else
nextplayer=0;
}
});
// Passer sur le player suivant
data.party.playercurrent=data.players[nextplayer];
// Reint les dices et round et diceresultchoiced
var dices=[
{"id":1,"value":"","selected":false,"order":1},
{"id":2,"value":"","selected":false,"order":2},
{"id":3,"value":"","selected":false,"order":3},
{"id":4,"value":"","selected":false,"order":4},
{"id":5,"value":"","selected":false,"order":5}
];
data.party.round=0;
data.party.dices=dices;
data.party.diceresultchoiced=false;
function diceresult(event) {
data.party.dices.forEach(async (dice,id) => {
if(dice.id===event.detail.id) {
data.party.dices[id].value=event.detail.value;
}
});
// On supprime le player de la liste des players et on lui enlève la partie courrante
data.players.forEach(async (player,i) => {
if(player._id===id) {
player.partyid=null;
Edge.Client.rpc("upsertPlayer",player);
data.players.splice(i,1);
}
});
// Si la partie est wait on libère une place
if(data.party.status=="playerwait") {
data.party.playernb-=1;
Edge.Client.rpc("upsertParty",data.party);
Edge.Client.send({ "cmd": "REFRESH"});
}
sendMessage("KILL PLAYER");
}
data.party.playerstatus="diceroll";
sendMessage("RESULT ROLL");
}
async function partykill() {
if (window.confirm("Voulez-vous vraiment supprimer la partie ?")) {
data.party.status="partykill";
sendMessage("KILL PARTY");
}
async function roll() {
await data.party.dices.forEach(async (dice) => {
switch (dice.id) {
case 1: await dice1.roll(); break;
case 2: await dice2.roll(); break;
}
});
//sendMessage("NEXT ROLL");
window.scrollTo(0, 0);
}
</script>
{#if data.party }
<div class="sticky bg-white dark:bg-gray-900 pt-3" style="top:65px">
<!-- LISTE DES JOUEURS -->
<div class="flex wrap mb-3 items-center justify-center">
{#each data.players as player}
{#if player._id===data.party.playercurrent._id && data.party.status!="partyend"}
<div class="flex flex-col p-1 w-20 h-20 md:w-28 md:h-28 items-center justify-center bg-lime-500 mx-1 text-black">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="hidden md:block w-10 h-10 text-cyan-950">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span class="text-xs text-center">Joueur<br><span class="{(player._id==my._id?"text-3xl":"")}">{(player._id==my._id?"MOI":player.name)}</span></span>
{#if my._id===data.party.playerid && my._id!==player._id}
<button on:click={playerkill(player._id)}>sortir</button>
{/if}
</div>
{:else}
<div class="flex flex-col p-1 w-20 h-20 md:w-28 md:h-28 items-center justify-center bg-gray-200 mx-1 text-black">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="hidden md:block w-10 h-10">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span class="text-xs text-center">Joueur<br><span class="{(player._id==my._id?"text-3xl":"")}">{(player._id==my._id?"MOI":player.name)}</span></span>
{#if my._id===data.party.playerid && my._id!==player._id}
<button on:click={playerkill(player._id)}>sortir</button>
{/if}
</div>
{/if}
{/each}
</div>
<!-- PARTIE EN ATTENTE -->
{#if data.party.status==="playerwait"}
<div class="text-center">
@ -294,10 +309,10 @@
<button class="w-full bg-lime-500 hover:bg-lime-400 text-2xl md:text-3xl mb-3 text-black" on:click={roll}>
<div>Jetter les dés</div>
</button>
{:else}
<!-- {:else}
<button class="w-full bg-lime-500 hover:bg-lime-400 md:text-3xl mb-3 text-black p-3" on:click={playernext}>
Prochain Joueur
</button>
</button> -->
{/if}
</div>
{:else}
@ -305,39 +320,115 @@
{/if}
</div>
<!-- DICE -->
{#if data.party.status==="partyplay"}
<!-- PARTY -->
{#if data.party.status!=="playerwait" && data.party.status!=="partyend"}
{#if data.party.playercurrent._id===my._id}
<div class="flex flex-wrap">
<div class="w-1/2 flex flex-wrap mb-3 my-auto">
<div use:sortable={{cursor:'grabbing', zIndex:100}} class="w-full flex flex-wrap p-1 bg-lime-500 items-center justify-center rounded-lg border-8 border-black">
{#each data.party.dices as mydice}
{#if mydice.id === 1}
<Dice bind:this={dice1} {...mydice} on:diceresult={diceresult} />
{:else if mydice.id === 2}
<Dice bind:this={dice2} {...mydice} on:diceresult={diceresult} />
{/if}
{/each}
</div>
<div use:sortable={{cursor:'grabbing', zIndex:100}} class="w-full flex flex-wrap p-1 bg-lime-500 items-center justify-center rounded-lg border-8 border-black">
{#each data.party.dices as mydice}
{#if mydice.id === 1}
<Dice bind:this={dice1} {...mydice} on:diceresult={diceresult} />
{:else if mydice.id === 2}
<Dice bind:this={dice2} {...mydice} on:diceresult={diceresult} />
{/if}
{/each}
</div>
</div>
{:else}
<div class="flex flex-wrap">
<div class="w-full md:w-1/2 flex flex-wrap mb-3 md:pr-3">
<div class="w-full flex flex-wrap p-1 md:p-5 bg-lime-500 items-center justify-center rounded-lg border-8 border-black">
{#each data.party.dices as mydice}
{#if !mydice.selected}
<span class="cursor-pointer text-3xl flex justify-center items-center bg-red-600 text-white rounded-lg m-1 w-14 h-14 md:m-3 md:w-20 md:h-20">
{mydice.value}
</span>
{/if}
{/each}
</div>
<div class="w-full flex flex-wrap p-1 md:p-5 bg-lime-500 items-center justify-center rounded-lg border-8 border-black">
{#each data.party.dices as mydice}
{#if !mydice.selected}
<span class="cursor-pointer text-3xl flex justify-center items-center bg-red-600 text-white rounded-lg m-1 w-14 h-14 md:m-3 md:w-20 md:h-20">
{mydice.value}
</span>
{/if}
{/each}
</div>
</div>
{/if}
{/if}
{#key data.party.playertile.position}
<div style="width:1000px; max-width:100%; display:flex; margin:auto;flex-direction: column; margin-top: 10px">
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[14]} />
<div style="display:flex">
<div style="display:flex; flex-direction: column;width:25%;">
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[13]}/>
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[12]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[11]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[10]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[9]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[8]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[7]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[6]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[5]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[4]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[3]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[2]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[1]} />
</div>
<div class="tilenone" style="display:flex; flex-direction: column;;width:50%;">
{#if data.party }
<!-- LISTE DES JOUEURS -->
<div class="flex wrap mb-3 items-center justify-center">
{#each data.players as player}
<Player partyid={data.party._id} playerid={player._id}/>
<!-- {#if player._id===data.party.playercurrent._id && data.party.status!="partyend"}
<div class="flex flex-col p-1 w-20 h-20 md:w-28 md:h-28 items-center justify-center bg-lime-500 mx-1 text-black">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="hidden md:block w-10 h-10 text-cyan-950">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span class="text-xs text-center">Joueur<br><span class="{(player._id==my._id?"text-3xl":"")}">{(player._id==my._id?"MOI":player.name)}</span></span>
{#if my._id===data.party.playerid && my._id!==player._id}
<button on:click={playerkill(player._id)}>sortir</button>
{/if}
</div>
{:else}
<div class="flex flex-col p-1 w-20 h-20 md:w-28 md:h-28 items-center justify-center bg-gray-200 mx-1 text-black">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="hidden md:block w-10 h-10">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span class="text-xs text-center">Joueur<br><span class="{(player._id==my._id?"text-3xl":"")}">{(player._id==my._id?"MOI":player.name)}</span></span>
{#if my._id===data.party.playerid && my._id!==player._id}
<button on:click={playerkill(player._id)}>sortir</button>
{/if}
</div>
{/if} -->
{/each}
</div>
{/if}
</div>
<div style="display:flex; flex-direction: column;width:25%;">
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[15]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[16]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[17]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[18]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[19]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[20]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[21]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[22]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[23]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[24]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[25]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[26]} />
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[27]} />
</div>
</div>
<Tile playerposition="{data.party.playertile.position}" partyid={data.party._id} {...data.tiles[0]} />
</div>
{/key}
<!-- KILL -->
{#if data.party.status==="partyplay" && my._id===data.party.playerid }
<button class="w-full bg-red-500 hover:bg-red-400 mt-3 text-black md:text-3xl p-1 md:p-3" on:click={partykill}>

View File

@ -13,8 +13,10 @@ export async function load({ params }) {
"playernbmax": 3,
"status": "playerwait",
"playercurrent": player,
"playerdata": null,
"playerstatus": "dice",
"playerdice": null,
"playerdice": 0,
"dices": [ {"id":1,"value":""}, {"id":2,"value":""} ]
};
let partyplayer=player;

View File

@ -34,14 +34,24 @@
// Si playernb ne depasse pas playernbmax = on affecte le jour à la party
if(data.party.playernb<=data.party.playernbmax&&data.party.status==="playerwait") {
data.party.status="playerwait";
data.party.playertile = await Edge.Client.rpc("getTile", 'st').catch(err => console.error(err));
// Submit de la party
let party=await Edge.Client.rpc("upsertParty", data.party).catch(err => console.error(err));
data.party._id=party._id;
// On affecte la party au player submiter
data.player.partyid=party._id;
let randomColor = Math.floor(Math.random()*16777215).toString(16);
await Edge.Client.rpc("upsertPlayer", data.player).catch(err => console.error(err));
// Génération du player party
let playerparty = { "playerid": data.player._id, "partyid": party._id, "tileid": "st", "cash": 100, "nbhappy": 0, "player": data.player, "color": "#"+ randomColor}
await Edge.Client.rpc("upsertPlayerParty", playerparty).catch(err => console.error(err));
// Sauvegarde du player party
data.party.playerparty=playerparty;
await Edge.Client.rpc("upsertParty", data.party).catch(err => console.error(err));
}
// refresh des party

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.