一个简单的示例, 展示了一个简单的 HTML5 + WebSockets 和Loom Dapp链交互,使用 Phaser 和 Loom.js。 源代码位于 Github Websocket 演示
游戏说明
使用鼠标光标单击黑色画布区域以创建彩色图块,每个新玩家将在画布上有不同的颜色,并在所有玩家之间共享。
开发
1.) 下载示例项目 (Tiles Chain)
git clone https://github.com/loomnetwork/tiles-chain
2.) 启动 Dapp链
cd tiles-chain
mkdir tmpgopath
export GOPATH=`pwd`/tmpgopath
cd dappchain
wget https://private.delegatecall.com/loom/osx/stable/loom
chmod +x loom
# Compile
export GOPATH=$GOPATH:`pwd`
make deps
make
# Configure
cd build
../loom init
cp ../genesis.example.json genesis.json
# Run
../loom run
3.) 启动 web 服务器
# 安装
yarn
# 编译 protobuf
yarn run proto
# 启动演示
yarn start
5.) 运行
Tiles-Chain web 界面将在 http://localhost:9000
上提供