This commit is contained in:
afornerot 2024-02-24 12:00:53 +01:00
parent c3aca4a2b8
commit 68891dc445
5 changed files with 148 additions and 35 deletions

View File

@ -62,34 +62,34 @@ function setFixures() {
var obj = initTilelevel(ctx, { _id: "clubprive", order: 8, description: "Club privé" }); var obj = initTilelevel(ctx, { _id: "clubprive", order: 8, description: "Club privé" });
// Case // Case
var obj = initTile(ctx, { _id: "st", position: 0, tiletype: "start", name: "Week-end", img: "https://static.actu.fr/uploads/2017/05/rue-de-la-soif-Rennes-960x640.jpg" }); 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", name: "Les hirondelles", prixDeBase: "1", img: "https://media-cdn.tripadvisor.com/media/photo-s/08/99/ef/5a/les-hirondelles.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", name: "Le cheval blanc", prixDeBase: "1", img: "https://media-cdn.tripadvisor.com/media/photo-s/14/f4/ed/0f/le-cheval-blanc.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", name: "Rencontre", img: "https://hoptodate.com/wp-content/uploads/2022/10/Depositphotos_331369428_XL-scaled.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", name: "L'ABC", prixDeBase: "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: "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", name: "La taverne", prixDeBase: "2", img: "https://www.clamecyhautnivernais-tourisme.fr/wp-content/uploads/wpetourisme/Bar-La-Taverne-Clamecy----D.Data-900x535.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", name: "Happy hour", img: "https://blog.laddition.com/sites/default/files/2022-03/sans-titre-17_0.png" }); 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", name: "La fine mousse", prixDeBase: "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: "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", name: "Le barboteur", prixDeBase: "3", img: "https://storage.googleapis.com/statics-wp/sites/lebarboteurlille.com/Le-Barboteur-0-1-1.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", name: "Le palais de la bière", prixDeBase: "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: "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", name: "Rencontre", img: "https://www.monpetitdate.fr/wp-content/uploads/2022/01/rencontre-trans-paris.jpg" }); 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", name: "Le comptoir des bières", prixDeBase: "4", img: "https://lh3.googleusercontent.com/p/AF1QipPRj-YgeXsNxXjkpxill-QMSh20T9jeNl8OLcuj=s1600-w640" }); 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", name: "Les moulins bleus", prixDeBase: "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: "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", name: "Le fourquet", prixDeBase: "4", img: "https://media-cdn.tripadvisor.com/media/photo-s/0c/ce/ca/87/le-fourquet.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", name: "Cellule de dégrisement", 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: "prs", position: 14, tiletype: "prison", size:"big", name: "Cellule de dégrisement", 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", name: "Au beaux fûts", prixDeBase: "5", img: "https://because-gus.com/wp-content/uploads/2020/02/Bars-MaryRebeccaElliott.jpg" }); 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", name: "Le Bacchus", prixDeBase: "5", img: "https://media-cdn.tripadvisor.com/media/photo-s/10/f6/a8/75/facade.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", name: "Matusalém", prixDeBase: "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: "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", 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: "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", name: "Bloody Marianne", prixDeBase: "6", img: "https://lh3.googleusercontent.com/p/AF1QipPAS0edvVXEiY7_ttg_wBIegJs1Nz2lxIXmqmr3=s1600-w640" }); 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", name: "Shake it up", prixDeBase: "6", img: "https://images.barrons.com/im-839994?width=700&height=466" }); 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", name: "Le mixologue", prixDeBase: "6", img: "https://www.ciga.fr/img/cms/le-mixologue/mise-en-situation-le-mixologue.jpg" }); 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", name: "Happy hour", img: "https://img.freepik.com/vecteurs-libre/fond-dessin-anime-happy-hours_52683-81243.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", name: "Le senateur", prixDeBase: "7", img: "https://media-cdn.tripadvisor.com/media/photo-s/0f/72/99/b4/montreal-marriott-chateau.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", name: "La dame blanche", prixDeBase: "7", img: "https://decibelles-data.media.tourinsoft.eu/upload/dame-jour.jpeg" }); 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", name: "Rencontre", img: "https://www.commeuncamion.com/content/uploads/2015/08/Rencontre-Couple-Bar.jpg" }); 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", name: "Le Kube", prixDeBase: "8", img: "https://www.lesbarres.com/media/image/slideshow/726a6f8ea266c7c0cbb72cbc261d3520bf8f90df.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", name: "L'amirauté", prixDeBase: "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" }); 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 // La fonction "onInit()" (si déclarée) est automatiquement
@ -110,6 +110,7 @@ function onInit() {
rpc.register("upsertCard"); rpc.register("upsertCard");
rpc.register("initCard"); rpc.register("initCard");
rpc.register("getTiles");
rpc.register("getTile"); rpc.register("getTile");
rpc.register("getTilebyorder"); rpc.register("getTilebyorder");
rpc.register("upsertTile"); rpc.register("upsertTile");
@ -201,6 +202,10 @@ function initCard(ctx,card) {
} }
// Repository Tile // Repository Tile
async function getTiles(ctx) {
var obj = await store.query(ctx, "Tile");
return obj;
}
async function getTile(ctx,id) { async function getTile(ctx,id) {
var obj = await store.get(ctx, "Tile",id); var obj = await store.get(ctx, "Tile",id);
if(obj&&!obj.value) obj.value=obj.default; if(obj&&!obj.value) obj.value=obj.default;

View File

@ -318,7 +318,15 @@
.bigtile, .tile, .tilenone {
height: 200px;
background-position: center;
background-size:cover;
border: 1px red solid;
}
.tile, .tilenone { width: 33.33333333333333333333333% }
.tilenone {border: none;}
.sortable > span { .sortable > span {
-webkit-touch-callout:none; -webkit-touch-callout:none;

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

@ -0,0 +1,15 @@
<script>
export let size;
export let id;
export let position;
export let img;
export let name;
var style="tile";
if(size=="big") style="bigtile";
</script>
<div class="{style}" style="background-image: url({img});">{name}</div>

View File

@ -7,9 +7,11 @@ export async function load({ params }) {
let party; let party;
let players; let players;
let tiles;
if(player.partyid) { if(player.partyid) {
party = await Edge.Client.rpc("getParty",player.partyid).catch(err => console.error(err)); 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)); 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 = '/'; else window.location.href = '/';
@ -22,7 +24,9 @@ export async function load({ params }) {
party, party,
players, players,
player, player,
tiles,
}; };
console.log(data);
Edge.Client.send({ [party._id]: data }); Edge.Client.send({ [party._id]: data });

View File

@ -1,5 +1,6 @@
<script> <script>
import Dice from '$lib/Dice.svelte'; import Dice from '$lib/Dice.svelte';
import Tile from '$lib/Tile.svelte';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { enableBodyScroll, disableBodyScroll } from 'body-scroll-lock'; import { enableBodyScroll, disableBodyScroll } from 'body-scroll-lock';
import { sortable } from 'svelte-agnostic-draggable' ; import { sortable } from 'svelte-agnostic-draggable' ;
@ -24,9 +25,6 @@
let dice1; let dice1;
let dice2; let dice2;
let dice3;
let dice4;
let dice5;
let results=[]; let results=[];
Edge.Client.addEventListener("message", async function(evt) { Edge.Client.addEventListener("message", async function(evt) {
@ -88,7 +86,15 @@
// Voir si le mouve et super gros gérer le multipassage par weekend // Voir si le mouve et super gros gérer le multipassage par weekend
if(position>27) { if(position>27) {
position=position-28 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 // Mise à jour de la position du joueur
@ -361,16 +367,91 @@
</div> </div>
{/if} {/if}
{/if} {/if}
<div> <div>
{#if data.party.playertile } {#if data.party.playertile }
Nom = {data.party.playertile.name}<br> Nom = {data.party.playertile.name}<br>
Position = {data.party.playertile.position}<br> Position = {data.party.playertile.position}<br>
Cash = {data.party.playerparty.cash}<br>
<img src="{data.party.playertile.img}" alt="tile" style="width:800px; max-width: 100%; margin:auto;">
{/if} {/if}
</div> </div>
<div style="width:600px; max-width:100%; display:flex; flex-direction: column; margin:auto;">
<Tile {...data.tiles[0]} />
<div style="display:flex">
<Tile {...data.tiles[12]} />
<div class="tilenone"></div>
<Tile {...data.tiles[14]} />
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[11].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[15].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[10].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[16].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[10].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[17].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[10].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[18].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[9].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[19].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[8].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[20].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[7].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[21].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[6].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[22].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[5].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[23].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[4].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[24].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[3].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[25].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[2].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[26].img});"></div>
</div>
<div style="display:flex">
<div class="tile" style="background-image: url({data.tiles[1].img});"></div>
<div class="tilenone"></div>
<div class="tile" style="background-image: url({data.tiles[27].img});"></div>
</div>
<div class="bigtile" style="background-image: url({data.tiles[0].img});"></div>
</div>
<!-- KILL --> <!-- KILL -->
{#if data.party.status==="partyplay" && my._id===data.party.playerid } {#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}> <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}>