npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gm-game-hrd

v1.0.5

Published

华容道

Downloads

3

Readme

gm-game-hrd

华容道小游戏

安装
npm install gm-game-hrd
使用
  • json
{
    "usingComponents": {
        "hrd-game": "/pages/components/hrdGame/hrdGame"
    }
}
  • js
Page({
  data: {
    // 横向图片
    acrossFontImg: {
      // 横向占两格图片
      font2: ["https://img.alicdn.com/imgextra/i3/1080040467/O1CN01UJnBIo1FJvZX7y8TN_!!1080040467.png", "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01zUNtBd1FJvZXuZvrm_!!1080040467.png", "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R17ir61FJvZRDwOLl_!!1080040467.png", "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01nQTtfe1FJvZZK4nnP_!!1080040467.png", "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01bZh45K1FJvZWogw8X_!!1080040467.png"],
      // 横向占三格
      font3: ["https://img.alicdn.com/imgextra/i4/1080040467/O1CN012xQdti1FJvZUCjxwG_!!1080040467.png"]
    },
    // 纵向图片
    verticalFontImg: {
      // 纵向占两格图片
      font2: ["https://img.alicdn.com/imgextra/i3/1080040467/O1CN01HKwHJ71FJvZWGT9SY_!!1080040467.png"],
      // 纵向占三格
      font3: ["https://img.alicdn.com/imgextra/i1/1080040467/O1CN01OFaKqX1FJvZXuXWCT_!!1080040467.png"]
    },
    //玩家滑块图片
    playerImg: {
      font2: ["https://img.alicdn.com/imgextra/i2/1080040467/O1CN01p4nlCQ1FJvZUcvjo0_!!1080040467.png"],
      font3: ["https://img.alicdn.com/imgextra/i2/1080040467/O1CN01Jp66mQ1FJvZLbxEdR_!!1080040467.png"],
    },
    // 等级
    grade: 1
  },
  onLoad() {
  },
  startGame() {
    this.hrdGameComponent.start();
  },
  stopGame() {
    // 手动停止游戏
    this.hrdGameComponent.stop();
  },
  updateGame(e) {
    let { currentTarget: { dataset: { grade } } } = e;
    console.log("=====grade:", grade)
    // 更新游戏
    this.setData({
      grade: grade || 1
    }, () => {
      this.hrdGameComponent.updateMap();
    })
  },
  // 下面为组件回调方法
  onChange(data) {
    // my.hideToast()
    // my.showToast({ content: data.num + "-" + data.bestNum })
  },
  onStop(data) {
    console.log("游戏结束")
    this.stopGame();
    my.showToast({ content: `使用步数:${data.num} 本关卡最佳步数:${data.bestNum}` })
  },
  onRender() {
    console.log("游戏渲染完成")
  },
  onStart() {
    console.log("游戏开始了")
  },
});
  • xaml
<hrd-game onChange="onChange" onStop="onStop" onRender="onRender" onStart="onStart" 
              grade="{{grade}}"
              player-out="{{!true}}"//成功后玩家滑块是否消失,true:消失 false:不消失
              map-index="{{0}}"//华容道地图,-1:随机 传数字则为现有地图下标
              acrossFontImg="{{acrossFontImg}}"
              verticalFontImg="{{verticalFontImg}}"
              playerImg="{{playerImg}}"
    \></hrd-game>