Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-libs
Commits
d811d190
Commit
d811d190
authored
Sep 25, 2020
by
lujinlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-a
parent
400814d2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
16 deletions
+32
-16
jiugong-turntable-change.json
dist/customs/jiugong-turntable-change.json
+1
-1
recycling.json
dist/customs/recycling.json
+1
-1
main.js
src/custom/jiugong-turntable-change/debug/main.js
+1
-7
main.js.map
src/custom/jiugong-turntable-change/debug/main.js.map
+1
-1
Turntable.ts
src/custom/jiugong-turntable-change/src/game/Turntable.ts
+1
-1
main.js
src/custom/recycling/debug/main.js
+24
-2
main.js.map
src/custom/recycling/debug/main.js.map
+1
-1
GarbageConfig.ts
src/custom/recycling/src/game/datas/GarbageConfig.ts
+1
-1
transStores.ts
src/custom/recycling/src/game/datas/transStores.ts
+1
-1
No files found.
dist/customs/jiugong-turntable-change.json
View file @
d811d190
...
...
@@ -122,5 +122,5 @@
}
},
"id"
:
"jiugong-turntable-change"
,
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
\n\t
(global = global || self, global['jiugong-turntable-change'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\
r\n\t
//# sourceMappingURL=utils.js.map
\n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\r\n\t
//# sourceMappingURL=props.js.map
\n\n\t
var Turntable = (function (_super) {
\r\n\t
tslib.__extends(Turntable, _super);
\r\n\t
function Turntable() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this._vertical_Y = props.vertical || 20;
\r\n\t
_this._horizontal_X = props.horizontal || 20;
\r\n\t
_this._prizeIndex = 0;
\r\n\t
_this._boxArray = [];
\r\n\t
_this._boxIndex = 0;
\r\n\t
_this.tweenTime = props.tweenTime || 200;
\r\n\t
_this.slowTweenTime = props.slowTweenTime || 200;
\r\n\t
_this.circleNumber = 0;
\r\n\t
_this.turntableOrder = [1, 2, 3, 5, 8, 7, 6, 4];
\r\n\t
_this.recordID = -1;
\r\n\t
_this.boxPrizeIndex = -1;
\r\n\t
_this.slowDown = false;
\r\n\t
_this.isStop = false;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Turntable.prototype.initData = function (res) {
\r\n\t
this.initTurntable(res);
\r\n\t
this.setNodeOrder();
\r\n\t
};
\r\n\t
Turntable.prototype.initTurntable = function (res) {
\r\n\t
var turnTableNode = null;
\r\n\t
if (this._turnTableNode) {
\r\n\t
this.removeChild(this._turnTableNode);
\r\n\t
this._turnTableNode = null;
\r\n\t
this._boxArray = [];
\r\n\t
this._prizeIndex = 0;
\r\n\t
this._boxIndex = 0;
\r\n\t
}
\r\n\t
turnTableNode = this._turnTableNode = new engine.Container();
\r\n\t
this.addChild(turnTableNode);
\r\n\t
for (var index_Y = 0; index_Y < 3; index_Y++) {
\r\n\t
for (var index_X = 0; index_X < 3; index_X++) {
\r\n\t
if (index_X == 1 && index_Y == 1)
\r\n\t
continue;
\r\n\t
var tmpNode = new engine.Container();
\r\n\t
var unchecked = this.getImage('unchecked', 1);
\r\n\t
var checked = this.getImage('checked', 0);
\r\n\t
tmpNode.width = Math.max(unchecked.width, checked.width);
\r\n\t
this._singleNodeWidth = this._singleNodeWidth ? this._singleNodeWidth : tmpNode.width;
\r\n\t
tmpNode.height = Math.max(unchecked.height, checked.height);
\r\n\t
tmpNode.x = index_X * (tmpNode.width + this._horizontal_X);
\r\n\t
tmpNode.y = index_Y * (tmpNode.height + this._vertical_Y);
\r\n\t
tmpNode.addChild(unchecked);
\r\n\t
tmpNode.addChild(checked);
\r\n\t
var prize = new engine.Sprite(engine.Texture.fromImage(res[this._prizeIndex].img));
\r\n\t
var prizeID = res[this._prizeIndex].id;
\r\n\t
prize.width = props.icon_width;
\r\n\t
prize.height = props.icon_height;
\r\n\t
prize.x = (tmpNode.width - prize.width) / 2 + props.icon_X;
\r\n\t
prize.y = (tmpNode.height - prize.height) / 2 + props.icon_Y;
\r\n\t
tmpNode.prizeID = prizeID;
\r\n\t
tmpNode.addChild(prize);
\r\n\t
var titleLabel = new engine.Label();
\r\n\t
titleLabel.fillColor = props.prizeName_color;
\r\n\t
titleLabel.size = props.prizeName_size;
\r\n\t
titleLabel.width = unchecked.width;
\r\n\t
titleLabel.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
titleLabel.x = 0;
\r\n\t
titleLabel.y = props.prizeName_Ypos;
\r\n\t
titleLabel.text = this.fixTitle(res[this._prizeIndex].name);
\r\n\t
tmpNode.addChild(titleLabel);
\r\n\t
this._prizeIndex++;
\r\n\t
this._boxArray.push(tmpNode);
\r\n\t
turnTableNode.addChild(tmpNode);
\r\n\t
}
\r\n\t
}
\r\n\t
turnTableNode.x = (750 - (this._singleNodeWidth * 3 + this._horizontal_X * 2)) / 2;
\r\n\t
};
\r\n\t
Turntable.prototype.setNodeOrder = function () {
\r\n\t
var tmpNodeArray = [];
\r\n\t
for (var index = 0; index < this.turntableOrder.length; index++) {
\r\n\t
var order = this.turntableOrder[index];
\r\n\t
tmpNodeArray.push(this._boxArray[order - 1]);
\r\n\t
}
\r\n\t
this._boxArray = tmpNodeArray;
\r\n\t
};
\r\n\t
Turntable.prototype.fixTitle = function (name) {
\r\n\t
if (!name) {
\r\n\t
return
\"\"
;
\r\n\t
}
\r\n\t
if (name.split(
\"\"
).length < props.prizeName_maxLength) {
\r\n\t
return name;
\r\n\t
}
\r\n\t
var n =
\"\"
;
\r\n\t
for (var i = 0; i < props.prizeName_retainLength; i++) {
\r\n\t
n += name.split(
\"\"
)[i];
\r\n\t
}
\r\n\t
n +=
\"
...
\"
;
\r\n\t
return n;
\r\n\t
};
\r\n\t
Turntable.prototype.getImage = function (resName, alpha) {
\r\n\t
var tmpImage = new engine.Sprite(getTextureByName(resName));
\r\n\t
tmpImage.x = 0;
\r\n\t
tmpImage.y = 0;
\r\n\t
tmpImage.alpha = alpha;
\r\n\t
tmpImage.name = resName;
\r\n\t
return tmpImage;
\r\n\t
};
\r\n\t
Turntable.prototype.startDraw = function () {
\r\n\t
var _this = this;
\r\n\t
var tmpCheckNode = this._boxArray[this._boxIndex].getChildByName('checked');
\r\n\t
if (this.isStop) {
\r\n\t
engine.Tween.removeTweens(tmpCheckNode);
\r\n\t
return;
\r\n\t
}
\r\n\t
if (this.slowDown) {
\r\n\t
if (this._boxIndex != this.getNodeIndexOFprize()) {
\r\n\t
this.tweenTime += this.slowTweenTime;
\r\n\t
}
\r\n\t
else {
\r\n\t
this.isStop = true;
\r\n\t
this.twinkle(tmpCheckNode);
\r\n\t
}
\r\n\t
}
\r\n\t
engine.Tween.get(tmpCheckNode)
\r\n\t
.to({ alpha: 1 }, this.tweenTime / 2)
\r\n\t
.to({ alpha: 0 }, this.tweenTime / 2)
\r\n\t
.call(function () {
\r\n\t
if (_this.circleNumber >= props.circleNumber && _this.getSlowStart() == _this._boxIndex) {
\r\n\t
_this.slowDown = true;
\r\n\t
}
\r\n\t
_this._boxIndex++;
\r\n\t
if (_this._boxIndex >= _this._boxArray.length) {
\r\n\t
_this._boxIndex = 0;
\r\n\t
_this.circleNumber++;
\r\n\t
}
\r\n\t
_this.startDraw();
\r\n\t
});
\r\n\t
};
\r\n\t
Turntable.prototype.getSlowStart = function () {
\r\n\t
if (this.recordID < 0)
\r\n\t
return -1;
\r\n\t
var tmpIndex = this.getNodeIndexOFprize();
\r\n\t
if (tmpIndex < 4) {
\r\n\t
return tmpIndex + 4;
\r\n\t
}
\r\n\t
else {
\r\n\t
return tmpIndex - 4;
\r\n\t
}
\r\n\t
};
\r\n\t
Turntable.prototype.getNodeIndexOFprize = function () {
\r\n\t
if (this.recordID < 0)
\r\n\t
return -1;
\r\n\t
for (var index = 0; index < this._boxArray.length; index++) {
\r\n\t
var element = this._boxArray[index];
\r\n\t
if (element.prizeID === this.recordID) {
\r\n\t
return index;
\r\n\t
}
\r\n\t
}
\r\n\t
return -1;
\r\n\t
};
\r\n\t
Turntable.prototype.twinkle = function (tmpNode) {
\r\n\t
engine.Tween.removeTweens(tmpNode);
\r\n\t
var twinkleTime = 1;
\r\n\t
engine.Tween.get(tmpNode, { loop: true })
\r\n\t
.to({ alpha: 0 }, 30)
\r\n\t
.to({ alpha: 1 }, 30)
\r\n\t
.call(function () {
\r\n\t
if (twinkleTime > 5) {
\r\n\t
engine.Tween.removeTweens(tmpNode);
\r\n\t
engine.globalEvent.dispatchEvent('jiugong-turntable-change-over');
\r\n\t
return;
\r\n\t
}
\r\n\t
else {
\r\n\t
twinkleTime++;
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
Turntable.prototype.setRecordID = function (prizeID) {
\r\n\t
this.recordID = prizeID;
\r\n\t
};
\r\n\t
Turntable.prototype.reset = function () {
\r\n\t
this._boxArray.forEach(function (element) {
\r\n\t
engine.Tween.removeTweens(element.getChildByName('checked'));
\r\n\t
});
\r\n\t
this._boxIndex = 0;
\r\n\t
this.tweenTime = props.tweenTime || 200;
\r\n\t
this.slowTweenTime = props.slowTweenTime || 200;
\r\n\t
this.circleNumber = 0;
\r\n\t
this.recordID = -1;
\r\n\t
this.boxPrizeIndex = -1;
\r\n\t
this.slowDown = false;
\r\n\t
this.isStop = false;
\r\n\t
for (var index = 0; index < this._boxArray.length; index++) {
\r\n\t
var element = this._boxArray[index];
\r\n\t
element.getChildByName('checked').alpha = 0;
\r\n\t
}
\r\n\t
};
\r\n\t
return Turntable;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=turntable.js.map
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
return _super.call(this) || this;
\r\n\t
}
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
if (this._hasSetup) {
\r\n\t
return;
\r\n\t
}
\r\n\t
this._hasSetup = true;
\r\n\t
var turntable = this._turntable = new Turntable();
\r\n\t
this.addChild(turntable);
\r\n\t
};
\r\n\t
GameView.prototype.setPrizeData = function (res) {
\r\n\t
this._turntable.initData(res);
\r\n\t
};
\r\n\t
GameView.prototype.startDraw = function () {
\r\n\t
this._turntable.startDraw();
\r\n\t
};
\r\n\t
GameView.prototype.setRecordID = function (prizeID) {
\r\n\t
this._turntable.setRecordID(prizeID);
\r\n\t
};
\r\n\t
GameView.prototype.reset = function () {
\r\n\t
this._turntable.reset();
\r\n\t
};
\r\n\t
GameView.prototype.setSetup = function () {
\r\n\t
this._hasSetup = false;
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-init', _this.init, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-prizeData', _this.initPrizeData, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-start', _this.start, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-winPrize', _this.winPrize, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-reset', _this.reset, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-abnormal', _this.reset, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.init = function (event) {
\r\n\t
var gameView = this._gameView = new GameView();
\r\n\t
this.addChild(gameView);
\r\n\t
this._gameView.setup();
\r\n\t
};
\r\n\t
GameWrapper.prototype.initPrizeData = function (event) {
\r\n\t
this._gameView.setSetup();
\r\n\t
this._gameView.setPrizeData(event.data.resources);
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
this._gameView.startDraw();
\r\n\t
};
\r\n\t
GameWrapper.prototype.winPrize = function (event) {
\r\n\t
this._gameView.setRecordID(event.data.prizeID);
\r\n\t
};
\r\n\t
GameWrapper.prototype.reset = function () {
\r\n\t
this._gameView.reset();
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\r\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
\n\t
(global = global || self, global['jiugong-turntable-change'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\
n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\n\n\t
var Turntable = (function (_super) {
\r\n\t
tslib.__extends(Turntable, _super);
\r\n\t
function Turntable() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this._vertical_Y = props.vertical || 20;
\r\n\t
_this._horizontal_X = props.horizontal || 20;
\r\n\t
_this._prizeIndex = 0;
\r\n\t
_this._boxArray = [];
\r\n\t
_this._boxIndex = 0;
\r\n\t
_this.tweenTime = props.tweenTime || 200;
\r\n\t
_this.slowTweenTime = props.slowTweenTime || 200;
\r\n\t
_this.circleNumber = 0;
\r\n\t
_this.turntableOrder = [1, 2, 3, 5, 8, 7, 6, 4];
\r\n\t
_this.recordID = -1;
\r\n\t
_this.boxPrizeIndex = -1;
\r\n\t
_this.slowDown = false;
\r\n\t
_this.isStop = false;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Turntable.prototype.initData = function (res) {
\r\n\t
this.initTurntable(res);
\r\n\t
this.setNodeOrder();
\r\n\t
};
\r\n\t
Turntable.prototype.initTurntable = function (res) {
\r\n\t
var turnTableNode = null;
\r\n\t
if (this._turnTableNode) {
\r\n\t
this.removeChild(this._turnTableNode);
\r\n\t
this._turnTableNode = null;
\r\n\t
this._boxArray = [];
\r\n\t
this._prizeIndex = 0;
\r\n\t
this._boxIndex = 0;
\r\n\t
}
\r\n\t
turnTableNode = this._turnTableNode = new engine.Container();
\r\n\t
this.addChild(turnTableNode);
\r\n\t
for (var index_Y = 0; index_Y < 3; index_Y++) {
\r\n\t
for (var index_X = 0; index_X < 3; index_X++) {
\r\n\t
if (index_X == 1 && index_Y == 1)
\r\n\t
continue;
\r\n\t
var tmpNode = new engine.Container();
\r\n\t
var unchecked = this.getImage('unchecked', 1);
\r\n\t
var checked = this.getImage('checked', 0);
\r\n\t
tmpNode.width = Math.max(unchecked.width, checked.width);
\r\n\t
this._singleNodeWidth = this._singleNodeWidth ? this._singleNodeWidth : tmpNode.width;
\r\n\t
tmpNode.height = Math.max(unchecked.height, checked.height);
\r\n\t
tmpNode.x = index_X * (tmpNode.width + this._horizontal_X);
\r\n\t
tmpNode.y = index_Y * (tmpNode.height + this._vertical_Y);
\r\n\t
tmpNode.addChild(unchecked);
\r\n\t
tmpNode.addChild(checked);
\r\n\t
var prize = new engine.Sprite(engine.Texture.fromImage(res[this._prizeIndex].img));
\r\n\t
var prizeID = res[this._prizeIndex].id;
\r\n\t
prize.width = props.icon_width;
\r\n\t
prize.height = props.icon_height;
\r\n\t
prize.x = (tmpNode.width - prize.width) / 2 + props.icon_X;
\r\n\t
prize.y = (tmpNode.height - prize.height) / 2 + props.icon_Y;
\r\n\t
tmpNode.prizeID = prizeID;
\r\n\t
tmpNode.addChild(prize);
\r\n\t
var titleLabel = new engine.Label();
\r\n\t
titleLabel.fillColor = props.prizeName_color;
\r\n\t
titleLabel.size = props.prizeName_size;
\r\n\t
titleLabel.width = tmpNode.width;
\r\n\t
titleLabel.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
titleLabel.x = 0;
\r\n\t
titleLabel.y = props.prizeName_Ypos;
\r\n\t
titleLabel.text = this.fixTitle(res[this._prizeIndex].name);
\r\n\t
tmpNode.addChild(titleLabel);
\r\n\t
this._prizeIndex++;
\r\n\t
this._boxArray.push(tmpNode);
\r\n\t
turnTableNode.addChild(tmpNode);
\r\n\t
}
\r\n\t
}
\r\n\t
turnTableNode.x = (750 - (this._singleNodeWidth * 3 + this._horizontal_X * 2)) / 2;
\r\n\t
};
\r\n\t
Turntable.prototype.setNodeOrder = function () {
\r\n\t
var tmpNodeArray = [];
\r\n\t
for (var index = 0; index < this.turntableOrder.length; index++) {
\r\n\t
var order = this.turntableOrder[index];
\r\n\t
tmpNodeArray.push(this._boxArray[order - 1]);
\r\n\t
}
\r\n\t
this._boxArray = tmpNodeArray;
\r\n\t
};
\r\n\t
Turntable.prototype.fixTitle = function (name) {
\r\n\t
if (!name) {
\r\n\t
return
\"\"
;
\r\n\t
}
\r\n\t
if (name.split(
\"\"
).length < props.prizeName_maxLength) {
\r\n\t
return name;
\r\n\t
}
\r\n\t
var n =
\"\"
;
\r\n\t
for (var i = 0; i < props.prizeName_retainLength; i++) {
\r\n\t
n += name.split(
\"\"
)[i];
\r\n\t
}
\r\n\t
n +=
\"
...
\"
;
\r\n\t
return n;
\r\n\t
};
\r\n\t
Turntable.prototype.getImage = function (resName, alpha) {
\r\n\t
var tmpImage = new engine.Sprite(getTextureByName(resName));
\r\n\t
tmpImage.x = 0;
\r\n\t
tmpImage.y = 0;
\r\n\t
tmpImage.alpha = alpha;
\r\n\t
tmpImage.name = resName;
\r\n\t
return tmpImage;
\r\n\t
};
\r\n\t
Turntable.prototype.startDraw = function () {
\r\n\t
var _this = this;
\r\n\t
var tmpCheckNode = this._boxArray[this._boxIndex].getChildByName('checked');
\r\n\t
if (this.isStop) {
\r\n\t
engine.Tween.removeTweens(tmpCheckNode);
\r\n\t
return;
\r\n\t
}
\r\n\t
if (this.slowDown) {
\r\n\t
if (this._boxIndex != this.getNodeIndexOFprize()) {
\r\n\t
this.tweenTime += this.slowTweenTime;
\r\n\t
}
\r\n\t
else {
\r\n\t
this.isStop = true;
\r\n\t
this.twinkle(tmpCheckNode);
\r\n\t
}
\r\n\t
}
\r\n\t
engine.Tween.get(tmpCheckNode)
\r\n\t
.to({ alpha: 1 }, this.tweenTime / 2)
\r\n\t
.to({ alpha: 0 }, this.tweenTime / 2)
\r\n\t
.call(function () {
\r\n\t
if (_this.circleNumber >= props.circleNumber && _this.getSlowStart() == _this._boxIndex) {
\r\n\t
_this.slowDown = true;
\r\n\t
}
\r\n\t
_this._boxIndex++;
\r\n\t
if (_this._boxIndex >= _this._boxArray.length) {
\r\n\t
_this._boxIndex = 0;
\r\n\t
_this.circleNumber++;
\r\n\t
}
\r\n\t
_this.startDraw();
\r\n\t
});
\r\n\t
};
\r\n\t
Turntable.prototype.getSlowStart = function () {
\r\n\t
if (this.recordID < 0)
\r\n\t
return -1;
\r\n\t
var tmpIndex = this.getNodeIndexOFprize();
\r\n\t
if (tmpIndex < 4) {
\r\n\t
return tmpIndex + 4;
\r\n\t
}
\r\n\t
else {
\r\n\t
return tmpIndex - 4;
\r\n\t
}
\r\n\t
};
\r\n\t
Turntable.prototype.getNodeIndexOFprize = function () {
\r\n\t
if (this.recordID < 0)
\r\n\t
return -1;
\r\n\t
for (var index = 0; index < this._boxArray.length; index++) {
\r\n\t
var element = this._boxArray[index];
\r\n\t
if (element.prizeID === this.recordID) {
\r\n\t
return index;
\r\n\t
}
\r\n\t
}
\r\n\t
return -1;
\r\n\t
};
\r\n\t
Turntable.prototype.twinkle = function (tmpNode) {
\r\n\t
engine.Tween.removeTweens(tmpNode);
\r\n\t
var twinkleTime = 1;
\r\n\t
engine.Tween.get(tmpNode, { loop: true })
\r\n\t
.to({ alpha: 0 }, 30)
\r\n\t
.to({ alpha: 1 }, 30)
\r\n\t
.call(function () {
\r\n\t
if (twinkleTime > 5) {
\r\n\t
engine.Tween.removeTweens(tmpNode);
\r\n\t
engine.globalEvent.dispatchEvent('jiugong-turntable-change-over');
\r\n\t
return;
\r\n\t
}
\r\n\t
else {
\r\n\t
twinkleTime++;
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
Turntable.prototype.setRecordID = function (prizeID) {
\r\n\t
this.recordID = prizeID;
\r\n\t
};
\r\n\t
Turntable.prototype.reset = function () {
\r\n\t
this._boxArray.forEach(function (element) {
\r\n\t
engine.Tween.removeTweens(element.getChildByName('checked'));
\r\n\t
});
\r\n\t
this._boxIndex = 0;
\r\n\t
this.tweenTime = props.tweenTime || 200;
\r\n\t
this.slowTweenTime = props.slowTweenTime || 200;
\r\n\t
this.circleNumber = 0;
\r\n\t
this.recordID = -1;
\r\n\t
this.boxPrizeIndex = -1;
\r\n\t
this.slowDown = false;
\r\n\t
this.isStop = false;
\r\n\t
for (var index = 0; index < this._boxArray.length; index++) {
\r\n\t
var element = this._boxArray[index];
\r\n\t
element.getChildByName('checked').alpha = 0;
\r\n\t
}
\r\n\t
};
\r\n\t
return Turntable;
\r\n\t
}(engine.Container));
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
return _super.call(this) || this;
\r\n\t
}
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
if (this._hasSetup) {
\r\n\t
return;
\r\n\t
}
\r\n\t
this._hasSetup = true;
\r\n\t
var turntable = this._turntable = new Turntable();
\r\n\t
this.addChild(turntable);
\r\n\t
};
\r\n\t
GameView.prototype.setPrizeData = function (res) {
\r\n\t
this._turntable.initData(res);
\r\n\t
};
\r\n\t
GameView.prototype.startDraw = function () {
\r\n\t
this._turntable.startDraw();
\r\n\t
};
\r\n\t
GameView.prototype.setRecordID = function (prizeID) {
\r\n\t
this._turntable.setRecordID(prizeID);
\r\n\t
};
\r\n\t
GameView.prototype.reset = function () {
\r\n\t
this._turntable.reset();
\r\n\t
};
\r\n\t
GameView.prototype.setSetup = function () {
\r\n\t
this._hasSetup = false;
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-init', _this.init, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-prizeData', _this.initPrizeData, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-start', _this.start, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-winPrize', _this.winPrize, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-reset', _this.reset, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-change-abnormal', _this.reset, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.init = function (event) {
\r\n\t
var gameView = this._gameView = new GameView();
\r\n\t
this.addChild(gameView);
\r\n\t
this._gameView.setup();
\r\n\t
};
\r\n\t
GameWrapper.prototype.initPrizeData = function (event) {
\r\n\t
this._gameView.setSetup();
\r\n\t
this._gameView.setPrizeData(event.data.resources);
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
this._gameView.startDraw();
\r\n\t
};
\r\n\t
GameWrapper.prototype.winPrize = function (event) {
\r\n\t
this._gameView.setRecordID(event.data.prizeID);
\r\n\t
};
\r\n\t
GameWrapper.prototype.reset = function () {
\r\n\t
this._gameView.reset();
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\n\n\t
return index;
\n\n
})));
\n
"
}
dist/customs/recycling.json
View file @
d811d190
...
...
@@ -470,5 +470,5 @@
}
},
"id"
:
"recycling"
,
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
\n\t
(global = global || self, global.recycling = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\r\n\t
function playSound(name) {
\r\n\t
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
\r\n\t
}
\r\n\t
function createSvga(name, anchorName) {
\r\n\t
var inst = new svga.Svga();
\r\n\t
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
\r\n\t
return inst;
\r\n\t
}
\
n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\n\n\t
var Conveyor = (function (_super) {
\r\n\t
tslib.__extends(Conveyor, _super);
\r\n\t
function Conveyor() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.y = 904.21;
\r\n\t
var sp = new engine.Sprite(getTextureByName('conveyor'));
\r\n\t
_this.addChild(sp);
\r\n\t
_this.idx0 = _this.createItem(75, 50);
\r\n\t
_this.idx1 = _this.createItem(225, 50);
\r\n\t
_this.idx2 = _this.createItem(375, 50);
\r\n\t
_this.idx3 = _this.createItem(525, 50);
\r\n\t
_this.idx4 = _this.createItem(675, 50);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Conveyor.prototype.clear = function () {
\r\n\t
this.clearItem(this.idx0);
\r\n\t
this.clearItem(this.idx1);
\r\n\t
this.clearItem(this.idx2);
\r\n\t
this.clearItem(this.idx3);
\r\n\t
this.clearItem(this.idx4);
\r\n\t
};
\r\n\t
Conveyor.prototype.clearItem = function (idx) {
\r\n\t
if (idx.children.length > 0)
\r\n\t
idx.removeChildAt(0);
\r\n\t
};
\r\n\t
Conveyor.prototype.createItem = function (x, y) {
\r\n\t
var sp = new engine.Sprite();
\r\n\t
this.addChild(sp);
\r\n\t
sp.x = x;
\r\n\t
sp.y = y;
\r\n\t
return sp;
\r\n\t
};
\r\n\t
return Conveyor;
\r\n\t
}(engine.Sprite));
\n\n\t
var GarbageTypes;
\r\n\t
(function (GarbageTypes) {
\r\n\t
GarbageTypes[
\"
recoverableWaste
\"
] =
\"
recoverableWaste
\"
;
\r\n\t
GarbageTypes[
\"
harmfulWaste
\"
] =
\"
harmfulWaste
\"
;
\r\n\t
GarbageTypes[
\"
wetWaste
\"
] =
\"
wetWaste
\"
;
\r\n\t
GarbageTypes[
\"
dryWaste
\"
] =
\"
dryWaste
\"
;
\r\n\t
})(GarbageTypes || (GarbageTypes = {}));
\n\n\t
var GarbageConfig = (function () {
\r\n\t
function GarbageConfig() {
\r\n\t
}
\r\n\t
GarbageConfig.config = [
\r\n\t
{ name:
\"
保鲜盒
\"
, source:
\"
g00
\"
, type: GarbageTypes.recoverableWaste, width: 129, height: 111 },
\r\n\t
{ name:
\"
报纸
\"
, source:
\"
g01
\"
, type: GarbageTypes.recoverableWaste, width: 138, height: 144 },
\r\n\t
{ name:
\"
贝壳
\"
, source:
\"
g02
\"
, type: GarbageTypes.dryWaste, width: 79, height: 117 },
\r\n\t
{ name:
\"
冰箱
\"
, source:
\"
g03
\"
, type: GarbageTypes.recoverableWaste, width: 63, height: 151 },
\r\n\t
{ name:
\"
菜梗菜叶
\"
, source:
\"
g04
\"
, type: GarbageTypes.wetWaste, width: 144, height: 98 },
\r\n\t
{ name:
\"
残枝落叶
\"
, source:
\"
g05
\"
, type: GarbageTypes.wetWaste, width: 120, height: 99 },
\r\n\t
{ name:
\"
茶叶渣
\"
, source:
\"
g06
\"
, type: GarbageTypes.wetWaste, width: 86, height: 96 },
\r\n\t
{ name:
\"
尘土
\"
, source:
\"
g07
\"
, type: GarbageTypes.dryWaste, width: 109, height: 114 },
\r\n\t
{ name:
\"
创口贴
\"
, source:
\"
g08
\"
, type: GarbageTypes.dryWaste, width: 112, height: 90 },
\r\n\t
{ name:
\"
大骨头
\"
, source:
\"
g09
\"
, type: GarbageTypes.dryWaste, width: 89, height: 101 },
\r\n\t
{ name:
\"
普通干电池
\"
, source:
\"
g11
\"
, type: GarbageTypes.dryWaste, width: 89, height: 131 },
\r\n\t
{ name:
\"
方便面盒
\"
, source:
\"
g12
\"
, type: GarbageTypes.dryWaste, width: 89, height: 168 },
\r\n\t
{ name:
\"
废弃食用油脂
\"
, source:
\"
g13
\"
, type: GarbageTypes.wetWaste, width: 131, height: 164 },
\r\n\t
{ name:
\"
骨骼内脏
\"
, source:
\"
g14
\"
, type: GarbageTypes.wetWaste, width: 104, height: 82 },
\r\n\t
{ name:
\"
锅具
\"
, source:
\"
g15
\"
, type: GarbageTypes.recoverableWaste, width: 119, height: 149 },
\r\n\t
{ name:
\"
果核
\"
, source:
\"
g16
\"
, type: GarbageTypes.wetWaste, width: 99, height: 95 },
\r\n\t
{ name:
\"
果皮
\"
, source:
\"
g17
\"
, type: GarbageTypes.wetWaste, width: 115, height: 127 },
\r\n\t
{ name:
\"
化妆品
\"
, source:
\"
g18
\"
, type: GarbageTypes.harmfulWaste, width: 67, height: 151 },
\r\n\t
{ name:
\"
鸡蛋壳
\"
, source:
\"
g19
\"
, type: GarbageTypes.wetWaste, width: 99, height: 107 },
\r\n\t
{ name:
\"
剪刀
\"
, source:
\"
g20
\"
, type: GarbageTypes.recoverableWaste, width: 96, height: 127 },
\r\n\t
{ name:
\"
胶带
\"
, source:
\"
g21
\"
, type: GarbageTypes.dryWaste, width: 87, height: 113 },
\r\n\t
{ name:
\"
榴莲壳
\"
, source:
\"
g22
\"
, type: GarbageTypes.dryWaste, width: 136, height: 116 },
\r\n\t
{ name:
\"
毛巾
\"
, source:
\"
g23
\"
, type: GarbageTypes.recoverableWaste, width: 108, height: 96 },
\r\n\t
{ name:
\"
纽扣电池
\"
, source:
\"
g24
\"
, type: GarbageTypes.harmfulWaste, width: 87, height: 89 },
\r\n\t
{ name:
\"
破旧陶瓷罐
\"
, source:
\"
g25
\"
, type: GarbageTypes.dryWaste, width: 110, height: 125 },
\r\n\t
{ name:
\"
杀虫剂
\"
, source:
\"
g26
\"
, type: GarbageTypes.harmfulWaste, width: 64, height: 160 },
\r\n\t
{ name:
\"
剩菜剩饭
\"
, source:
\"
g27
\"
, type: GarbageTypes.wetWaste, width: 128, height: 96 },
\r\n\t
{ name:
\"
手机
\"
, source:
\"
g28
\"
, type: GarbageTypes.recoverableWaste, width: 82, height: 142 },
\r\n\t
{ name:
\"
书本
\"
, source:
\"
g29
\"
, type: GarbageTypes.recoverableWaste, width: 106, height: 132 },
\r\n\t
{ name:
\"
玻璃杯
\"
, source:
\"
g30
\"
, type: GarbageTypes.recoverableWaste, width: 62, height: 119 },
\r\n\t
{ name:
\"
水银温度计
\"
, source:
\"
g31
\"
, type: GarbageTypes.harmfulWaste, width: 109, height: 162 },
\r\n\t
{ name:
\"
水银血压计
\"
, source:
\"
g32
\"
, type: GarbageTypes.harmfulWaste, width: 115, height: 147 },
\r\n\t
{ name:
\"
塑料桶
\"
, source:
\"
g33
\"
, type: GarbageTypes.recoverableWaste, width: 92, height: 131 },
\r\n\t
{ name:
\"
卫生纸
\"
, source:
\"
g34
\"
, type: GarbageTypes.dryWaste, width: 92, height: 132 },
\r\n\t
{ name:
\"
污染织物
\"
, source:
\"
g35
\"
, type: GarbageTypes.dryWaste, width: 128, height: 139 },
\r\n\t
{ name:
\"
污染纸张
\"
, source:
\"
g36
\"
, type: GarbageTypes.dryWaste, width: 96, height: 136 },
\r\n\t
{ name:
\"
洗衣机
\"
, source:
\"
g37
\"
, type: GarbageTypes.recoverableWaste, width: 87, height: 157 },
\r\n\t
{ name:
\"
烟蒂
\"
, source:
\"
g38
\"
, type: GarbageTypes.dryWaste, width: 87, height: 124 },
\r\n\t
{ name:
\"
药品
\"
, source:
\"
g39
\"
, type: GarbageTypes.harmfulWaste, width: 109, height: 131 },
\r\n\t
{ name:
\"
药品包装
\"
, source:
\"
g40
\"
, type: GarbageTypes.harmfulWaste, width: 108, height: 125 },
\r\n\t
{ name:
\"
椰子壳
\"
, source:
\"
g41
\"
, type: GarbageTypes.dryWaste, width: 104, height: 119 },
\r\n\t
{ name:
\"
衣服
\"
, source:
\"
g42
\"
, type: GarbageTypes.recoverableWaste, width: 83, height: 137 },
\r\n\t
{ name:
\"
衣架
\"
, source:
\"
g43
\"
, type: GarbageTypes.recoverableWaste, width: 132, height: 125 },
\r\n\t
{ name:
\"
易拉罐
\"
, source:
\"
g44
\"
, type: GarbageTypes.recoverableWaste, width: 65, height: 133 },
\r\n\t
{ name:
\"
荧光灯
\"
, source:
\"
g45
\"
, type: GarbageTypes.harmfulWaste, width: 90, height: 118 },
\r\n\t
{ name:
\"
油漆桶
\"
, source:
\"
g46
\"
, type: GarbageTypes.harmfulWaste, width: 65, height: 143 },
\r\n\t
{ name:
\"
一次性纸杯
\"
, source:
\"
g47
\"
, type: GarbageTypes.dryWaste, width: 76, height: 116 },
\r\n\t
{ name:
\"
纸尿裤
\"
, source:
\"
g48
\"
, type: GarbageTypes.dryWaste, width: 93, height: 138 },
\r\n\t
{ name:
\"
纸箱
\"
, source:
\"
g49
\"
, type: GarbageTypes.recoverableWaste, width: 112, height: 118 },
\r\n\t
{ name:
\"
指甲油
\"
, source:
\"
g50
\"
, type: GarbageTypes.harmfulWaste, width: 64, height: 138 },
\r\n\t
];
\r\n\t
return GarbageConfig;
\r\n\t
}());
\n\n\t
var transStores = (function (list) {
\r\n\t
var tmp = [];
\r\n\t
var contains = function (val) {
\r\n\t
for (var _i = 0, tmp_1 = tmp; _i < tmp_1.length; _i++) {
\r\n\t
var i = tmp_1[_i];
\r\n\t
if (val.targetType == i.targetType && val.itemType == i.itemType && val.itemName == i.itemName)
\r\n\t
return true;
\r\n\t
}
\r\n\t
return false;
\r\n\t
};
\r\n\t
list.forEach(function (i) {
\r\n\t
if (!contains(i))
\r\n\t
tmp.push(i);
\r\n\t
});
\r\n\t
list = tmp;
\r\n\t
tmp = [];
\r\n\t
var nameList = [];
\r\n\t
var contains2 = function (val) {
\r\n\t
for (var _i = 0, tmp_2 = tmp; _i < tmp_2.length; _i++) {
\r\n\t
var i = tmp_2[_i];
\r\n\t
if (val.itemName == i.itemName) {
\r\n\t
nameList.push(i.itemName);
\r\n\t
return true;
\r\n\t
}
\r\n\t
}
\r\n\t
return false;
\r\n\t
};
\r\n\t
list.forEach(function (i) {
\r\n\t
if (!contains2(i))
\r\n\t
tmp.push(i);
\r\n\t
});
\r\n\t
list = tmp;
\r\n\t
list.forEach(function (i) {
\r\n\t
if (nameList.indexOf(i.itemName) != -1) {
\r\n\t
i.targetType = i.itemType;
\r\n\t
}
\r\n\t
});
\r\n\t
return list.map(function (i) {
\r\n\t
return {
\r\n\t
'targetName': getTargetName(i.targetType),
\r\n\t
'isCorrect': i.targetType == i.itemType,
\r\n\t
'itemName': i.itemName,
\r\n\t
'itemTypeName': getTargetName(i.itemType)
\r\n\t
};
\r\n\t
});
\r\n\t
});
\r\n\t
var getTargetName = function (type) {
\r\n\t
switch (type) {
\r\n\t
case GarbageTypes.recoverableWaste:
\r\n\t
return '可回收物';
\r\n\t
case GarbageTypes.harmfulWaste:
\r\n\t
return '有害垃圾';
\r\n\t
case GarbageTypes.wetWaste:
\r\n\t
return '湿垃圾';
\r\n\t
case GarbageTypes.dryWaste:
\r\n\t
return '其他垃圾';
\r\n\t
}
\r\n\t
};
\n\n\t
var checkHit = (function (view, rect) {
\r\n\t
var x = view.x, y = view.y;
\r\n\t
var _a = view.texture, width = _a.width, height = _a.height;
\r\n\t
if (x > rect.x && y > rect.y && (x + width) < (rect.x + rect.width) && (y + height) < (rect.y + rect.height)) {
\r\n\t
return true;
\r\n\t
}
\r\n\t
return false;
\r\n\t
});
\n\n\t
var removeChild = (function (d) {
\r\n\t
if (d && d.parent) {
\r\n\t
d.parent.removeChild(d);
\r\n\t
}
\r\n\t
});
\n\n\t
var removeEle = (function (e, arr) {
\r\n\t
var index = arr.indexOf(e);
\r\n\t
if (index >= 0) {
\r\n\t
arr.splice(index, 1);
\r\n\t
}
\r\n\t
});
\n\n\t
var shuffle = (function (arr) {
\r\n\t
var _a;
\r\n\t
var i = arr.length;
\r\n\t
while (i) {
\r\n\t
var j = Math.floor(Math.random() * i--);
\r\n\t
_a = [arr[i], arr[j]], arr[j] = _a[0], arr[i] = _a[1];
\r\n\t
}
\r\n\t
return arr;
\r\n\t
});
\n\n\t
var WrongTips = (function (_super) {
\r\n\t
tslib.__extends(WrongTips, _super);
\r\n\t
function WrongTips() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.img = new engine.Image();
\r\n\t
_this.img.texture = getTextureByName('wrongTips');
\r\n\t
_this.addChild(_this.img);
\r\n\t
_this.img.anchorX = 88 / 2;
\r\n\t
_this.img.anchorY = 85 / 2;
\r\n\t
_this.visible = false;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
WrongTips.prototype.play = function (rect) {
\r\n\t
this.visible = true;
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
wrongTipsMp3
\"
);
\r\n\t
}
\r\n\t
var dur = 70;
\r\n\t
var stren = 20;
\r\n\t
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 })
\r\n\t
.to({ x: stren }, dur)
\r\n\t
.to({ x: 0 }, dur)
\r\n\t
.to({ x: -stren }, dur)
\r\n\t
.to({ x: 0 }, dur)
\r\n\t
.wait(200)
\r\n\t
.to({ alpha: 0 }, 300);
\r\n\t
this.x = rect.x + 180;
\r\n\t
this.y = rect.y;
\r\n\t
};
\r\n\t
return WrongTips;
\r\n\t
}(engine.Sprite));
\r\n\t
var getTargetRect = function (targetType, gameview) {
\r\n\t
switch (targetType) {
\r\n\t
case GarbageTypes.dryWaste:
\r\n\t
return gameview.dryWaste;
\r\n\t
case GarbageTypes.wetWaste:
\r\n\t
return gameview.wetWaste;
\r\n\t
case GarbageTypes.harmfulWaste:
\r\n\t
return gameview.harmfulWaste;
\r\n\t
case GarbageTypes.recoverableWaste:
\r\n\t
return gameview.recoverableWaste;
\r\n\t
}
\r\n\t
};
\n\n\t
var Conveyors = (function (_super) {
\r\n\t
tslib.__extends(Conveyors, _super);
\r\n\t
function Conveyors(p) {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.conveyorsPool = [];
\r\n\t
_this.GarbageConfig = GarbageConfig.config;
\r\n\t
_this.datas = [];
\r\n\t
_this.wrapper = p;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Conveyors.prototype.initData = function (conveyor0, conveyor1) {
\r\n\t
this.conveyor0 = conveyor0;
\r\n\t
this.conveyor1 = conveyor1;
\r\n\t
};
\r\n\t
Conveyors.prototype.setDefault = function () {
\r\n\t
this.score = 0;
\r\n\t
this.conveyorsPool.push(this.conveyor0);
\r\n\t
this.conveyorsPool.push(this.conveyor1);
\r\n\t
var allConfigs = shuffle(this.GarbageConfig.concat([]));
\r\n\t
for (var i = 0; i < GarbageConfig.config.length; i++) {
\r\n\t
allConfigs[i].idx = i;
\r\n\t
allConfigs[i].isRight = false;
\r\n\t
allConfigs[i].isMistake = false;
\r\n\t
allConfigs[i].isOnStage = false;
\r\n\t
this.datas.push(allConfigs[i]);
\r\n\t
}
\r\n\t
for (var i = 0; i < 5; i++) {
\r\n\t
var data = this.datas[i];
\r\n\t
var view = new engine.Sprite(getTextureByName(data.source));
\r\n\t
view.isWrong = false;
\r\n\t
view.isRight = false;
\r\n\t
data.isOnStage = true;
\r\n\t
view.data = data;
\r\n\t
view.type = data.type;
\r\n\t
view.name = data.name;
\r\n\t
view.anchorX = data.width / 2;
\r\n\t
view.anchorY = data.height;
\r\n\t
view.x = -data.width / 2;
\r\n\t
view.y = -data.height + 40;
\r\n\t
this.conveyor1[
\"
idx
\"
+ i].addChild(view);
\r\n\t
view.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown_garbage, this);
\r\n\t
}
\r\n\t
};
\r\n\t
Conveyors.prototype.startConveyors = function () {
\r\n\t
this.setDefault();
\r\n\t
engine.gameStage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
\r\n\t
};
\r\n\t
Conveyors.prototype.onEnterFrame = function (ENTER_FRAME, onEnterFrame, arg2) {
\r\n\t
if (this.score == (props.maxScore || 100)) {
\r\n\t
this.gameOver();
\r\n\t
this.wrapper.stop();
\r\n\t
if (props.sound)
\r\n\t
playSound(
\"
gameOverMp3
\"
);
\r\n\t
}
\r\n\t
this.conveyorsPool.forEach(function (conveyor) {
\r\n\t
conveyor.x -= props.speed || 3;
\r\n\t
});
\r\n\t
if (this.conveyorsPool[this.conveyorsPool.length - 1].x <= 764) {
\r\n\t
var conveyor = new Conveyor();
\r\n\t
conveyor.x = this.conveyorsPool[this.conveyorsPool.length - 1].x + 764;
\r\n\t
this.wrapper.addChild(conveyor);
\r\n\t
this.conveyorsPool.push(conveyor);
\r\n\t
}
\r\n\t
else {
\r\n\t
var dataList = [];
\r\n\t
for (var n = 0; n < this.datas.length; n++) {
\r\n\t
var dataItem = this.datas[n];
\r\n\t
if (!dataItem.isRight && !dataItem.isOnStage) {
\r\n\t
dataList.push(dataItem);
\r\n\t
}
\r\n\t
}
\r\n\t
var lastConveyor = this.conveyorsPool[this.conveyorsPool.length - 1];
\r\n\t
for (var m = 0; m < 5; m++) {
\r\n\t
if (!lastConveyor[
\"
idx
\"
+ m].children[0]) {
\r\n\t
var data = dataList.shift();
\r\n\t
if (data) {
\r\n\t
data.isOnStage = true;
\r\n\t
var view = new engine.Sprite(getTextureByName(data.source));
\r\n\t
view.data = data;
\r\n\t
view.isWrong = false;
\r\n\t
view.isRight = false;
\r\n\t
view.type = data.type;
\r\n\t
view.name = data.name;
\r\n\t
view.anchorX = data.width / 2;
\r\n\t
view.anchorY = data.height;
\r\n\t
view.x = -data.width / 2;
\r\n\t
view.y = -data.height + 40;
\r\n\t
lastConveyor[
\"
idx
\"
+ m].addChild(view);
\r\n\t
view.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown_garbage, this);
\r\n\t
}
\r\n\t
else {
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
if (this.conveyorsPool[0].x < -750) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx4 = this.conveyorsPool[0][
\"
idx
\"
+ 4];
\r\n\t
if (idx4.children[0]) {
\r\n\t
if (dataItem.name == idx4.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx4.removeChild(idx4.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
this.conveyorsPool.shift();
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -600) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx3 = this.conveyorsPool[0][
\"
idx
\"
+ 3];
\r\n\t
if (idx3.children[0]) {
\r\n\t
if (dataItem.name == idx3.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx3.removeChild(idx3.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -450) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx2 = this.conveyorsPool[0][
\"
idx
\"
+ 2];
\r\n\t
if (idx2.children[0]) {
\r\n\t
if (dataItem.name == idx2.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx2.removeChild(idx2.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -300) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx1 = this.conveyorsPool[0][
\"
idx
\"
+ 1];
\r\n\t
if (idx1.children[0]) {
\r\n\t
if (dataItem.name == idx1.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx1.removeChild(idx1.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -150) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx0 = this.conveyorsPool[0][
\"
idx
\"
+ 0];
\r\n\t
if (idx0.children[0]) {
\r\n\t
if (dataItem.name == idx0.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx0.removeChild(idx0.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
Conveyors.prototype.addscore = function () {
\r\n\t
this.score += (props.onceScore || 2);
\r\n\t
engine.globalEvent.dispatchEvent('recycling-score-update', {
\r\n\t
score: this.score
\r\n\t
});
\r\n\t
};
\r\n\t
Conveyors.prototype.gameOver = function () {
\r\n\t
engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
\r\n\t
engine.globalEvent.dispatchEvent('recycling-game-end', transStores(this.stores));
\r\n\t
};
\r\n\t
Conveyors.prototype.onDown_garbage = function (e) {
\r\n\t
if (this._currentDragView) {
\r\n\t
removeChild(this._currentDragView);
\r\n\t
}
\r\n\t
var target = e.target;
\r\n\t
var view = new engine.Sprite(target.texture);
\r\n\t
this._currentDragView = view;
\r\n\t
this._currentTarget = target;
\r\n\t
target.scaleX = target.scaleY = 0;
\r\n\t
this.wrapper.addChild(view);
\r\n\t
view.x = e.stageX - target.texture.width / 2;
\r\n\t
view.y = e.stageY - target.texture.height / 2;
\r\n\t
view.type = target['type'];
\r\n\t
view.name = target['name'];
\r\n\t
this.wrapper.addEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this);
\r\n\t
this.wrapper.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this);
\r\n\t
};
\r\n\t
Conveyors.prototype.onStageMouseMove = function (e) {
\r\n\t
var view = this._currentDragView;
\r\n\t
view.x = e.stageX - view.texture.width / 2;
\r\n\t
view.y = e.stageY - view.texture.height / 2;
\r\n\t
};
\r\n\t
Conveyors.prototype.onStageMouseUp = function (e) {
\r\n\t
var _this = this;
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this);
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this);
\r\n\t
if (!this._currentDragView)
\r\n\t
return;
\r\n\t
var result = this.checkHitRect();
\r\n\t
if (result) {
\r\n\t
if (result == this._currentDragView['type']) {
\r\n\t
this.addscore();
\r\n\t
this.wrapper.rightTips.play(getTargetRect(result, this.wrapper));
\r\n\t
this._currentTarget.data.isRight = true;
\r\n\t
}
\r\n\t
else {
\r\n\t
engine.Tween.get(this._currentTarget).to({ scaleX: 1, scaleY: 1 }, 300).call(function () { });
\r\n\t
this.wrapper.wrongTips.play(getTargetRect(result, this.wrapper));
\r\n\t
}
\r\n\t
this.stores.push({ targetType: result, itemType: this._currentDragView['type'], itemName: this._currentDragView['name'] });
\r\n\t
}
\r\n\t
else {
\r\n\t
engine.Tween.get(this._currentTarget).to({ scaleX: 1, scaleY: 1 }, 300).call(function () { });
\r\n\t
}
\r\n\t
this._currentDragView.anchorX = this._currentDragView.texture.width / 2;
\r\n\t
this._currentDragView.anchorY = this._currentDragView.texture.height / 2;
\r\n\t
engine.Tween.get(this._currentDragView).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {
\r\n\t
removeChild(_this._currentDragView);
\r\n\t
});
\r\n\t
};
\r\n\t
Conveyors.prototype.clear = function () {
\r\n\t
this.conveyor0.x = 0;
\r\n\t
this.conveyor1.x = 764;
\r\n\t
this.conveyorsPool.forEach(function (i) {
\r\n\t
i.clear();
\r\n\t
});
\r\n\t
this.conveyorsPool = [];
\r\n\t
this.datas = [];
\r\n\t
this.stores = [];
\r\n\t
};
\r\n\t
Conveyors.prototype.timeout = function () {
\r\n\t
if (this._currentDragView) {
\r\n\t
removeChild(this._currentDragView);
\r\n\t
}
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this);
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this);
\r\n\t
this.gameOver();
\r\n\t
};
\r\n\t
Conveyors.prototype.checkHitRect = function () {
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.wetWaste)) {
\r\n\t
return GarbageTypes.wetWaste;
\r\n\t
}
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.harmfulWaste)) {
\r\n\t
return GarbageTypes.harmfulWaste;
\r\n\t
}
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.dryWaste)) {
\r\n\t
return GarbageTypes.dryWaste;
\r\n\t
}
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.recoverableWaste)) {
\r\n\t
return GarbageTypes.recoverableWaste;
\r\n\t
}
\r\n\t
return null;
\r\n\t
};
\r\n\t
return Conveyors;
\r\n\t
}(engine.Sprite));
\n\n\t
var uiConfig = (function () {
\r\n\t
return [
\r\n\t
{
\r\n\t
id: 'playBg',
\r\n\t
texture: 'playBg'
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler0',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [75, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler1',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [175, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler2',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [275, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler3',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [375, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler4',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [475, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler5',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [575, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler6',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [675, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
];
\r\n\t
});
\n\n\t
var setGuide = function () {
\r\n\t
try {
\r\n\t
if (window.localStorage && window.localStorage.setItem) {
\r\n\t
localStorage.setItem('recyclingGuide', '1');
\r\n\t
}
\r\n\t
}
\r\n\t
catch (e) {
\r\n\t
console.log(
\"
setguide--err
\"
, e);
\r\n\t
}
\r\n\t
};
\n\n\t
var createBg = (function (a) {
\r\n\t
if (a === void 0) { a = 1; }
\r\n\t
var rect = new engine.Graphics();
\r\n\t
rect.beginFill(0);
\r\n\t
rect.drawRect(0, 0, 750, 1624);
\r\n\t
rect.endFill();
\r\n\t
rect.alpha = a;
\r\n\t
return rect;
\r\n\t
});
\n\n\t
var createImg = (function (texture) {
\r\n\t
return new engine.Sprite(getTextureByName(texture));
\r\n\t
});
\n\n\t
var CountDownGroup = (function (_super) {
\r\n\t
tslib.__extends(CountDownGroup, _super);
\r\n\t
function CountDownGroup() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.addChild(createBg(.6));
\r\n\t
_this.num1 = createImg('num1');
\r\n\t
_this.num2 = createImg('num2');
\r\n\t
_this.num3 = createImg('num3');
\r\n\t
_this.go = createImg('go');
\r\n\t
_this.go.anchorX = 240;
\r\n\t
_this.go.anchorY = 171.5;
\r\n\t
_this.num1.anchorX = 125.5;
\r\n\t
_this.num1.anchorY = 189;
\r\n\t
_this.num2.anchorX = 149.5;
\r\n\t
_this.num2.anchorY = 191.5;
\r\n\t
_this.num3.anchorX = 148.5;
\r\n\t
_this.num3.anchorY = 191.5;
\r\n\t
_this.go.x = 750 / 2 - 240;
\r\n\t
_this.go.y = 525 - 171.5;
\r\n\t
_this.num1.x = 750 / 2 - 125.5;
\r\n\t
_this.num1.y = 529 - 189;
\r\n\t
_this.num2.x = 750 / 2 - 149.5;
\r\n\t
_this.num2.y = 526 - 191.5;
\r\n\t
_this.num3.x = 750 / 2 - 148.5;
\r\n\t
_this.num3.y = 525 - 191.5;
\r\n\t
_this.addChild(_this.num1);
\r\n\t
_this.addChild(_this.num2);
\r\n\t
_this.addChild(_this.num3);
\r\n\t
_this.addChild(_this.go);
\r\n\t
_this.visible = false;
\r\n\t
_this.reset();
\r\n\t
return _this;
\r\n\t
}
\r\n\t
CountDownGroup.prototype.reset = function () {
\r\n\t
this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;
\r\n\t
this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;
\r\n\t
this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;
\r\n\t
};
\r\n\t
CountDownGroup.prototype.startCountDown = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
return [2, new Promise(function (r) {
\r\n\t
_this.reset();
\r\n\t
_this.visible = true;
\r\n\t
_this.num3.alpha = 1;
\r\n\t
var n3 = engine.Tween.get(_this.num3);
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
numCountDown
\"
);
\r\n\t
}
\r\n\t
n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
\r\n\t
_this.num2.alpha = 1;
\r\n\t
var n2 = engine.Tween.get(_this.num2);
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
numCountDown
\"
);
\r\n\t
}
\r\n\t
n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
\r\n\t
_this.num1.alpha = 1;
\r\n\t
var n1 = engine.Tween.get(_this.num1);
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
numCountDown
\"
);
\r\n\t
}
\r\n\t
n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
\r\n\t
_this.go.alpha = 1;
\r\n\t
var go = engine.Tween.get(_this.go);
\r\n\t
if (props.sound) {
\r\n\t
if (props.sound)
\r\n\t
playSound(
\"
goMp3
\"
);
\r\n\t
}
\r\n\t
go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(function () {
\r\n\t
_this.visible = false;
\r\n\t
r();
\r\n\t
});
\r\n\t
});
\r\n\t
});
\r\n\t
});
\r\n\t
})];
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
return CountDownGroup;
\r\n\t
}(engine.Sprite));
\n\n\t
var GuideView = (function (_super) {
\r\n\t
tslib.__extends(GuideView, _super);
\r\n\t
function GuideView() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.initUI();
\r\n\t
_this.visible = false;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GuideView.prototype.initUI = function () {
\r\n\t
this.addChild(createBg(.6));
\r\n\t
this.guideBg = createImg('guideBg');
\r\n\t
this.addChild(this.guideBg);
\r\n\t
this.guideEle = createImg('guideEle');
\r\n\t
this.addChild(this.guideEle);
\r\n\t
this.guideBg.x = 403;
\r\n\t
this.guideBg.y = 565;
\r\n\t
this.guideEle.x = 361;
\r\n\t
this.guideEle.y = 877;
\r\n\t
this.guideEle.anchorX = 14;
\r\n\t
this.guideEle.anchorY = 88;
\r\n\t
this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;
\r\n\t
var svga = createSvga(
\"
guideTips
\"
);
\r\n\t
this.svga = svga;
\r\n\t
this.addChild(svga);
\r\n\t
svga.gotoAndStop(1);
\r\n\t
svga.mouseEnabled = svga.mouseChildren = false;
\r\n\t
};
\r\n\t
GuideView.prototype.checkHit = function (x, y, w, h) {
\r\n\t
var rect = new engine.Rectangle(403, 565, 252, 297);
\r\n\t
if (x > rect.x && y > rect.y && (x + w) < (rect.x + rect.width) && (y + h) < (rect.y + rect.height)) {
\r\n\t
return true;
\r\n\t
}
\r\n\t
return false;
\r\n\t
};
\r\n\t
GuideView.prototype.startGuide = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
return [2, new Promise(function (r) {
\r\n\t
_this.visible = true;
\r\n\t
_this.svga.gotoAndStop(1);
\r\n\t
_this.svga.play(false, true);
\r\n\t
_this.guideEle.scaleX = 1;
\r\n\t
_this.guideEle.scaleY = 1;
\r\n\t
var offset = [0, 0];
\r\n\t
var guideOver = function () {
\r\n\t
_this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
\r\n\t
_this.guideEle.anchorX = 14;
\r\n\t
_this.guideEle.anchorY = 44;
\r\n\t
engine.Tween.get(_this.guideEle).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {
\r\n\t
_this.visible = false;
\r\n\t
r();
\r\n\t
});
\r\n\t
};
\r\n\t
var onUp = function (e) {
\r\n\t
_this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);
\r\n\t
if (_this.checkHit(_this.guideEle.x, _this.guideEle.y, _this.guideEle.width, _this.guideEle.height)) {
\r\n\t
guideOver();
\r\n\t
}
\r\n\t
else {
\r\n\t
_this.svga.visible = true;
\r\n\t
_this.guideEle.x = 361;
\r\n\t
_this.guideEle.y = 877;
\r\n\t
engine.Tween.get(_this.guideEle).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1, scaleY: 1 }, 300);
\r\n\t
}
\r\n\t
};
\r\n\t
var onMove = function (e) {
\r\n\t
_this.guideEle.x = e.stageX - offset[0];
\r\n\t
_this.guideEle.y = e.stageY - offset[1];
\r\n\t
};
\r\n\t
var ondown = function (e) {
\r\n\t
offset = [e.localX, e.localY];
\r\n\t
_this.svga.visible = false;
\r\n\t
_this.stage.once(engine.MouseEvent.MOUSE_UP, onUp, _this);
\r\n\t
_this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);
\r\n\t
};
\r\n\t
_this.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
\r\n\t
})];
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
return GuideView;
\r\n\t
}(engine.Sprite));
\n\n\t
var RightTips = (function (_super) {
\r\n\t
tslib.__extends(RightTips, _super);
\r\n\t
function RightTips() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.SCORE = props.onceScore || 2;
\r\n\t
_this.img = new engine.Image();
\r\n\t
_this.img.texture = getTextureByName('rightTips');
\r\n\t
_this.addChild(_this.img);
\r\n\t
_this.img.anchorX = 88 / 2;
\r\n\t
_this.img.anchorY = 85 / 2;
\r\n\t
_this.visible = false;
\r\n\t
_this.txt = new engine.TextField();
\r\n\t
_this.addChild(_this.txt);
\r\n\t
_this.txt.text = '+' + _this.SCORE;
\r\n\t
_this.txt.size = 60;
\r\n\t
_this.txt.fillColor = '#437726';
\r\n\t
engine.playSound;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
RightTips.prototype.play = function (rect) {
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
rightTipsSound
\"
);
\r\n\t
}
\r\n\t
this.visible = true;
\r\n\t
this.txt.x = 100;
\r\n\t
engine.Tween.get(this.txt).set({ y: 60, alpha: 1 })
\r\n\t
.to({ y: -50 }, 500)
\r\n\t
.to({ alpha: 0 });
\r\n\t
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 0, scaleY: 0, alpha: 1 })
\r\n\t
.to({ scaleX: 1, scaleY: 1 }, 200, engine.Ease.getBackOut(1))
\r\n\t
.wait(200)
\r\n\t
.to({ alpha: 0 }, 300);
\r\n\t
this.x = rect.x + 180;
\r\n\t
this.y = rect.y;
\r\n\t
};
\r\n\t
return RightTips;
\r\n\t
}(engine.Sprite));
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this._timeCounter = 0;
\r\n\t
_this.guidenew = false;
\r\n\t
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameView.prototype.configUI = function () {
\r\n\t
var uiMap = {};
\r\n\t
this.uiMap = uiMap;
\r\n\t
var config = uiConfig();
\r\n\t
for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {
\r\n\t
var item = config_1[_i];
\r\n\t
var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;
\r\n\t
var sp = new engine.Sprite(getTextureByName(texture));
\r\n\t
this.addChild(sp);
\r\n\t
uiMap[id] = sp;
\r\n\t
if (anchor) {
\r\n\t
sp.anchorX = anchor[0];
\r\n\t
sp.anchorY = anchor[1];
\r\n\t
}
\r\n\t
if (pos) {
\r\n\t
sp.x = pos[0];
\r\n\t
sp.y = pos[1];
\r\n\t
if (anchor) {
\r\n\t
sp.x = pos[0] - sp.anchorX;
\r\n\t
sp.y = pos[1] - sp.anchorY;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
this.configConveyors();
\r\n\t
this.createRects();
\r\n\t
this.countdown = new CountDownGroup();
\r\n\t
this.addChild(this.countdown);
\r\n\t
this.guide = new GuideView();
\r\n\t
this.addChild(this.guide);
\r\n\t
this.wrongTips = new WrongTips();
\r\n\t
this.rightTips = new RightTips();
\r\n\t
this.addChild(this.wrongTips);
\r\n\t
this.addChild(this.rightTips);
\r\n\t
};
\r\n\t
GameView.prototype.createRects = function () {
\r\n\t
this.wetWaste = this.createRect(104, 565, 252, 297, 0xffffff);
\r\n\t
this.harmfulWaste = this.createRect(104, 232, 252, 297, 0xff0000);
\r\n\t
this.dryWaste = this.createRect(403, 232, 252, 297, 0x000000);
\r\n\t
this.recoverableWaste = this.createRect(403, 565, 252, 297, 0x0000ff);
\r\n\t
};
\r\n\t
GameView.prototype.createRect = function (x, y, w, h, c) {
\r\n\t
var rect = new engine.Rectangle(x, y, w, h);
\r\n\t
var sp = new engine.Sprite();
\r\n\t
this.addChild(sp);
\r\n\t
sp.x = x;
\r\n\t
sp.y = y;
\r\n\t
var g = new engine.Graphics;
\r\n\t
g.alpha = 0.0;
\r\n\t
g.beginFill(c);
\r\n\t
g.drawRect(0, 0, w, h);
\r\n\t
g.endFill();
\r\n\t
sp.addChild(g);
\r\n\t
return rect;
\r\n\t
};
\r\n\t
GameView.prototype.configConveyors = function () {
\r\n\t
var conveyor0 = new Conveyor();
\r\n\t
var conveyor1 = new Conveyor();
\r\n\t
this.addChild(conveyor0);
\r\n\t
this.addChild(conveyor1);
\r\n\t
conveyor0.x = 0;
\r\n\t
conveyor1.x = 764;
\r\n\t
this.conveyors = new Conveyors(this);
\r\n\t
this.conveyors.initData(conveyor0, conveyor1);
\r\n\t
};
\r\n\t
GameView.prototype.playAni = function () {
\r\n\t
var _this = this;
\r\n\t
var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
\r\n\t
idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });
\r\n\t
idlerWheels.forEach(function (i) {
\r\n\t
engine.Tween.get(i, { loop: true }).to({ rotation: -360 }, 1000);
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.stopAni = function () {
\r\n\t
var _this = this;
\r\n\t
var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
\r\n\t
idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });
\r\n\t
idlerWheels.forEach(function (i) {
\r\n\t
engine.Tween.removeTweens(i);
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.start = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
switch (_a.label) {
\r\n\t
case 0:
\r\n\t
this._timeCounter = 0;
\r\n\t
if (!(!props.isNewPlayer && !this.guidenew)) return [3, 2];
\r\n\t
return [4, this.guide.startGuide()];
\r\n\t
case 1:
\r\n\t
_a.sent();
\r\n\t
setGuide();
\r\n\t
this.guidenew = true;
\r\n\t
_a.label = 2;
\r\n\t
case 2:
\r\n\t
this.conveyors.clear();
\r\n\t
return [4, this.countdown.startCountDown()];
\r\n\t
case 3:
\r\n\t
_a.sent();
\r\n\t
this.startGame();
\r\n\t
engine.globalEvent.dispatchEvent('recycling-time-update', {
\r\n\t
second: this.getSecond(),
\r\n\t
});
\r\n\t
this._timer = setInterval(function () {
\r\n\t
_this.onTimer();
\r\n\t
}, 1000);
\r\n\t
return [2];
\r\n\t
}
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.startGame = function () {
\r\n\t
this.playAni();
\r\n\t
this.conveyors.startConveyors();
\r\n\t
};
\r\n\t
GameView.prototype.stopGame = function () {
\r\n\t
this.stopAni();
\r\n\t
};
\r\n\t
GameView.prototype.getSecond = function () {
\r\n\t
return props.time - this._timeCounter;
\r\n\t
};
\r\n\t
GameView.prototype.onTimer = function () {
\r\n\t
this._timeCounter++;
\r\n\t
engine.globalEvent.dispatchEvent('recycling-time-update', {
\r\n\t
second: this.getSecond(),
\r\n\t
});
\r\n\t
if (this.getSecond() == 0) {
\r\n\t
this.stop();
\r\n\t
this.conveyors.timeout();
\r\n\t
if (props.sound)
\r\n\t
playSound(
\"
gameOverMp3
\"
);
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.stop = function () {
\r\n\t
clearInterval(this._timer);
\r\n\t
this.stopGame();
\r\n\t
};
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
console.log('onSteup', props);
\r\n\t
this.configUI();
\r\n\t
};
\r\n\t
GameView.prototype.onDown = function (e) {
\r\n\t
};
\r\n\t
GameView.prototype.stageOnUp = function (e) {
\r\n\t
};
\r\n\t
GameView.prototype.onSuccess = function () {
\r\n\t
};
\r\n\t
GameView.prototype.onMove = function (e) {
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('recycling-start', _this.start, _this);
\r\n\t
engine.globalEvent.addEventListener('recycling-sound-update', _this.updateSound, _this);
\r\n\t
engine.globalEvent.addEventListener('recycling-stop', _this.stop, _this);
\r\n\t
var gameView = _this._gameView = new GameView();
\r\n\t
_this.addChild(gameView);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.updateSound = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.start();
\r\n\t
};
\r\n\t
GameWrapper.prototype.stop = function (event) {
\r\n\t
this._gameView.stop();
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\n\n\t
return index;
\n\n
})));
\n
"
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
\n\t
(global = global || self, global.recycling = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\r\n\t
function playSound(name) {
\r\n\t
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
\r\n\t
}
\r\n\t
function createSvga(name, anchorName) {
\r\n\t
var inst = new svga.Svga();
\r\n\t
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
\r\n\t
return inst;
\r\n\t
}
\
r\n\t
//# sourceMappingURL=utils.js.map
\n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\r\n\t
//# sourceMappingURL=props.js.map
\n\n\t
var Conveyor = (function (_super) {
\r\n\t
tslib.__extends(Conveyor, _super);
\r\n\t
function Conveyor() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.y = 904.21;
\r\n\t
var sp = new engine.Sprite(getTextureByName('conveyor'));
\r\n\t
_this.addChild(sp);
\r\n\t
_this.idx0 = _this.createItem(75, 50);
\r\n\t
_this.idx1 = _this.createItem(225, 50);
\r\n\t
_this.idx2 = _this.createItem(375, 50);
\r\n\t
_this.idx3 = _this.createItem(525, 50);
\r\n\t
_this.idx4 = _this.createItem(675, 50);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Conveyor.prototype.clear = function () {
\r\n\t
this.clearItem(this.idx0);
\r\n\t
this.clearItem(this.idx1);
\r\n\t
this.clearItem(this.idx2);
\r\n\t
this.clearItem(this.idx3);
\r\n\t
this.clearItem(this.idx4);
\r\n\t
};
\r\n\t
Conveyor.prototype.clearItem = function (idx) {
\r\n\t
if (idx.children.length > 0)
\r\n\t
idx.removeChildAt(0);
\r\n\t
};
\r\n\t
Conveyor.prototype.createItem = function (x, y) {
\r\n\t
var sp = new engine.Sprite();
\r\n\t
this.addChild(sp);
\r\n\t
sp.x = x;
\r\n\t
sp.y = y;
\r\n\t
return sp;
\r\n\t
};
\r\n\t
return Conveyor;
\r\n\t
}(engine.Sprite));
\r\n\t
//# sourceMappingURL=Conveyor.js.map
\n\n\t
var GarbageTypes;
\r\n\t
(function (GarbageTypes) {
\r\n\t
GarbageTypes[
\"
recoverableWaste
\"
] =
\"
recoverableWaste
\"
;
\r\n\t
GarbageTypes[
\"
harmfulWaste
\"
] =
\"
harmfulWaste
\"
;
\r\n\t
GarbageTypes[
\"
wetWaste
\"
] =
\"
wetWaste
\"
;
\r\n\t
GarbageTypes[
\"
dryWaste
\"
] =
\"
dryWaste
\"
;
\r\n\t
})(GarbageTypes || (GarbageTypes = {}));
\r\n\t
//# sourceMappingURL=GarbageTypes.js.map
\n\n\t
var GarbageConfig = (function () {
\r\n\t
function GarbageConfig() {
\r\n\t
}
\r\n\t
GarbageConfig.config = [
\r\n\t
{ name:
\"
保鲜盒
\"
, source:
\"
g00
\"
, type: GarbageTypes.recoverableWaste, width: 129, height: 111 },
\r\n\t
{ name:
\"
报纸
\"
, source:
\"
g01
\"
, type: GarbageTypes.recoverableWaste, width: 138, height: 144 },
\r\n\t
{ name:
\"
贝壳
\"
, source:
\"
g02
\"
, type: GarbageTypes.dryWaste, width: 79, height: 117 },
\r\n\t
{ name:
\"
冰箱
\"
, source:
\"
g03
\"
, type: GarbageTypes.recoverableWaste, width: 63, height: 151 },
\r\n\t
{ name:
\"
菜梗菜叶
\"
, source:
\"
g04
\"
, type: GarbageTypes.wetWaste, width: 144, height: 98 },
\r\n\t
{ name:
\"
残枝落叶
\"
, source:
\"
g05
\"
, type: GarbageTypes.wetWaste, width: 120, height: 99 },
\r\n\t
{ name:
\"
茶叶渣
\"
, source:
\"
g06
\"
, type: GarbageTypes.wetWaste, width: 86, height: 96 },
\r\n\t
{ name:
\"
尘土
\"
, source:
\"
g07
\"
, type: GarbageTypes.dryWaste, width: 109, height: 114 },
\r\n\t
{ name:
\"
创口贴
\"
, source:
\"
g08
\"
, type: GarbageTypes.dryWaste, width: 112, height: 90 },
\r\n\t
{ name:
\"
大骨头
\"
, source:
\"
g09
\"
, type: GarbageTypes.dryWaste, width: 89, height: 101 },
\r\n\t
{ name:
\"
普通干电池
\"
, source:
\"
g11
\"
, type: GarbageTypes.dryWaste, width: 89, height: 131 },
\r\n\t
{ name:
\"
方便面盒
\"
, source:
\"
g12
\"
, type: GarbageTypes.dryWaste, width: 89, height: 168 },
\r\n\t
{ name:
\"
废弃食用油脂
\"
, source:
\"
g13
\"
, type: GarbageTypes.wetWaste, width: 131, height: 164 },
\r\n\t
{ name:
\"
骨骼内脏
\"
, source:
\"
g14
\"
, type: GarbageTypes.wetWaste, width: 104, height: 82 },
\r\n\t
{ name:
\"
锅具
\"
, source:
\"
g15
\"
, type: GarbageTypes.recoverableWaste, width: 119, height: 149 },
\r\n\t
{ name:
\"
果核
\"
, source:
\"
g16
\"
, type: GarbageTypes.wetWaste, width: 99, height: 95 },
\r\n\t
{ name:
\"
果皮
\"
, source:
\"
g17
\"
, type: GarbageTypes.wetWaste, width: 115, height: 127 },
\r\n\t
{ name:
\"
化妆品
\"
, source:
\"
g18
\"
, type: GarbageTypes.dryWaste, width: 67, height: 151 },
\r\n\t
{ name:
\"
鸡蛋壳
\"
, source:
\"
g19
\"
, type: GarbageTypes.wetWaste, width: 99, height: 107 },
\r\n\t
{ name:
\"
剪刀
\"
, source:
\"
g20
\"
, type: GarbageTypes.recoverableWaste, width: 96, height: 127 },
\r\n\t
{ name:
\"
胶带
\"
, source:
\"
g21
\"
, type: GarbageTypes.dryWaste, width: 87, height: 113 },
\r\n\t
{ name:
\"
榴莲壳
\"
, source:
\"
g22
\"
, type: GarbageTypes.dryWaste, width: 136, height: 116 },
\r\n\t
{ name:
\"
毛巾
\"
, source:
\"
g23
\"
, type: GarbageTypes.recoverableWaste, width: 108, height: 96 },
\r\n\t
{ name:
\"
纽扣电池
\"
, source:
\"
g24
\"
, type: GarbageTypes.harmfulWaste, width: 87, height: 89 },
\r\n\t
{ name:
\"
破旧陶瓷罐
\"
, source:
\"
g25
\"
, type: GarbageTypes.dryWaste, width: 110, height: 125 },
\r\n\t
{ name:
\"
杀虫剂
\"
, source:
\"
g26
\"
, type: GarbageTypes.harmfulWaste, width: 64, height: 160 },
\r\n\t
{ name:
\"
剩菜剩饭
\"
, source:
\"
g27
\"
, type: GarbageTypes.wetWaste, width: 128, height: 96 },
\r\n\t
{ name:
\"
手机
\"
, source:
\"
g28
\"
, type: GarbageTypes.recoverableWaste, width: 82, height: 142 },
\r\n\t
{ name:
\"
书本
\"
, source:
\"
g29
\"
, type: GarbageTypes.recoverableWaste, width: 106, height: 132 },
\r\n\t
{ name:
\"
玻璃杯
\"
, source:
\"
g30
\"
, type: GarbageTypes.recoverableWaste, width: 62, height: 119 },
\r\n\t
{ name:
\"
水银温度计
\"
, source:
\"
g31
\"
, type: GarbageTypes.harmfulWaste, width: 109, height: 162 },
\r\n\t
{ name:
\"
水银血压计
\"
, source:
\"
g32
\"
, type: GarbageTypes.harmfulWaste, width: 115, height: 147 },
\r\n\t
{ name:
\"
塑料桶
\"
, source:
\"
g33
\"
, type: GarbageTypes.recoverableWaste, width: 92, height: 131 },
\r\n\t
{ name:
\"
卫生纸
\"
, source:
\"
g34
\"
, type: GarbageTypes.dryWaste, width: 92, height: 132 },
\r\n\t
{ name:
\"
污染织物
\"
, source:
\"
g35
\"
, type: GarbageTypes.dryWaste, width: 128, height: 139 },
\r\n\t
{ name:
\"
污染纸张
\"
, source:
\"
g36
\"
, type: GarbageTypes.dryWaste, width: 96, height: 136 },
\r\n\t
{ name:
\"
洗衣机
\"
, source:
\"
g37
\"
, type: GarbageTypes.recoverableWaste, width: 87, height: 157 },
\r\n\t
{ name:
\"
烟蒂
\"
, source:
\"
g38
\"
, type: GarbageTypes.dryWaste, width: 87, height: 124 },
\r\n\t
{ name:
\"
药品
\"
, source:
\"
g39
\"
, type: GarbageTypes.harmfulWaste, width: 109, height: 131 },
\r\n\t
{ name:
\"
药品包装
\"
, source:
\"
g40
\"
, type: GarbageTypes.harmfulWaste, width: 108, height: 125 },
\r\n\t
{ name:
\"
椰子壳
\"
, source:
\"
g41
\"
, type: GarbageTypes.dryWaste, width: 104, height: 119 },
\r\n\t
{ name:
\"
衣服
\"
, source:
\"
g42
\"
, type: GarbageTypes.recoverableWaste, width: 83, height: 137 },
\r\n\t
{ name:
\"
衣架
\"
, source:
\"
g43
\"
, type: GarbageTypes.recoverableWaste, width: 132, height: 125 },
\r\n\t
{ name:
\"
易拉罐
\"
, source:
\"
g44
\"
, type: GarbageTypes.recoverableWaste, width: 65, height: 133 },
\r\n\t
{ name:
\"
荧光灯
\"
, source:
\"
g45
\"
, type: GarbageTypes.harmfulWaste, width: 90, height: 118 },
\r\n\t
{ name:
\"
油漆桶
\"
, source:
\"
g46
\"
, type: GarbageTypes.harmfulWaste, width: 65, height: 143 },
\r\n\t
{ name:
\"
一次性纸杯
\"
, source:
\"
g47
\"
, type: GarbageTypes.dryWaste, width: 76, height: 116 },
\r\n\t
{ name:
\"
纸尿裤
\"
, source:
\"
g48
\"
, type: GarbageTypes.dryWaste, width: 93, height: 138 },
\r\n\t
{ name:
\"
纸箱
\"
, source:
\"
g49
\"
, type: GarbageTypes.recoverableWaste, width: 112, height: 118 },
\r\n\t
{ name:
\"
指甲油
\"
, source:
\"
g50
\"
, type: GarbageTypes.harmfulWaste, width: 64, height: 138 },
\r\n\t
];
\r\n\t
return GarbageConfig;
\r\n\t
}());
\r\n\t
//# sourceMappingURL=GarbageConfig.js.map
\n\n\t
var transStores = (function (list) {
\r\n\t
var tmp = [];
\r\n\t
var contains = function (val) {
\r\n\t
for (var _i = 0, tmp_1 = tmp; _i < tmp_1.length; _i++) {
\r\n\t
var i = tmp_1[_i];
\r\n\t
if (val.targetType == i.targetType && val.itemType == i.itemType && val.itemName == i.itemName)
\r\n\t
return true;
\r\n\t
}
\r\n\t
return false;
\r\n\t
};
\r\n\t
list.forEach(function (i) {
\r\n\t
if (!contains(i))
\r\n\t
tmp.push(i);
\r\n\t
});
\r\n\t
list = tmp;
\r\n\t
tmp = [];
\r\n\t
var nameList = [];
\r\n\t
var contains2 = function (val) {
\r\n\t
for (var _i = 0, tmp_2 = tmp; _i < tmp_2.length; _i++) {
\r\n\t
var i = tmp_2[_i];
\r\n\t
if (val.itemName == i.itemName) {
\r\n\t
nameList.push(i.itemName);
\r\n\t
return true;
\r\n\t
}
\r\n\t
}
\r\n\t
return false;
\r\n\t
};
\r\n\t
list.forEach(function (i) {
\r\n\t
if (!contains2(i))
\r\n\t
tmp.push(i);
\r\n\t
});
\r\n\t
list = tmp;
\r\n\t
list.forEach(function (i) {
\r\n\t
if (nameList.indexOf(i.itemName) != -1) {
\r\n\t
i.targetType = i.itemType;
\r\n\t
}
\r\n\t
});
\r\n\t
return list.map(function (i) {
\r\n\t
return {
\r\n\t
'targetName': getTargetName(i.targetType),
\r\n\t
'isCorrect': i.targetType == i.itemType,
\r\n\t
'itemName': i.itemName,
\r\n\t
'itemTypeName': getTargetName(i.itemType)
\r\n\t
};
\r\n\t
});
\r\n\t
});
\r\n\t
var getTargetName = function (type) {
\r\n\t
switch (type) {
\r\n\t
case GarbageTypes.recoverableWaste:
\r\n\t
return '可回收物';
\r\n\t
case GarbageTypes.harmfulWaste:
\r\n\t
return '有害垃圾';
\r\n\t
case GarbageTypes.wetWaste:
\r\n\t
return '厨余垃圾';
\r\n\t
case GarbageTypes.dryWaste:
\r\n\t
return '其他垃圾';
\r\n\t
}
\r\n\t
};
\r\n\t
//# sourceMappingURL=transStores.js.map
\n\n\t
var checkHit = (function (view, rect) {
\r\n\t
var x = view.x, y = view.y;
\r\n\t
var _a = view.texture, width = _a.width, height = _a.height;
\r\n\t
if (x > rect.x && y > rect.y && (x + width) < (rect.x + rect.width) && (y + height) < (rect.y + rect.height)) {
\r\n\t
return true;
\r\n\t
}
\r\n\t
return false;
\r\n\t
});
\r\n\t
//# sourceMappingURL=checkHit.js.map
\n\n\t
var removeChild = (function (d) {
\r\n\t
if (d && d.parent) {
\r\n\t
d.parent.removeChild(d);
\r\n\t
}
\r\n\t
});
\r\n\t
//# sourceMappingURL=removeChild.js.map
\n\n\t
var removeEle = (function (e, arr) {
\r\n\t
var index = arr.indexOf(e);
\r\n\t
if (index >= 0) {
\r\n\t
arr.splice(index, 1);
\r\n\t
}
\r\n\t
});
\r\n\t
//# sourceMappingURL=removeEle.js.map
\n\n\t
var shuffle = (function (arr) {
\r\n\t
var _a;
\r\n\t
var i = arr.length;
\r\n\t
while (i) {
\r\n\t
var j = Math.floor(Math.random() * i--);
\r\n\t
_a = [arr[i], arr[j]], arr[j] = _a[0], arr[i] = _a[1];
\r\n\t
}
\r\n\t
return arr;
\r\n\t
});
\r\n\t
//# sourceMappingURL=shuffle.js.map
\n\n\t
var WrongTips = (function (_super) {
\r\n\t
tslib.__extends(WrongTips, _super);
\r\n\t
function WrongTips() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.img = new engine.Image();
\r\n\t
_this.img.texture = getTextureByName('wrongTips');
\r\n\t
_this.addChild(_this.img);
\r\n\t
_this.img.anchorX = 88 / 2;
\r\n\t
_this.img.anchorY = 85 / 2;
\r\n\t
_this.visible = false;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
WrongTips.prototype.play = function (rect) {
\r\n\t
this.visible = true;
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
wrongTipsMp3
\"
);
\r\n\t
}
\r\n\t
var dur = 70;
\r\n\t
var stren = 20;
\r\n\t
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 })
\r\n\t
.to({ x: stren }, dur)
\r\n\t
.to({ x: 0 }, dur)
\r\n\t
.to({ x: -stren }, dur)
\r\n\t
.to({ x: 0 }, dur)
\r\n\t
.wait(200)
\r\n\t
.to({ alpha: 0 }, 300);
\r\n\t
this.x = rect.x + 180;
\r\n\t
this.y = rect.y;
\r\n\t
};
\r\n\t
return WrongTips;
\r\n\t
}(engine.Sprite));
\r\n\t
var getTargetRect = function (targetType, gameview) {
\r\n\t
switch (targetType) {
\r\n\t
case GarbageTypes.dryWaste:
\r\n\t
return gameview.dryWaste;
\r\n\t
case GarbageTypes.wetWaste:
\r\n\t
return gameview.wetWaste;
\r\n\t
case GarbageTypes.harmfulWaste:
\r\n\t
return gameview.harmfulWaste;
\r\n\t
case GarbageTypes.recoverableWaste:
\r\n\t
return gameview.recoverableWaste;
\r\n\t
}
\r\n\t
};
\r\n\t
//# sourceMappingURL=WrongTips.js.map
\n\n\t
var Conveyors = (function (_super) {
\r\n\t
tslib.__extends(Conveyors, _super);
\r\n\t
function Conveyors(p) {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.conveyorsPool = [];
\r\n\t
_this.GarbageConfig = GarbageConfig.config;
\r\n\t
_this.datas = [];
\r\n\t
_this.wrapper = p;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Conveyors.prototype.initData = function (conveyor0, conveyor1) {
\r\n\t
this.conveyor0 = conveyor0;
\r\n\t
this.conveyor1 = conveyor1;
\r\n\t
};
\r\n\t
Conveyors.prototype.setDefault = function () {
\r\n\t
this.score = 0;
\r\n\t
this.conveyorsPool.push(this.conveyor0);
\r\n\t
this.conveyorsPool.push(this.conveyor1);
\r\n\t
var allConfigs = shuffle(this.GarbageConfig.concat([]));
\r\n\t
for (var i = 0; i < GarbageConfig.config.length; i++) {
\r\n\t
allConfigs[i].idx = i;
\r\n\t
allConfigs[i].isRight = false;
\r\n\t
allConfigs[i].isMistake = false;
\r\n\t
allConfigs[i].isOnStage = false;
\r\n\t
this.datas.push(allConfigs[i]);
\r\n\t
}
\r\n\t
for (var i = 0; i < 5; i++) {
\r\n\t
var data = this.datas[i];
\r\n\t
var view = new engine.Sprite(getTextureByName(data.source));
\r\n\t
view.isWrong = false;
\r\n\t
view.isRight = false;
\r\n\t
data.isOnStage = true;
\r\n\t
view.data = data;
\r\n\t
view.type = data.type;
\r\n\t
view.name = data.name;
\r\n\t
view.anchorX = data.width / 2;
\r\n\t
view.anchorY = data.height;
\r\n\t
view.x = -data.width / 2;
\r\n\t
view.y = -data.height + 40;
\r\n\t
this.conveyor1[
\"
idx
\"
+ i].addChild(view);
\r\n\t
view.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown_garbage, this);
\r\n\t
}
\r\n\t
};
\r\n\t
Conveyors.prototype.startConveyors = function () {
\r\n\t
this.setDefault();
\r\n\t
engine.gameStage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
\r\n\t
};
\r\n\t
Conveyors.prototype.onEnterFrame = function (ENTER_FRAME, onEnterFrame, arg2) {
\r\n\t
if (this.score == (props.maxScore || 100)) {
\r\n\t
this.gameOver();
\r\n\t
this.wrapper.stop();
\r\n\t
if (props.sound)
\r\n\t
playSound(
\"
gameOverMp3
\"
);
\r\n\t
}
\r\n\t
this.conveyorsPool.forEach(function (conveyor) {
\r\n\t
conveyor.x -= props.speed || 3;
\r\n\t
});
\r\n\t
if (this.conveyorsPool[this.conveyorsPool.length - 1].x <= 764) {
\r\n\t
var conveyor = new Conveyor();
\r\n\t
conveyor.x = this.conveyorsPool[this.conveyorsPool.length - 1].x + 764;
\r\n\t
this.wrapper.addChild(conveyor);
\r\n\t
this.conveyorsPool.push(conveyor);
\r\n\t
}
\r\n\t
else {
\r\n\t
var dataList = [];
\r\n\t
for (var n = 0; n < this.datas.length; n++) {
\r\n\t
var dataItem = this.datas[n];
\r\n\t
if (!dataItem.isRight && !dataItem.isOnStage) {
\r\n\t
dataList.push(dataItem);
\r\n\t
}
\r\n\t
}
\r\n\t
var lastConveyor = this.conveyorsPool[this.conveyorsPool.length - 1];
\r\n\t
for (var m = 0; m < 5; m++) {
\r\n\t
if (!lastConveyor[
\"
idx
\"
+ m].children[0]) {
\r\n\t
var data = dataList.shift();
\r\n\t
if (data) {
\r\n\t
data.isOnStage = true;
\r\n\t
var view = new engine.Sprite(getTextureByName(data.source));
\r\n\t
view.data = data;
\r\n\t
view.isWrong = false;
\r\n\t
view.isRight = false;
\r\n\t
view.type = data.type;
\r\n\t
view.name = data.name;
\r\n\t
view.anchorX = data.width / 2;
\r\n\t
view.anchorY = data.height;
\r\n\t
view.x = -data.width / 2;
\r\n\t
view.y = -data.height + 40;
\r\n\t
lastConveyor[
\"
idx
\"
+ m].addChild(view);
\r\n\t
view.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown_garbage, this);
\r\n\t
}
\r\n\t
else {
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
if (this.conveyorsPool[0].x < -750) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx4 = this.conveyorsPool[0][
\"
idx
\"
+ 4];
\r\n\t
if (idx4.children[0]) {
\r\n\t
if (dataItem.name == idx4.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx4.removeChild(idx4.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
this.conveyorsPool.shift();
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -600) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx3 = this.conveyorsPool[0][
\"
idx
\"
+ 3];
\r\n\t
if (idx3.children[0]) {
\r\n\t
if (dataItem.name == idx3.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx3.removeChild(idx3.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -450) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx2 = this.conveyorsPool[0][
\"
idx
\"
+ 2];
\r\n\t
if (idx2.children[0]) {
\r\n\t
if (dataItem.name == idx2.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx2.removeChild(idx2.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -300) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx1 = this.conveyorsPool[0][
\"
idx
\"
+ 1];
\r\n\t
if (idx1.children[0]) {
\r\n\t
if (dataItem.name == idx1.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx1.removeChild(idx1.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
else if (this.conveyorsPool[0].x < -150) {
\r\n\t
for (var k = 0; k < this.datas.length; k++) {
\r\n\t
var dataItem = this.datas[k];
\r\n\t
var idx0 = this.conveyorsPool[0][
\"
idx
\"
+ 0];
\r\n\t
if (idx0.children[0]) {
\r\n\t
if (dataItem.name == idx0.children[0].name) {
\r\n\t
dataItem.isOnStage = false;
\r\n\t
removeEle(dataItem, this.datas);
\r\n\t
this.datas.push(dataItem);
\r\n\t
idx0.removeChild(idx0.children[0]);
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
Conveyors.prototype.addscore = function () {
\r\n\t
this.score += (props.onceScore || 2);
\r\n\t
engine.globalEvent.dispatchEvent('recycling-score-update', {
\r\n\t
score: this.score
\r\n\t
});
\r\n\t
};
\r\n\t
Conveyors.prototype.gameOver = function () {
\r\n\t
engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
\r\n\t
engine.globalEvent.dispatchEvent('recycling-game-end', transStores(this.stores));
\r\n\t
};
\r\n\t
Conveyors.prototype.onDown_garbage = function (e) {
\r\n\t
if (this._currentDragView) {
\r\n\t
removeChild(this._currentDragView);
\r\n\t
}
\r\n\t
var target = e.target;
\r\n\t
var view = new engine.Sprite(target.texture);
\r\n\t
this._currentDragView = view;
\r\n\t
this._currentTarget = target;
\r\n\t
target.scaleX = target.scaleY = 0;
\r\n\t
this.wrapper.addChild(view);
\r\n\t
view.x = e.stageX - target.texture.width / 2;
\r\n\t
view.y = e.stageY - target.texture.height / 2;
\r\n\t
view.type = target['type'];
\r\n\t
view.name = target['name'];
\r\n\t
this.wrapper.addEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this);
\r\n\t
this.wrapper.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this);
\r\n\t
};
\r\n\t
Conveyors.prototype.onStageMouseMove = function (e) {
\r\n\t
var view = this._currentDragView;
\r\n\t
view.x = e.stageX - view.texture.width / 2;
\r\n\t
view.y = e.stageY - view.texture.height / 2;
\r\n\t
};
\r\n\t
Conveyors.prototype.onStageMouseUp = function (e) {
\r\n\t
var _this = this;
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this);
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this);
\r\n\t
if (!this._currentDragView)
\r\n\t
return;
\r\n\t
var result = this.checkHitRect();
\r\n\t
if (result) {
\r\n\t
if (result == this._currentDragView['type']) {
\r\n\t
this.addscore();
\r\n\t
this.wrapper.rightTips.play(getTargetRect(result, this.wrapper));
\r\n\t
this._currentTarget.data.isRight = true;
\r\n\t
}
\r\n\t
else {
\r\n\t
engine.Tween.get(this._currentTarget).to({ scaleX: 1, scaleY: 1 }, 300).call(function () { });
\r\n\t
this.wrapper.wrongTips.play(getTargetRect(result, this.wrapper));
\r\n\t
}
\r\n\t
this.stores.push({ targetType: result, itemType: this._currentDragView['type'], itemName: this._currentDragView['name'] });
\r\n\t
}
\r\n\t
else {
\r\n\t
engine.Tween.get(this._currentTarget).to({ scaleX: 1, scaleY: 1 }, 300).call(function () { });
\r\n\t
}
\r\n\t
this._currentDragView.anchorX = this._currentDragView.texture.width / 2;
\r\n\t
this._currentDragView.anchorY = this._currentDragView.texture.height / 2;
\r\n\t
engine.Tween.get(this._currentDragView).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {
\r\n\t
removeChild(_this._currentDragView);
\r\n\t
});
\r\n\t
};
\r\n\t
Conveyors.prototype.clear = function () {
\r\n\t
this.conveyor0.x = 0;
\r\n\t
this.conveyor1.x = 764;
\r\n\t
this.conveyorsPool.forEach(function (i) {
\r\n\t
i.clear();
\r\n\t
});
\r\n\t
this.conveyorsPool = [];
\r\n\t
this.datas = [];
\r\n\t
this.stores = [];
\r\n\t
};
\r\n\t
Conveyors.prototype.timeout = function () {
\r\n\t
if (this._currentDragView) {
\r\n\t
removeChild(this._currentDragView);
\r\n\t
}
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this);
\r\n\t
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this);
\r\n\t
this.gameOver();
\r\n\t
};
\r\n\t
Conveyors.prototype.checkHitRect = function () {
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.wetWaste)) {
\r\n\t
return GarbageTypes.wetWaste;
\r\n\t
}
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.harmfulWaste)) {
\r\n\t
return GarbageTypes.harmfulWaste;
\r\n\t
}
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.dryWaste)) {
\r\n\t
return GarbageTypes.dryWaste;
\r\n\t
}
\r\n\t
if (checkHit(this._currentDragView, this.wrapper.recoverableWaste)) {
\r\n\t
return GarbageTypes.recoverableWaste;
\r\n\t
}
\r\n\t
return null;
\r\n\t
};
\r\n\t
return Conveyors;
\r\n\t
}(engine.Sprite));
\r\n\t
//# sourceMappingURL=Conveyors.js.map
\n\n\t
var uiConfig = (function () {
\r\n\t
return [
\r\n\t
{
\r\n\t
id: 'playBg',
\r\n\t
texture: 'playBg'
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler0',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [75, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler1',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [175, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler2',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [275, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler3',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [375, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler4',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [475, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler5',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [575, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
{
\r\n\t
id: 'idler6',
\r\n\t
texture: 'idlerWheel',
\r\n\t
pos: [675, 1038],
\r\n\t
anchor: [20, 21.5]
\r\n\t
},
\r\n\t
];
\r\n\t
});
\r\n\t
//# sourceMappingURL=uiConfig.js.map
\n\n\t
var setGuide = function () {
\r\n\t
try {
\r\n\t
if (window.localStorage && window.localStorage.setItem) {
\r\n\t
localStorage.setItem('recyclingGuide', '1');
\r\n\t
}
\r\n\t
}
\r\n\t
catch (e) {
\r\n\t
console.log(
\"
setguide--err
\"
, e);
\r\n\t
}
\r\n\t
};
\r\n\t
//# sourceMappingURL=getGuideInfo.js.map
\n\n\t
var createBg = (function (a) {
\r\n\t
if (a === void 0) { a = 1; }
\r\n\t
var rect = new engine.Graphics();
\r\n\t
rect.beginFill(0);
\r\n\t
rect.drawRect(0, 0, 750, 1624);
\r\n\t
rect.endFill();
\r\n\t
rect.alpha = a;
\r\n\t
return rect;
\r\n\t
});
\r\n\t
//# sourceMappingURL=createBg.js.map
\n\n\t
var createImg = (function (texture) {
\r\n\t
return new engine.Sprite(getTextureByName(texture));
\r\n\t
});
\r\n\t
//# sourceMappingURL=createImg.js.map
\n\n\t
var CountDownGroup = (function (_super) {
\r\n\t
tslib.__extends(CountDownGroup, _super);
\r\n\t
function CountDownGroup() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.addChild(createBg(.6));
\r\n\t
_this.num1 = createImg('num1');
\r\n\t
_this.num2 = createImg('num2');
\r\n\t
_this.num3 = createImg('num3');
\r\n\t
_this.go = createImg('go');
\r\n\t
_this.go.anchorX = 240;
\r\n\t
_this.go.anchorY = 171.5;
\r\n\t
_this.num1.anchorX = 125.5;
\r\n\t
_this.num1.anchorY = 189;
\r\n\t
_this.num2.anchorX = 149.5;
\r\n\t
_this.num2.anchorY = 191.5;
\r\n\t
_this.num3.anchorX = 148.5;
\r\n\t
_this.num3.anchorY = 191.5;
\r\n\t
_this.go.x = 750 / 2 - 240;
\r\n\t
_this.go.y = 525 - 171.5;
\r\n\t
_this.num1.x = 750 / 2 - 125.5;
\r\n\t
_this.num1.y = 529 - 189;
\r\n\t
_this.num2.x = 750 / 2 - 149.5;
\r\n\t
_this.num2.y = 526 - 191.5;
\r\n\t
_this.num3.x = 750 / 2 - 148.5;
\r\n\t
_this.num3.y = 525 - 191.5;
\r\n\t
_this.addChild(_this.num1);
\r\n\t
_this.addChild(_this.num2);
\r\n\t
_this.addChild(_this.num3);
\r\n\t
_this.addChild(_this.go);
\r\n\t
_this.visible = false;
\r\n\t
_this.reset();
\r\n\t
return _this;
\r\n\t
}
\r\n\t
CountDownGroup.prototype.reset = function () {
\r\n\t
this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;
\r\n\t
this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;
\r\n\t
this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;
\r\n\t
};
\r\n\t
CountDownGroup.prototype.startCountDown = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
return [2, new Promise(function (r) {
\r\n\t
_this.reset();
\r\n\t
_this.visible = true;
\r\n\t
_this.num3.alpha = 1;
\r\n\t
var n3 = engine.Tween.get(_this.num3);
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
numCountDown
\"
);
\r\n\t
}
\r\n\t
n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
\r\n\t
_this.num2.alpha = 1;
\r\n\t
var n2 = engine.Tween.get(_this.num2);
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
numCountDown
\"
);
\r\n\t
}
\r\n\t
n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
\r\n\t
_this.num1.alpha = 1;
\r\n\t
var n1 = engine.Tween.get(_this.num1);
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
numCountDown
\"
);
\r\n\t
}
\r\n\t
n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
\r\n\t
_this.go.alpha = 1;
\r\n\t
var go = engine.Tween.get(_this.go);
\r\n\t
if (props.sound) {
\r\n\t
if (props.sound)
\r\n\t
playSound(
\"
goMp3
\"
);
\r\n\t
}
\r\n\t
go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(function () {
\r\n\t
_this.visible = false;
\r\n\t
r();
\r\n\t
});
\r\n\t
});
\r\n\t
});
\r\n\t
});
\r\n\t
})];
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
return CountDownGroup;
\r\n\t
}(engine.Sprite));
\r\n\t
//# sourceMappingURL=CountDownGroup.js.map
\n\n\t
var GuideView = (function (_super) {
\r\n\t
tslib.__extends(GuideView, _super);
\r\n\t
function GuideView() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.initUI();
\r\n\t
_this.visible = false;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GuideView.prototype.initUI = function () {
\r\n\t
this.addChild(createBg(.6));
\r\n\t
this.guideBg = createImg('guideBg');
\r\n\t
this.addChild(this.guideBg);
\r\n\t
this.guideEle = createImg('guideEle');
\r\n\t
this.addChild(this.guideEle);
\r\n\t
this.guideBg.x = 403;
\r\n\t
this.guideBg.y = 565;
\r\n\t
this.guideEle.x = 361;
\r\n\t
this.guideEle.y = 877;
\r\n\t
this.guideEle.anchorX = 14;
\r\n\t
this.guideEle.anchorY = 88;
\r\n\t
this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;
\r\n\t
var svga = createSvga(
\"
guideTips
\"
);
\r\n\t
this.svga = svga;
\r\n\t
this.addChild(svga);
\r\n\t
svga.gotoAndStop(1);
\r\n\t
svga.mouseEnabled = svga.mouseChildren = false;
\r\n\t
};
\r\n\t
GuideView.prototype.checkHit = function (x, y, w, h) {
\r\n\t
var rect = new engine.Rectangle(403, 565, 252, 297);
\r\n\t
if (x > rect.x && y > rect.y && (x + w) < (rect.x + rect.width) && (y + h) < (rect.y + rect.height)) {
\r\n\t
return true;
\r\n\t
}
\r\n\t
return false;
\r\n\t
};
\r\n\t
GuideView.prototype.startGuide = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
return [2, new Promise(function (r) {
\r\n\t
_this.visible = true;
\r\n\t
_this.svga.gotoAndStop(1);
\r\n\t
_this.svga.play(false, true);
\r\n\t
_this.guideEle.scaleX = 1;
\r\n\t
_this.guideEle.scaleY = 1;
\r\n\t
var offset = [0, 0];
\r\n\t
var guideOver = function () {
\r\n\t
_this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
\r\n\t
_this.guideEle.anchorX = 14;
\r\n\t
_this.guideEle.anchorY = 44;
\r\n\t
engine.Tween.get(_this.guideEle).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {
\r\n\t
_this.visible = false;
\r\n\t
r();
\r\n\t
});
\r\n\t
};
\r\n\t
var onUp = function (e) {
\r\n\t
_this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);
\r\n\t
if (_this.checkHit(_this.guideEle.x, _this.guideEle.y, _this.guideEle.width, _this.guideEle.height)) {
\r\n\t
guideOver();
\r\n\t
}
\r\n\t
else {
\r\n\t
_this.svga.visible = true;
\r\n\t
_this.guideEle.x = 361;
\r\n\t
_this.guideEle.y = 877;
\r\n\t
engine.Tween.get(_this.guideEle).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1, scaleY: 1 }, 300);
\r\n\t
}
\r\n\t
};
\r\n\t
var onMove = function (e) {
\r\n\t
_this.guideEle.x = e.stageX - offset[0];
\r\n\t
_this.guideEle.y = e.stageY - offset[1];
\r\n\t
};
\r\n\t
var ondown = function (e) {
\r\n\t
offset = [e.localX, e.localY];
\r\n\t
_this.svga.visible = false;
\r\n\t
_this.stage.once(engine.MouseEvent.MOUSE_UP, onUp, _this);
\r\n\t
_this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);
\r\n\t
};
\r\n\t
_this.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
\r\n\t
})];
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
return GuideView;
\r\n\t
}(engine.Sprite));
\r\n\t
//# sourceMappingURL=guideView.js.map
\n\n\t
var RightTips = (function (_super) {
\r\n\t
tslib.__extends(RightTips, _super);
\r\n\t
function RightTips() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.SCORE = props.onceScore || 2;
\r\n\t
_this.img = new engine.Image();
\r\n\t
_this.img.texture = getTextureByName('rightTips');
\r\n\t
_this.addChild(_this.img);
\r\n\t
_this.img.anchorX = 88 / 2;
\r\n\t
_this.img.anchorY = 85 / 2;
\r\n\t
_this.visible = false;
\r\n\t
_this.txt = new engine.TextField();
\r\n\t
_this.addChild(_this.txt);
\r\n\t
_this.txt.text = '+' + _this.SCORE;
\r\n\t
_this.txt.size = 60;
\r\n\t
_this.txt.fillColor = '#437726';
\r\n\t
engine.playSound;
\r\n\t
return _this;
\r\n\t
}
\r\n\t
RightTips.prototype.play = function (rect) {
\r\n\t
if (props.sound) {
\r\n\t
playSound(
\"
rightTipsSound
\"
);
\r\n\t
}
\r\n\t
this.visible = true;
\r\n\t
this.txt.x = 100;
\r\n\t
engine.Tween.get(this.txt).set({ y: 60, alpha: 1 })
\r\n\t
.to({ y: -50 }, 500)
\r\n\t
.to({ alpha: 0 });
\r\n\t
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 0, scaleY: 0, alpha: 1 })
\r\n\t
.to({ scaleX: 1, scaleY: 1 }, 200, engine.Ease.getBackOut(1))
\r\n\t
.wait(200)
\r\n\t
.to({ alpha: 0 }, 300);
\r\n\t
this.x = rect.x + 180;
\r\n\t
this.y = rect.y;
\r\n\t
};
\r\n\t
return RightTips;
\r\n\t
}(engine.Sprite));
\r\n\t
//# sourceMappingURL=RightTips.js.map
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this._timeCounter = 0;
\r\n\t
_this.guidenew = false;
\r\n\t
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameView.prototype.configUI = function () {
\r\n\t
var uiMap = {};
\r\n\t
this.uiMap = uiMap;
\r\n\t
var config = uiConfig();
\r\n\t
for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {
\r\n\t
var item = config_1[_i];
\r\n\t
var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;
\r\n\t
var sp = new engine.Sprite(getTextureByName(texture));
\r\n\t
this.addChild(sp);
\r\n\t
uiMap[id] = sp;
\r\n\t
if (anchor) {
\r\n\t
sp.anchorX = anchor[0];
\r\n\t
sp.anchorY = anchor[1];
\r\n\t
}
\r\n\t
if (pos) {
\r\n\t
sp.x = pos[0];
\r\n\t
sp.y = pos[1];
\r\n\t
if (anchor) {
\r\n\t
sp.x = pos[0] - sp.anchorX;
\r\n\t
sp.y = pos[1] - sp.anchorY;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
this.configConveyors();
\r\n\t
this.createRects();
\r\n\t
this.countdown = new CountDownGroup();
\r\n\t
this.addChild(this.countdown);
\r\n\t
this.guide = new GuideView();
\r\n\t
this.addChild(this.guide);
\r\n\t
this.wrongTips = new WrongTips();
\r\n\t
this.rightTips = new RightTips();
\r\n\t
this.addChild(this.wrongTips);
\r\n\t
this.addChild(this.rightTips);
\r\n\t
};
\r\n\t
GameView.prototype.createRects = function () {
\r\n\t
this.wetWaste = this.createRect(104, 565, 252, 297, 0xffffff);
\r\n\t
this.harmfulWaste = this.createRect(104, 232, 252, 297, 0xff0000);
\r\n\t
this.dryWaste = this.createRect(403, 232, 252, 297, 0x000000);
\r\n\t
this.recoverableWaste = this.createRect(403, 565, 252, 297, 0x0000ff);
\r\n\t
};
\r\n\t
GameView.prototype.createRect = function (x, y, w, h, c) {
\r\n\t
var rect = new engine.Rectangle(x, y, w, h);
\r\n\t
var sp = new engine.Sprite();
\r\n\t
this.addChild(sp);
\r\n\t
sp.x = x;
\r\n\t
sp.y = y;
\r\n\t
var g = new engine.Graphics;
\r\n\t
g.alpha = 0.0;
\r\n\t
g.beginFill(c);
\r\n\t
g.drawRect(0, 0, w, h);
\r\n\t
g.endFill();
\r\n\t
sp.addChild(g);
\r\n\t
return rect;
\r\n\t
};
\r\n\t
GameView.prototype.configConveyors = function () {
\r\n\t
var conveyor0 = new Conveyor();
\r\n\t
var conveyor1 = new Conveyor();
\r\n\t
this.addChild(conveyor0);
\r\n\t
this.addChild(conveyor1);
\r\n\t
conveyor0.x = 0;
\r\n\t
conveyor1.x = 764;
\r\n\t
this.conveyors = new Conveyors(this);
\r\n\t
this.conveyors.initData(conveyor0, conveyor1);
\r\n\t
};
\r\n\t
GameView.prototype.playAni = function () {
\r\n\t
var _this = this;
\r\n\t
var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
\r\n\t
idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });
\r\n\t
idlerWheels.forEach(function (i) {
\r\n\t
engine.Tween.get(i, { loop: true }).to({ rotation: -360 }, 1000);
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.stopAni = function () {
\r\n\t
var _this = this;
\r\n\t
var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
\r\n\t
idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });
\r\n\t
idlerWheels.forEach(function (i) {
\r\n\t
engine.Tween.removeTweens(i);
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.start = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
switch (_a.label) {
\r\n\t
case 0:
\r\n\t
this._timeCounter = 0;
\r\n\t
if (!(!props.isNewPlayer && !this.guidenew)) return [3, 2];
\r\n\t
return [4, this.guide.startGuide()];
\r\n\t
case 1:
\r\n\t
_a.sent();
\r\n\t
setGuide();
\r\n\t
this.guidenew = true;
\r\n\t
_a.label = 2;
\r\n\t
case 2:
\r\n\t
this.conveyors.clear();
\r\n\t
return [4, this.countdown.startCountDown()];
\r\n\t
case 3:
\r\n\t
_a.sent();
\r\n\t
this.startGame();
\r\n\t
engine.globalEvent.dispatchEvent('recycling-time-update', {
\r\n\t
second: this.getSecond(),
\r\n\t
});
\r\n\t
this._timer = setInterval(function () {
\r\n\t
_this.onTimer();
\r\n\t
}, 1000);
\r\n\t
return [2];
\r\n\t
}
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.startGame = function () {
\r\n\t
this.playAni();
\r\n\t
this.conveyors.startConveyors();
\r\n\t
};
\r\n\t
GameView.prototype.stopGame = function () {
\r\n\t
this.stopAni();
\r\n\t
};
\r\n\t
GameView.prototype.getSecond = function () {
\r\n\t
return props.time - this._timeCounter;
\r\n\t
};
\r\n\t
GameView.prototype.onTimer = function () {
\r\n\t
this._timeCounter++;
\r\n\t
engine.globalEvent.dispatchEvent('recycling-time-update', {
\r\n\t
second: this.getSecond(),
\r\n\t
});
\r\n\t
if (this.getSecond() == 0) {
\r\n\t
this.stop();
\r\n\t
this.conveyors.timeout();
\r\n\t
if (props.sound)
\r\n\t
playSound(
\"
gameOverMp3
\"
);
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.stop = function () {
\r\n\t
clearInterval(this._timer);
\r\n\t
this.stopGame();
\r\n\t
};
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
console.log('onSteup', props);
\r\n\t
this.configUI();
\r\n\t
};
\r\n\t
GameView.prototype.onDown = function (e) {
\r\n\t
};
\r\n\t
GameView.prototype.stageOnUp = function (e) {
\r\n\t
};
\r\n\t
GameView.prototype.onSuccess = function () {
\r\n\t
};
\r\n\t
GameView.prototype.onMove = function (e) {
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('recycling-start', _this.start, _this);
\r\n\t
engine.globalEvent.addEventListener('recycling-sound-update', _this.updateSound, _this);
\r\n\t
engine.globalEvent.addEventListener('recycling-stop', _this.stop, _this);
\r\n\t
var gameView = _this._gameView = new GameView();
\r\n\t
_this.addChild(gameView);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.updateSound = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.start();
\r\n\t
};
\r\n\t
GameWrapper.prototype.stop = function (event) {
\r\n\t
this._gameView.stop();
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\r\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
src/custom/jiugong-turntable-change/debug/main.js
View file @
d811d190
...
...
@@ -10,7 +10,6 @@
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
//# sourceMappingURL=utils.js.map
var
props
=
{};
function
prepareProps
()
{
...
...
@@ -20,7 +19,6 @@
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
var
Turntable
=
(
function
(
_super
)
{
tslib
.
__extends
(
Turntable
,
_super
);
...
...
@@ -81,7 +79,7 @@
var
titleLabel
=
new
engine
.
Label
();
titleLabel
.
fillColor
=
props
.
prizeName_color
;
titleLabel
.
size
=
props
.
prizeName_size
;
titleLabel
.
width
=
unchecked
.
width
;
titleLabel
.
width
=
tmpNode
.
width
;
titleLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
titleLabel
.
x
=
0
;
titleLabel
.
y
=
props
.
prizeName_Ypos
;
...
...
@@ -216,7 +214,6 @@
};
return
Turntable
;
}(
engine
.
Container
));
//# sourceMappingURL=turntable.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
...
...
@@ -248,7 +245,6 @@
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
...
...
@@ -282,7 +278,6 @@
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
...
...
@@ -290,7 +285,6 @@
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
...
...
src/custom/jiugong-turntable-change/debug/main.js.map
View file @
d811d190
{"version":3,"file":"index.js","sources":["src/custom/jiugong-turntable-change/src/game/utils.ts","src/custom/jiugong-turntable-change/src/props.ts","src/custom/jiugong-turntable-change/src/game/turntable.ts","src/custom/jiugong-turntable-change/src/game/GameView.ts","src/custom/jiugong-turntable-change/src/game/GameWrapper.ts","src/custom/jiugong-turntable-change/src/index.ts"],"sourcesContent":["\r\n/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function getStage(){\r\n\treturn engine.gameStage.stage;\r\n}","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","\r\nimport {getTextureByName} from \"./utils\";\r\nimport {getStage} from \"./utils\";\r\n\r\nimport { props } from '../props';\r\n\r\nexport class Turntable extends engine.Container{\r\n private _turnTableNode:engine.Container;\r\n private _vertical_Y = props.vertical || 20;//纵向间距\r\n private _horizontal_X = props.horizontal || 20;//横向间距\r\n private _prizeIndex = 0;\r\n\r\n private _boxArray = [];\r\n private _boxIndex = 0;//当前下标\r\n\r\n private tweenTime = props.tweenTime || 200;//单个动画时间(毫秒)\r\n private slowTweenTime = props.slowTweenTime || 200;\r\n private circleNumber = 0;//圈数\r\n\r\n private turntableOrder = [1,2,3,5,8,7,6,4]; \r\n private recordID = -1;//中奖奖品ID\r\n private boxPrizeIndex = -1;//中奖奖品节点下标 \r\n private slowDown = false;//是否开始缓速\r\n private isStop = false;\r\n\r\n private _singleNodeWidth;//单个节点宽度\r\n constructor(){\r\n super()\r\n \r\n }\r\n public initData(res){\r\n this.initTurntable(res);\r\n this.setNodeOrder();\r\n }\r\n initTurntable(res){\r\n let turnTableNode = null;\r\n if(this._turnTableNode){\r\n this.removeChild(this._turnTableNode);\r\n this._turnTableNode = null;\r\n this._boxArray = [];\r\n this._prizeIndex = 0;\r\n this._boxIndex = 0;\r\n }\r\n turnTableNode = this._turnTableNode = new engine.Container();\r\n //turnTableNode.y = 50;\r\n this.addChild(turnTableNode);\r\n for (let index_Y = 0; index_Y < 3; index_Y++) {\r\n for (let index_X = 0; index_X < 3; index_X++) { \r\n if(index_X == 1 && index_Y == 1)continue;\r\n let tmpNode:any = new engine.Container()\r\n\r\n let unchecked = this.getImage('unchecked',1);\r\n let checked = this.getImage('checked',0);\r\n\r\n tmpNode.width = Math.max(unchecked.width,checked.width);\r\n this._singleNodeWidth = this._singleNodeWidth ? this._singleNodeWidth : tmpNode.width;\r\n tmpNode.height = Math.max(unchecked.height,checked.height);\r\n tmpNode.x = index_X*(tmpNode.width + this._horizontal_X);\r\n tmpNode.y = index_Y*(tmpNode.height + this._vertical_Y);\r\n tmpNode.addChild(unchecked);\r\n tmpNode.addChild(checked);\r\n \r\n let prize =new engine.Sprite(engine.Texture.fromImage(res[this._prizeIndex].img)) ;\r\n let prizeID = res[this._prizeIndex].id;\r\n prize.width = props.icon_width;\r\n prize.height = props.icon_height;\r\n prize.x = (tmpNode.width - prize.width)/2 + props.icon_X;\r\n prize.y = (tmpNode.height - prize.height)/2 + props.icon_Y;\r\n tmpNode.prizeID = prizeID;\r\n tmpNode.addChild(prize);\r\n \r\n let titleLabel = new engine.Label();\r\n titleLabel.fillColor = props.prizeName_color;\r\n titleLabel.size = props.prizeName_size;\r\n titleLabel.width = unchecked.width;\r\n titleLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n titleLabel.x = 0;\r\n titleLabel.y = props.prizeName_Ypos;\r\n \r\n titleLabel.text = this.fixTitle(res[this._prizeIndex].name);\r\n tmpNode.addChild(titleLabel)\r\n \r\n this._prizeIndex ++ ;\r\n this._boxArray.push(tmpNode); \r\n turnTableNode.addChild(tmpNode); \r\n }\r\n }\r\n turnTableNode.x = (750 - (this._singleNodeWidth*3 + this._horizontal_X*2))/2;\r\n }\r\n\r\n setNodeOrder(){\r\n let tmpNodeArray = [];\r\n for (let index = 0; index < this.turntableOrder.length; index++) {\r\n let order = this.turntableOrder[index];\r\n tmpNodeArray.push(this._boxArray[order-1]);\r\n }\r\n this._boxArray = tmpNodeArray;\r\n }\r\n\r\n fixTitle(name){\r\n if(!name){\r\n return \"\"\r\n }\r\n if(name.split(\"\").length<props.prizeName_maxLength){\r\n return name\r\n }\r\n let n = \"\"\r\n for(let i=0;i<props.prizeName_retainLength;i++){\r\n n += name.split(\"\")[i]\r\n }\r\n n+=\"...\"\r\n return n\r\n }\r\n\r\n getImage(resName,alpha){\r\n let tmpImage = new engine.Sprite(getTextureByName(resName));\r\n tmpImage.x = 0\r\n tmpImage.y = 0\r\n tmpImage.alpha = alpha;\r\n tmpImage.name = resName;\r\n return tmpImage;\r\n }\r\n startDraw(){\r\n let tmpCheckNode = this._boxArray[this._boxIndex].getChildByName('checked');\r\n if(this.isStop){engine.Tween.removeTweens(tmpCheckNode);return}\r\n if(this.slowDown)\r\n {\r\n if(this._boxIndex != this.getNodeIndexOFprize()){\r\n this.tweenTime += this.slowTweenTime;\r\n }else{\r\n this.isStop = true;\r\n this.twinkle(tmpCheckNode);\r\n }\r\n }\r\n engine.Tween.get(tmpCheckNode)\r\n .to({alpha:1},this.tweenTime/2)\r\n .to({alpha:0},this.tweenTime/2)\r\n .call(()=>{\r\n if(this.circleNumber >= props.circleNumber && this.getSlowStart() == this._boxIndex){\r\n this.slowDown = true;\r\n }\r\n this._boxIndex ++;\r\n if(this._boxIndex >= this._boxArray.length){\r\n this._boxIndex = 0;\r\n this.circleNumber++;\r\n }\r\n \r\n this.startDraw();\r\n \r\n \r\n })\r\n }\r\n //获取开始减速的下标\r\n private getSlowStart(){\r\n if(this.recordID < 0)return -1;\r\n let tmpIndex = this.getNodeIndexOFprize();\r\n if(tmpIndex < 4){\r\n return tmpIndex + 4;\r\n }else{\r\n return tmpIndex - 4\r\n }\r\n }\r\n //获取奖品节点下标\r\n getNodeIndexOFprize(){\r\n if(this.recordID < 0)return -1;\r\n for (let index = 0; index < this._boxArray.length; index++) {\r\n let element = this._boxArray[index];\r\n if(element.prizeID === this.recordID){\r\n return index;\r\n } \r\n }\r\n return -1;\r\n }\r\n //中奖节点闪烁\r\n twinkle(tmpNode){\r\n engine.Tween.removeTweens(tmpNode)\r\n let twinkleTime = 1;\r\n engine.Tween.get(tmpNode, {loop:true})\r\n .to({alpha:0}, 30)\r\n .to({alpha:1}, 30)\r\n .call(()=>{\r\n if(twinkleTime > 5){\r\n engine.Tween.removeTweens(tmpNode);\r\n engine.globalEvent.dispatchEvent('jiugong-turntable-change-over')\r\n return;\r\n }else{\r\n twinkleTime++;\r\n }\r\n })\r\n }\r\n setRecordID(prizeID){\r\n this.recordID = prizeID;\r\n }\r\n reset(){\r\n this._boxArray.forEach(element => {\r\n engine.Tween.removeTweens(element.getChildByName('checked'));\r\n });\r\n this._boxIndex = 0;//当前下标\r\n this.tweenTime = props.tweenTime || 200;//单个动画时间(毫秒)\r\n this.slowTweenTime = props.slowTweenTime || 200;\r\n this.circleNumber = 0;//圈数\r\n this.recordID = -1;//中奖奖品ID\r\n this.boxPrizeIndex = -1;//中奖奖品节点下标 \r\n this.slowDown = false;//是否开始缓速\r\n this.isStop = false;\r\n for (let index = 0; index < this._boxArray.length; index++) {\r\n let element = this._boxArray[index];\r\n element.getChildByName('checked').alpha = 0;\r\n }\r\n \r\n }\r\n\r\n}","\r\n/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport {props} from \"../props\";\r\nimport { Turntable } from \"./turntable\";\r\n\r\n\r\n\r\n\r\n\r\nexport default class GameView extends engine.Container {\r\n\r\n\t\r\n\tprivate _hasSetup;\r\n\tprivate _turntable:Turntable;\r\n\tconstructor() {\r\n\t\tsuper();\t\r\n\t}\r\n\t setup(){\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\t\r\n\t\tlet turntable = this._turntable = new Turntable();\r\n\t\tthis.addChild(turntable);\r\n\t}\r\n\tsetPrizeData(res){\r\n\t\tthis._turntable.initData(res);\r\n\t}\r\n\tstartDraw(){\r\n\t\tthis._turntable.startDraw();\r\n\t}\r\n\tsetRecordID(prizeID){\r\n\t\tthis._turntable.setRecordID(prizeID)\r\n\t}\r\n\treset(){\r\n\t\tthis._turntable.reset();\r\n\t}\r\n\tsetSetup(){\r\n\t\tthis._hasSetup = false;\r\n\t}\r\n}\r\n","\r\n\r\nimport { props } from '../props';\r\n\r\n\r\n/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-init', this.init, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-prizeData', this.initPrizeData, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-start', this.start, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-winPrize', this.winPrize, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-reset', this.reset, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-abnormal', this.reset, this);\r\n\t}\r\n\r\n\tinit(event: engine.Event) {\r\n\t\t//初始化场景\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\t\tthis._gameView.setup();\r\n\t}\r\n\tinitPrizeData(event: engine.Event){\r\n\t\tthis._gameView.setSetup();\r\n\t\tthis._gameView.setPrizeData(event.data.resources);\r\n\t}\r\n\r\n\t//开始抽奖\r\n\tstart(event: engine.Event){\r\n\t\tthis._gameView.startDraw();\r\n\t}\r\n\twinPrize(event: engine.Event){\r\n\t\tthis._gameView.setRecordID(event.data.prizeID)\r\n\t}\r\n\treset(){\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\t// private visibilitychange(){\r\n\t// \tdocument.addEventListener('visibilitychange', function () {\r\n // if (document.visibilityState === 'hidden') {\r\n\t// \t\t\tconsole.log('放置后台');\r\n\t// \t\t\tengine.globalEvent.dispatchEvent('answer-game-visibilitychange',{hidden:true});\r\n // }\r\n // });\r\n\t// }\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;UAKgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,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KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KACjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/jiugong-turntable-change/src/game/utils.ts","src/custom/jiugong-turntable-change/src/props.ts","src/custom/jiugong-turntable-change/src/game/turntable.ts","src/custom/jiugong-turntable-change/src/game/GameView.ts","src/custom/jiugong-turntable-change/src/game/GameWrapper.ts","src/custom/jiugong-turntable-change/src/index.ts"],"sourcesContent":["\r\n/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function getStage(){\r\n\treturn engine.gameStage.stage;\r\n}","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","\r\nimport {getTextureByName} from \"./utils\";\r\nimport {getStage} from \"./utils\";\r\n\r\nimport { props } from '../props';\r\n\r\nexport class Turntable extends engine.Container{\r\n private _turnTableNode:engine.Container;\r\n private _vertical_Y = props.vertical || 20;//纵向间距\r\n private _horizontal_X = props.horizontal || 20;//横向间距\r\n private _prizeIndex = 0;\r\n\r\n private _boxArray = [];\r\n private _boxIndex = 0;//当前下标\r\n\r\n private tweenTime = props.tweenTime || 200;//单个动画时间(毫秒)\r\n private slowTweenTime = props.slowTweenTime || 200;\r\n private circleNumber = 0;//圈数\r\n\r\n private turntableOrder = [1,2,3,5,8,7,6,4]; \r\n private recordID = -1;//中奖奖品ID\r\n private boxPrizeIndex = -1;//中奖奖品节点下标 \r\n private slowDown = false;//是否开始缓速\r\n private isStop = false;\r\n\r\n private _singleNodeWidth;//单个节点宽度\r\n constructor(){\r\n super()\r\n \r\n }\r\n public initData(res){\r\n this.initTurntable(res);\r\n this.setNodeOrder();\r\n }\r\n initTurntable(res){\r\n let turnTableNode = null;\r\n if(this._turnTableNode){\r\n this.removeChild(this._turnTableNode);\r\n this._turnTableNode = null;\r\n this._boxArray = [];\r\n this._prizeIndex = 0;\r\n this._boxIndex = 0;\r\n }\r\n turnTableNode = this._turnTableNode = new engine.Container();\r\n //turnTableNode.y = 50;\r\n this.addChild(turnTableNode);\r\n for (let index_Y = 0; index_Y < 3; index_Y++) {\r\n for (let index_X = 0; index_X < 3; index_X++) { \r\n if(index_X == 1 && index_Y == 1)continue;\r\n let tmpNode:any = new engine.Container()\r\n\r\n let unchecked = this.getImage('unchecked',1);\r\n let checked = this.getImage('checked',0);\r\n\r\n tmpNode.width = Math.max(unchecked.width,checked.width);\r\n this._singleNodeWidth = this._singleNodeWidth ? this._singleNodeWidth : tmpNode.width;\r\n tmpNode.height = Math.max(unchecked.height,checked.height);\r\n tmpNode.x = index_X*(tmpNode.width + this._horizontal_X);\r\n tmpNode.y = index_Y*(tmpNode.height + this._vertical_Y);\r\n tmpNode.addChild(unchecked);\r\n tmpNode.addChild(checked);\r\n \r\n let prize =new engine.Sprite(engine.Texture.fromImage(res[this._prizeIndex].img)) ;\r\n let prizeID = res[this._prizeIndex].id;\r\n prize.width = props.icon_width;\r\n prize.height = props.icon_height;\r\n prize.x = (tmpNode.width - prize.width)/2 + props.icon_X;\r\n prize.y = (tmpNode.height - prize.height)/2 + props.icon_Y;\r\n tmpNode.prizeID = prizeID;\r\n tmpNode.addChild(prize);\r\n \r\n let titleLabel = new engine.Label();\r\n titleLabel.fillColor = props.prizeName_color;\r\n titleLabel.size = props.prizeName_size;\r\n titleLabel.width = tmpNode.width;\r\n titleLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n titleLabel.x = 0;\r\n titleLabel.y = props.prizeName_Ypos;\r\n \r\n titleLabel.text = this.fixTitle(res[this._prizeIndex].name);\r\n tmpNode.addChild(titleLabel)\r\n \r\n this._prizeIndex ++ ;\r\n this._boxArray.push(tmpNode); \r\n turnTableNode.addChild(tmpNode); \r\n }\r\n }\r\n turnTableNode.x = (750 - (this._singleNodeWidth*3 + this._horizontal_X*2))/2;\r\n }\r\n\r\n setNodeOrder(){\r\n let tmpNodeArray = [];\r\n for (let index = 0; index < this.turntableOrder.length; index++) {\r\n let order = this.turntableOrder[index];\r\n tmpNodeArray.push(this._boxArray[order-1]);\r\n }\r\n this._boxArray = tmpNodeArray;\r\n }\r\n\r\n fixTitle(name){\r\n if(!name){\r\n return \"\"\r\n }\r\n if(name.split(\"\").length<props.prizeName_maxLength){\r\n return name\r\n }\r\n let n = \"\"\r\n for(let i=0;i<props.prizeName_retainLength;i++){\r\n n += name.split(\"\")[i]\r\n }\r\n n+=\"...\"\r\n return n\r\n }\r\n\r\n getImage(resName,alpha){\r\n let tmpImage = new engine.Sprite(getTextureByName(resName));\r\n tmpImage.x = 0\r\n tmpImage.y = 0\r\n tmpImage.alpha = alpha;\r\n tmpImage.name = resName;\r\n return tmpImage;\r\n }\r\n startDraw(){\r\n let tmpCheckNode = this._boxArray[this._boxIndex].getChildByName('checked');\r\n if(this.isStop){engine.Tween.removeTweens(tmpCheckNode);return}\r\n if(this.slowDown)\r\n {\r\n if(this._boxIndex != this.getNodeIndexOFprize()){\r\n this.tweenTime += this.slowTweenTime;\r\n }else{\r\n this.isStop = true;\r\n this.twinkle(tmpCheckNode);\r\n }\r\n }\r\n engine.Tween.get(tmpCheckNode)\r\n .to({alpha:1},this.tweenTime/2)\r\n .to({alpha:0},this.tweenTime/2)\r\n .call(()=>{\r\n if(this.circleNumber >= props.circleNumber && this.getSlowStart() == this._boxIndex){\r\n this.slowDown = true;\r\n }\r\n this._boxIndex ++;\r\n if(this._boxIndex >= this._boxArray.length){\r\n this._boxIndex = 0;\r\n this.circleNumber++;\r\n }\r\n \r\n this.startDraw();\r\n \r\n \r\n })\r\n }\r\n //获取开始减速的下标\r\n private getSlowStart(){\r\n if(this.recordID < 0)return -1;\r\n let tmpIndex = this.getNodeIndexOFprize();\r\n if(tmpIndex < 4){\r\n return tmpIndex + 4;\r\n }else{\r\n return tmpIndex - 4\r\n }\r\n }\r\n //获取奖品节点下标\r\n getNodeIndexOFprize(){\r\n if(this.recordID < 0)return -1;\r\n for (let index = 0; index < this._boxArray.length; index++) {\r\n let element = this._boxArray[index];\r\n if(element.prizeID === this.recordID){\r\n return index;\r\n } \r\n }\r\n return -1;\r\n }\r\n //中奖节点闪烁\r\n twinkle(tmpNode){\r\n engine.Tween.removeTweens(tmpNode)\r\n let twinkleTime = 1;\r\n engine.Tween.get(tmpNode, {loop:true})\r\n .to({alpha:0}, 30)\r\n .to({alpha:1}, 30)\r\n .call(()=>{\r\n if(twinkleTime > 5){\r\n engine.Tween.removeTweens(tmpNode);\r\n engine.globalEvent.dispatchEvent('jiugong-turntable-change-over')\r\n return;\r\n }else{\r\n twinkleTime++;\r\n }\r\n })\r\n }\r\n setRecordID(prizeID){\r\n this.recordID = prizeID;\r\n }\r\n reset(){\r\n this._boxArray.forEach(element => {\r\n engine.Tween.removeTweens(element.getChildByName('checked'));\r\n });\r\n this._boxIndex = 0;//当前下标\r\n this.tweenTime = props.tweenTime || 200;//单个动画时间(毫秒)\r\n this.slowTweenTime = props.slowTweenTime || 200;\r\n this.circleNumber = 0;//圈数\r\n this.recordID = -1;//中奖奖品ID\r\n this.boxPrizeIndex = -1;//中奖奖品节点下标 \r\n this.slowDown = false;//是否开始缓速\r\n this.isStop = false;\r\n for (let index = 0; index < this._boxArray.length; index++) {\r\n let element = this._boxArray[index];\r\n element.getChildByName('checked').alpha = 0;\r\n }\r\n \r\n }\r\n\r\n}","\r\n/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport {props} from \"../props\";\r\nimport { Turntable } from \"./turntable\";\r\n\r\n\r\n\r\n\r\n\r\nexport default class GameView extends engine.Container {\r\n\r\n\t\r\n\tprivate _hasSetup;\r\n\tprivate _turntable:Turntable;\r\n\tconstructor() {\r\n\t\tsuper();\t\r\n\t}\r\n\t setup(){\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\t\r\n\t\tlet turntable = this._turntable = new Turntable();\r\n\t\tthis.addChild(turntable);\r\n\t}\r\n\tsetPrizeData(res){\r\n\t\tthis._turntable.initData(res);\r\n\t}\r\n\tstartDraw(){\r\n\t\tthis._turntable.startDraw();\r\n\t}\r\n\tsetRecordID(prizeID){\r\n\t\tthis._turntable.setRecordID(prizeID)\r\n\t}\r\n\treset(){\r\n\t\tthis._turntable.reset();\r\n\t}\r\n\tsetSetup(){\r\n\t\tthis._hasSetup = false;\r\n\t}\r\n}\r\n","\r\n\r\nimport { props } from '../props';\r\n\r\n\r\n/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-init', this.init, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-prizeData', this.initPrizeData, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-start', this.start, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-winPrize', this.winPrize, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-reset', this.reset, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-change-abnormal', this.reset, this);\r\n\t}\r\n\r\n\tinit(event: engine.Event) {\r\n\t\t//初始化场景\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\t\tthis._gameView.setup();\r\n\t}\r\n\tinitPrizeData(event: engine.Event){\r\n\t\tthis._gameView.setSetup();\r\n\t\tthis._gameView.setPrizeData(event.data.resources);\r\n\t}\r\n\r\n\t//开始抽奖\r\n\tstart(event: engine.Event){\r\n\t\tthis._gameView.startDraw();\r\n\t}\r\n\twinPrize(event: engine.Event){\r\n\t\tthis._gameView.setRecordID(event.data.prizeID)\r\n\t}\r\n\treset(){\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\t// private visibilitychange(){\r\n\t// \tdocument.addEventListener('visibilitychange', function () {\r\n // if (document.visibilityState === 'hidden') {\r\n\t// \t\t\tconsole.log('放置后台');\r\n\t// \t\t\tengine.globalEvent.dispatchEvent('answer-game-visibilitychange',{hidden:true});\r\n // }\r\n // });\r\n\t// }\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;UAKgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;;CCPM,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,U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@ -72,7 +72,7 @@ export class Turntable extends engine.Container{
let
titleLabel
=
new
engine
.
Label
();
titleLabel
.
fillColor
=
props
.
prizeName_color
;
titleLabel
.
size
=
props
.
prizeName_size
;
titleLabel
.
width
=
unchecked
.
width
;
titleLabel
.
width
=
tmpNode
.
width
;
titleLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
titleLabel
.
x
=
0
;
titleLabel
.
y
=
props
.
prizeName_Ypos
;
...
...
src/custom/recycling/debug/main.js
View file @
d811d190
...
...
@@ -18,6 +18,7 @@
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
//# sourceMappingURL=utils.js.map
var
props
=
{};
function
prepareProps
()
{
...
...
@@ -27,6 +28,7 @@
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
var
Conveyor
=
(
function
(
_super
)
{
tslib
.
__extends
(
Conveyor
,
_super
);
...
...
@@ -62,6 +64,7 @@
};
return
Conveyor
;
}(
engine
.
Sprite
));
//# sourceMappingURL=Conveyor.js.map
var
GarbageTypes
;
(
function
(
GarbageTypes
)
{
...
...
@@ -70,6 +73,7 @@
GarbageTypes
[
"wetWaste"
]
=
"wetWaste"
;
GarbageTypes
[
"dryWaste"
]
=
"dryWaste"
;
})(
GarbageTypes
||
(
GarbageTypes
=
{}));
//# sourceMappingURL=GarbageTypes.js.map
var
GarbageConfig
=
(
function
()
{
function
GarbageConfig
()
{
...
...
@@ -92,7 +96,7 @@
{
name
:
"锅具"
,
source
:
"g15"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
119
,
height
:
149
},
{
name
:
"果核"
,
source
:
"g16"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
99
,
height
:
95
},
{
name
:
"果皮"
,
source
:
"g17"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
115
,
height
:
127
},
{
name
:
"化妆品"
,
source
:
"g18"
,
type
:
GarbageTypes
.
harmful
Waste
,
width
:
67
,
height
:
151
},
{
name
:
"化妆品"
,
source
:
"g18"
,
type
:
GarbageTypes
.
dry
Waste
,
width
:
67
,
height
:
151
},
{
name
:
"鸡蛋壳"
,
source
:
"g19"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
99
,
height
:
107
},
{
name
:
"剪刀"
,
source
:
"g20"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
96
,
height
:
127
},
{
name
:
"胶带"
,
source
:
"g21"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
87
,
height
:
113
},
...
...
@@ -128,6 +132,7 @@
];
return
GarbageConfig
;
}());
//# sourceMappingURL=GarbageConfig.js.map
var
transStores
=
(
function
(
list
)
{
var
tmp
=
[];
...
...
@@ -182,11 +187,12 @@
case
GarbageTypes
.
harmfulWaste
:
return
'有害垃圾'
;
case
GarbageTypes
.
wetWaste
:
return
'
湿
垃圾'
;
return
'
厨余
垃圾'
;
case
GarbageTypes
.
dryWaste
:
return
'其他垃圾'
;
}
};
//# sourceMappingURL=transStores.js.map
var
checkHit
=
(
function
(
view
,
rect
)
{
var
x
=
view
.
x
,
y
=
view
.
y
;
...
...
@@ -196,12 +202,14 @@
}
return
false
;
});
//# sourceMappingURL=checkHit.js.map
var
removeChild
=
(
function
(
d
)
{
if
(
d
&&
d
.
parent
)
{
d
.
parent
.
removeChild
(
d
);
}
});
//# sourceMappingURL=removeChild.js.map
var
removeEle
=
(
function
(
e
,
arr
)
{
var
index
=
arr
.
indexOf
(
e
);
...
...
@@ -209,6 +217,7 @@
arr
.
splice
(
index
,
1
);
}
});
//# sourceMappingURL=removeEle.js.map
var
shuffle
=
(
function
(
arr
)
{
var
_a
;
...
...
@@ -219,6 +228,7 @@
}
return
arr
;
});
//# sourceMappingURL=shuffle.js.map
var
WrongTips
=
(
function
(
_super
)
{
tslib
.
__extends
(
WrongTips
,
_super
);
...
...
@@ -263,6 +273,7 @@
return
gameview
.
recoverableWaste
;
}
};
//# sourceMappingURL=WrongTips.js.map
var
Conveyors
=
(
function
(
_super
)
{
tslib
.
__extends
(
Conveyors
,
_super
);
...
...
@@ -532,6 +543,7 @@
};
return
Conveyors
;
}(
engine
.
Sprite
));
//# sourceMappingURL=Conveyors.js.map
var
uiConfig
=
(
function
()
{
return
[
...
...
@@ -583,6 +595,7 @@
},
];
});
//# sourceMappingURL=uiConfig.js.map
var
setGuide
=
function
()
{
try
{
...
...
@@ -594,6 +607,7 @@
console
.
log
(
"setguide--err"
,
e
);
}
};
//# sourceMappingURL=getGuideInfo.js.map
var
createBg
=
(
function
(
a
)
{
if
(
a
===
void
0
)
{
a
=
1
;
}
...
...
@@ -604,10 +618,12 @@
rect
.
alpha
=
a
;
return
rect
;
});
//# sourceMappingURL=createBg.js.map
var
createImg
=
(
function
(
texture
)
{
return
new
engine
.
Sprite
(
getTextureByName
(
texture
));
});
//# sourceMappingURL=createImg.js.map
var
CountDownGroup
=
(
function
(
_super
)
{
tslib
.
__extends
(
CountDownGroup
,
_super
);
...
...
@@ -691,6 +707,7 @@
};
return
CountDownGroup
;
}(
engine
.
Sprite
));
//# sourceMappingURL=CountDownGroup.js.map
var
GuideView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GuideView
,
_super
);
...
...
@@ -775,6 +792,7 @@
};
return
GuideView
;
}(
engine
.
Sprite
));
//# sourceMappingURL=guideView.js.map
var
RightTips
=
(
function
(
_super
)
{
tslib
.
__extends
(
RightTips
,
_super
);
...
...
@@ -813,6 +831,7 @@
};
return
RightTips
;
}(
engine
.
Sprite
));
//# sourceMappingURL=RightTips.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
...
...
@@ -974,6 +993,7 @@
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
...
...
@@ -998,6 +1018,7 @@
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
...
...
@@ -1005,6 +1026,7 @@
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
...
...
src/custom/recycling/debug/main.js.map
View file @
d811d190
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/custom/recycling/src/game/datas/GarbageConfig.ts
View file @
d811d190
...
...
@@ -18,7 +18,7 @@ export default class GarbageConfig {
{
name
:
"锅具"
,
source
:
"g15"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
119
,
height
:
149
},
{
name
:
"果核"
,
source
:
"g16"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
99
,
height
:
95
},
{
name
:
"果皮"
,
source
:
"g17"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
115
,
height
:
127
},
{
name
:
"化妆品"
,
source
:
"g18"
,
type
:
GarbageTypes
.
harmful
Waste
,
width
:
67
,
height
:
151
},
{
name
:
"化妆品"
,
source
:
"g18"
,
type
:
GarbageTypes
.
dry
Waste
,
width
:
67
,
height
:
151
},
{
name
:
"鸡蛋壳"
,
source
:
"g19"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
99
,
height
:
107
},
{
name
:
"剪刀"
,
source
:
"g20"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
96
,
height
:
127
},
{
name
:
"胶带"
,
source
:
"g21"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
87
,
height
:
113
},
...
...
src/custom/recycling/src/game/datas/transStores.ts
View file @
d811d190
...
...
@@ -68,7 +68,7 @@ const getTargetName = (type: GarbageTypes) => {
break
;
case
GarbageTypes
.
wetWaste
:
return
'
湿
垃圾'
return
'
厨余
垃圾'
break
;
case
GarbageTypes
.
dryWaste
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment