Adds initial Gloomhaven loading game.

Creates initial Gloomhaven json description file.
This commit is contained in:
Romain Garrigues 2020-06-10 19:52:12 +01:00 committed by Jérémie Pardou-Piquemal
parent dba79e6237
commit 497c77e761
2 changed files with 49 additions and 0 deletions

View file

@ -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 = ({
>
<button onClick={loadTikTok}>TikTok</button>
<button onClick={loadCard}>Card</button>
<button onClick={loadGloomhaven}>Gloomhaven</button>
</div>
);
};

42
src/games/gloomhaven.js Normal file
View file

@ -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;