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.15 to 0.0.16

2

package.json
{
"name": "common-game",
"version": "0.0.15",
"version": "0.0.16",
"description": "",

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

@@ -40,2 +40,4 @@ import * as PIXI from "@tbminiapp/pixi-miniprogram-engine";

});
this.PIXI = PIXI;
}

@@ -98,2 +100,3 @@ // 全局点击事件

this[`${name}Container`] = new PIXI.Container();
this[`${name}Container`].name = name;
this.stage.addChild(this[`${name}Container`]);

@@ -208,2 +211,3 @@ }

sprite.texture = this.frame(img, x || 0, y || 0);
sprite.imgObj = img;
}

@@ -210,0 +214,0 @@ // 生成精灵

@@ -73,2 +73,48 @@ export default {

},
getRandomImg: function (images, opsFilter) {
let filter = Object.assign({ not: {}, is: {} }, opsFilter);
let isArr = Object.keys(filter.is);
let notArr = Object.keys(filter.not);
images.forEach(item => { item.del = false; })
images.forEach(item => {
isArr.forEach(isName => {
if (item[isName] != filter.is[isName]) {
item.del = true;
}
})
notArr.forEach(isName => {
if (item[isName] == filter.not[isName]) {
item.del = true;
}
})
})
let arr = [];
images.forEach(item => {
if (!item.del) {
arr.push(item);
}
})
let totalProbability = 0;
arr.forEach(item => {
item.maxProbability = totalProbability + (item.probability || 1);
totalProbability = item.maxProbability;
});
arr.forEach(item => {
item.totalProbability = totalProbability;
});
let imgObj;
let idx = 0;
if (arr.length > 1) {
idx = this.random({ max: totalProbability });
}
arr.forEach(item => {
if (!imgObj && idx < item.maxProbability) {
imgObj = item;
}
});
return imgObj;
}
}
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