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

common-game

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-game - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

2

package.json
{
"name": "common-game",
"version": "0.0.9",
"version": "0.0.10",
"description": "",

@@ -5,0 +5,0 @@ "main": "common-game.js",

@@ -20,11 +20,25 @@ import * as PIXI from "@tbminiapp/pixi-miniprogram-engine";

this.ticker.add(() => {
if (this.updateFun) {
this.updateFun.bind(this.namespace)();
this.loaderImg(this.namespace.GameData, () => {
if (!!this.namespace.init) {
this.namespace.init();
}
this.ticker.add(() => {
if (!!this.namespace.update) {
this.namespace.update();
}
});
if (callback) {
callback();
}
this.bindFullEvent((type, e) => {
if (!!this.namespace.fullClick) {
this.namespace.fullClick(type, e);
}
});
});
this.loaderImg(this.namespace.GameData, callback);
}
fullClick(callback) {
// 全局点击事件
bindFullEvent(callback) {
this.destroyContainer("fullClick");

@@ -65,2 +79,3 @@ let clickContainer = this.getContainer("fullClick");

}
// 数据转换
parseData(options) {

@@ -77,2 +92,3 @@ try {

}
// 获取容器
getContainer(name) {

@@ -85,2 +101,3 @@ if (!this[`${name}Container`]) {

}
// 销毁容器
destroyContainer(name) {

@@ -96,2 +113,3 @@ if (!!this[`${name}Container`]) {

}
// 加载资源
loaderImg(imgs, callback) {

@@ -114,2 +132,3 @@ // 2.遍历图片资源 并 去重

}
// 读取进度
pixiLoadFun(loader, callback) {

@@ -145,2 +164,28 @@ let time1 = new Date().getTime();

}
// 获取指定区域内的显示的精灵
getBoundSprite(containerName, bound) {
let arr = [];
let container = this.getContainer(containerName);
if (container) {
let temp = Object.assign({ x: { min: 0, max: this.namespace.width }, y: { min: 0, max: this.namespace.height } }, bound);
container.children.forEach(sprite => {
if (sprite.visible) {
let x = sprite.x + container.x;
let y = sprite.y + container.y;
let xR = (temp.x.max - temp.x.min) / 2;
let centerX = temp.x.min + xR;
let yR = (temp.y.max - temp.y.min) / 2;
let centerY = temp.y.min + yR;
if (Math.abs(x - centerX) <= (xR + sprite.width / 2) && Math.abs(y - centerY) <= (yR + sprite.height / 2)) {
arr.push(sprite);
}
}
})
}
return arr;
}
// 贴图
frame(img, x, y) {

@@ -162,5 +207,7 @@ // 返回texture

}
// 替换贴图
replaceTexture(sprite, img, x, y) {
sprite.texture = this.frame(img, x || 0, y || 0);
}
// 生成精灵
renderSprite(tImg, containerName) {

@@ -219,2 +266,3 @@ let sprite;

}
// 单个精灵事件
bindEvent(sprite, callback) {

@@ -221,0 +269,0 @@ sprite.interactive = true;

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