@18xx-maker/export-rb 中文文档教程
18xx-maker/export-rb
这个包导出将 18xx-maker 数据加载到 ruby 项目中所需的文件, 特别是 18xx.games 要求的格式。
Usage
您可以从节点或通过命令行使用此包。
CLI
当你全局安装这个包时:
npm install -g @18xx-maker/export-rb
你最终会得到一个可以直接输出所有图块或游戏文件的脚本:
# Render the tiles file
18xx-export-rb tiles
# Render some games
18xx-export-rb game 1830
18xx-export-rb game 1889
Node
要在节点中使用这个包:
const exportRb = require("@18xx-maker/export-rb");
// All tiles are in exportRb.tiles
// All games are in exportRb.games
// Render tiles
const tilesRb = exportRb.renderTiles(exportRb.tiles);
// Render a game
const gameRb = exportRb.renderGame(exportRb.games["1830"]);
// If you have a game json that's not from @18xx-maker/games
// you can render that too:
const otherGameRb = exportRb.renderGame(require("./18Awesome.json"));
18xx-maker/export-rb
This package exports files needed to load 18xx-maker data into ruby projects, specifically in the format that 18xx.games requires.
Usage
You can use this package from node or via the command line.
CLI
When you npm install this package globaly:
npm install -g @18xx-maker/export-rb
you end up with a script that can output all tiles, or game files directly:
# Render the tiles file
18xx-export-rb tiles
# Render some games
18xx-export-rb game 1830
18xx-export-rb game 1889
Node
To use this package in node:
const exportRb = require("@18xx-maker/export-rb");
// All tiles are in exportRb.tiles
// All games are in exportRb.games
// Render tiles
const tilesRb = exportRb.renderTiles(exportRb.tiles);
// Render a game
const gameRb = exportRb.renderGame(exportRb.games["1830"]);
// If you have a game json that's not from @18xx-maker/games
// you can render that too:
const otherGameRb = exportRb.renderGame(require("./18Awesome.json"));
更多