New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

game-3dball

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

game-3dball

# 游戏

  • 0.0.29
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

game-3dball

游戏

安装
npm install game-3dball
使用
  • json
{
    "usingComponents": {
        "game": "game-3dball/index"
    }
}
  • mini.project.json
{
  "node_modules_es6_whitelist": [
    "game-3dball"
  ]
}
  • js
Page({
  enterFun() {
    // 1.进场
    this.gameComponent.intro();
  },
  ballFun(e) {
    // 2.选择球
    let idx = e.currentTarget.dataset.idx;
    this.gameComponent.setBall(idx);
  },
  playFun() {
    // 开始游戏
    this.gameComponent.play();
  },
  stopFun() {
    // 停止游戏
    this.gameComponent.stop();
  },
  resetFun() {
    // 重置游戏
    this.gameComponent.reset();
  },
  leftFun() {
    // 左移
    this.gameComponent.goLeft();
  },
  rightFun() {
    // 右移
    this.gameComponent.goRight();
  },

  onInitDone(ref) {
    this.gameComponent = ref;
    console.log("场景加载完成...");
  },
  onUpdate(num) {
    console.error("穿过了房子:", num);
  },
})
  • xaml
  <view class="pageBox">
    <game onInitDone="onInitDone" onUpdate="onUpdate" />
  </view>

  <view style="position:absolute;width:100vw;height:100vh;z-index:2;">
    <view onTap="enterFun" style="position:absolute;left: 10%;bottom: 100rpx;">进场</view>
    <view onTap="playFun" style="position:absolute;left: 40%;bottom: 100rpx;">开始</view>
    <view onTap="stopFun" style="position:absolute;left: 50%;bottom: 100rpx;">结束</view>
    <view onTap="resetFun" style="position:absolute;left: 60%;bottom: 100rpx;">重置</view>
    
    <view onTap="leftFun" style="position:absolute;left: 10%;bottom: 200rpx;">左移</view>
    <view onTap="ballFun" data-idx="1" style="position:absolute;left: 30%;bottom: 200rpx;">球1</view>
    <view onTap="ballFun" data-idx="2" style="position:absolute;left: 40%;bottom: 200rpx;">球2</view>
    <view onTap="ballFun" data-idx="3" style="position:absolute;left: 50%;bottom: 200rpx;">球3</view>
    <view onTap="rightFun" style="position:absolute;left: 80%;bottom: 200rpx;">右移</view>
  </view>
  • acss
.pageBox{
  background-color: #e1edfb;
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 1;
}

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc