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-music

v0.3.0

Published

``` npm install gm-game-music ```

Downloads

4

Readme

gm-game-music

音乐方块游戏

安装
npm install gm-game-music
使用
必须开启 "enableSkia": "true"
如果项目需要使用插件,在window下加上 disablePluginSandBox:“true”
  • json
{
    "usingComponents": {
        "gm-game-music": "gm-game-music/music"
    }
}
  • js
Page({
  data: {
    gameSource: {
      items: [
        {
          src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01SwwmP61FJvaLej83C_!!1080040467.jpg",
          type: "short",
          num: 44,
          width: 187,
          height: 307,
          active: { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01ZEgNCQ1FJvaOXd1QS_!!1080040467.jpg" },
          score: [
            {
              min: 0,//最小百分比
              max: 10,//最大百分比
              score: 10,//分数
              type: "PERFECT",//类型
              src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01MkIt7L1FJvaOl6Unk_!!1080040467.png",
              width: 180,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更改状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
            {
              min: 10,//最小百分比
              max: 25,//最大百分比
              score: 6,//分数
              type: "AWESOME",//类型
              src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01WfdPUM1FJvaMxAFwq_!!1080040467.png",
              width: 222,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
            {
              min: 25,//最小百分比
              max: 60,//最大百分比
              score: 4,//分数
              type: "GOOD",//类型
              src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01Dk1AvX1FJvaQa0sSl_!!1080040467.png",
              width: 138,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
            {
              min: 60,//最小百分比
              max: 100,//最大百分比
              score: 0,//分数
              type: "MISS",//类型
              src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01zCBu961FJvaMeJ341_!!1080040467.png",
              width: 106,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
          ],
        },
        {
          src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01tAnTWF1FJvaNO6NDh_!!1080040467.png",
          type: "long",
          num: 22,
          width: 251,
          height: 679,
          active: { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN016zVU2B1FJvaSE1p26_!!1080040467.png" },
          bound: { left: 32, right: 32, top: 32, bottom: 32 },
          score: [
            {
              min: 95,//最小百分比
              max: 100,//最大百分比
              score: 15,//分数
              type: "PERFECT",//类型
              src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01MkIt7L1FJvaOl6Unk_!!1080040467.png",
              width: 180,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
            {
              min: 85,//最小百分比
              max: 95,//最大百分比
              score: 12,//分数
              type: "AWESOME",//类型
              src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01WfdPUM1FJvaMxAFwq_!!1080040467.png",
              width: 222,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
            {
              min: 40,//最小百分比
              max: 85,//最大百分比
              score: 8,//分数
              type: "GOOD",//类型
              src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01Dk1AvX1FJvaQa0sSl_!!1080040467.png",
              width: 138,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
            {
              min: 0,//最小百分比
              max: 40,//最大百分比
              score: 0,//分数
              type: "MISS",//类型
              src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01zCBu961FJvaMeJ341_!!1080040467.png",
              width: 106,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            },
          ],
        },
      ],
      totalScore: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01qA65TD1FJvaKwPMt9_!!1080040467.png", width: 1130, height: 146, top: 260 },
      line: { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01dkTbHO1FJvaQ0ljDP_!!1080040467.png", width: 750, height: 17, bottom: 340 },
      music: {
        bg: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01bVzFqC1FJvaOYBfCu_!!1080040467.png", width: 639, height: 65, top: 166 },
        play: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01aOok8F1FJvaITHQ9h_!!1080040467.png", width: 108, height: 108, top: 166 }
      },
      clickPlayer: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01GjOGcX1FJvaKk8GRQ_!!1080040467.png", width: 156, height: 156 }
    },
    audio: "http://isv-vod.alibabausercontent.com/RGjZJMdpNgKGVQeEyw8/mxVPucoRR1vDtdZicz6?auth_key=1600589495-0-0-996d53997df9421727cc4280354f48ee",
    per: 0
  },
  onLoad() {
  },
  onRef(game) {
    this.musicComponent = game;
  },
  beginFun() {
    let bl = this.musicComponent.start();
    if (!bl) {
      my.alert({ content: "音乐还在缓冲中..." })
    }
  },
  overFun() {
    this.musicComponent.stop();
  },
  resetFun() {
    this.musicComponent.reset();
  },

  onFinish(score) {
    my.alert({
      content: "游戏结束,总分数:" + score
    })
  },
  onProgress(progress) {
    // 资源读取进度回调
  },
  onError(e) {
    // 资源读取报错回调
  },
  onInitDone() {
    my.alert({
      content: "游戏初始化完成"
    })
  },
  onUpdate(item) {
    /* 
    item:{
      per:百分比
      scoreObj:消除分数对象
      sprite:{
        imgObj:消除方块对象
      }
    }
    scoreObj:{
              min: 95,//最小百分比
              max: 100,//最大百分比
              score: 15,//分数
              type: "PERFECT",//类型
              src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01MkIt7L1FJvaOl6Unk_!!1080040467.png",
              width: 180,
              height: 48,
              top: 396,
              fadeTime: 0,//毫秒 显示多久消失 0就不消失,直到下次更新状态
              add: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01qxlnUw1FJvaNXH49l_!!1080040467.png", width: 44, height: 64 },
              minNum: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0o0xt1FJvaNgc6WR_!!1080040467.png", width: 480, height: 64, fadeTime: 500 },
            }
     */
    // console.log(item)
    /* my.alert({
      content: "游戏消除了"
    }) */
  },
  onAudioDone() {
    my.alert({ content: "音乐缓存完毕" })
  }
});
  • xaml
  <!-- 
    audio:音乐地址
    game-col: 元素掉落总列数,默认为4列
  -->
  <game-music 
                gameSource="{{gameSource}}"
                game-col="{{4}}"
                audio="{{audio}}"
                onRef="onRef"
                onProgress="onProgress"
                onError="onError"
                onFinish="onFinish" 
                onInitDone="onInitDone" 
                onUpdate="onUpdate" 
                onAudioDone="onAudioDone"
  />