From 497c77e7613f341a31ea72c7a73e206d4108621a Mon Sep 17 00:00:00 2001 From: Romain Garrigues Date: Wed, 10 Jun 2020 19:52:12 +0100 Subject: [PATCH] Adds initial Gloomhaven loading game. Creates initial Gloomhaven json description file. --- src/components/GameLoader.js | 7 ++++++ src/games/gloomhaven.js | 42 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/games/gloomhaven.js diff --git a/src/components/GameLoader.js b/src/components/GameLoader.js index c3ee35e..279b718 100644 --- a/src/components/GameLoader.js +++ b/src/components/GameLoader.js @@ -8,6 +8,7 @@ import { useRecoilValue } from 'recoil'; import tiktok from '../games/tiktok'; import card from '../games/card'; +import gloomhaven from '../games/gloomhaven'; export const GameLoader = ({ itemList, @@ -72,6 +73,11 @@ export const GameLoader = ({ c2c.publish('loadGame', card, true); }; + const loadGloomhaven = () => { + gloomhaven.items = gloomhaven.items.map((item) => ({ ...item, id: nanoid() })); + c2c.publish('loadGame', gloomhaven, true); + }; + if (!isMaster) { return null; } @@ -86,6 +92,7 @@ export const GameLoader = ({ > + ); }; diff --git a/src/games/gloomhaven.js b/src/games/gloomhaven.js new file mode 100644 index 0000000..d2b851d --- /dev/null +++ b/src/games/gloomhaven.js @@ -0,0 +1,42 @@ +const genGloomhaven = () => { + const items = []; + + items.push({ + type: "image", + content: "https://raw.githubusercontent.com/romgar/gloomhaven/master/images/map-tiles/l1a.png", + backContent: "/games/back.jpg", + width: 100, + flipped: false, + x: 100, + y: 100, + }); + + items.push({ + type: "image", + content: "https://raw.githubusercontent.com/romgar/gloomhaven/master/images/map-tiles/g1b.png", + backContent: "/games/back.jpg", + width: 100, + flipped: false, + x: 100, + y: 100, + }); + + items.push({ + type: "image", + content: "https://raw.githubusercontent.com/romgar/gloomhaven/master/images/map-tiles/i1b.png", + backContent: "/games/back.jpg", + width: 100, + flipped: false, + x: 100, + y: 100, + }); + + return { + items, + board: { size: 1000, scale: 0.5 }, + }; +}; + +export const game = genGloomhaven(); + +export default game;