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
e0fcb941
Commit
e0fcb941
authored
Jul 10, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
bf6a5999
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1386 additions
and
37 deletions
+1386
-37
bjxd-game.json
dist/customs/bjxd-game.json
+5
-5
xiaoxiaole.json
dist/customs/xiaoxiaole.json
+93
-0
meta.json
src/custom/bjxd-game/meta.json
+5
-5
app.js
src/custom/xiaoxiaole/debug/app.js
+2
-16
index.html
src/custom/xiaoxiaole/debug/index.html
+2
-2
main.js
src/custom/xiaoxiaole/debug/main.js
+601
-1
main.js.map
src/custom/xiaoxiaole/debug/main.js.map
+1
-0
meta.json
src/custom/xiaoxiaole/meta.json
+52
-4
GameView.ts
src/custom/xiaoxiaole/src/game/GameView.ts
+446
-1
GameWrapper.ts
src/custom/xiaoxiaole/src/game/GameWrapper.ts
+16
-3
MapData.ts
src/custom/xiaoxiaole/src/game/MapData.ts
+104
-0
Element.ts
src/custom/xiaoxiaole/src/game/ele/Element.ts
+59
-0
No files found.
dist/customs/bjxd-game.json
View file @
e0fcb941
...
...
@@ -96,19 +96,19 @@
"assets"
:
[
{
"name"
:
"bg1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
b2c76b2a753317e5ea935bab22097a43a4c9f7cb
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
e6ab7c1e191d30a2b068fa4a0e867040b9396226
.png"
,
"uuid"
:
"bg1"
,
"ext"
:
".png"
},
{
"name"
:
"bg2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7f8261a9dd7b83cdc3b95b6f3f385e7a91e49682
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
a2d611fa5af2b26ffd57a24ff524d2a0a4fe1564
.png"
,
"uuid"
:
"bg2"
,
"ext"
:
".png"
},
{
"name"
:
"bg3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
72c688f9c2f495fe234277256923804df2ab75e
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
9258aed59e36471a4136ce7fbc4ca7e300caf07
.png"
,
"uuid"
:
"bg3"
,
"ext"
:
".png"
},
...
...
@@ -120,13 +120,13 @@
},
{
"name"
:
"yindao1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
f21d5429dbd947e66613bd6c5d864fdcfd104bd4
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
4449285320882460ae0dd0b59b3c73e0bb92def6
.png"
,
"uuid"
:
"yindao1"
,
"ext"
:
".png"
},
{
"name"
:
"yindao2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7ece2d8c438ec06004f7f40d9798ab72f0e6a244
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
1c914031834736b93e9b2a94a4e8a643871795f7
.png"
,
"uuid"
:
"yindao2"
,
"ext"
:
".png"
},
...
...
dist/customs/xiaoxiaole.json
0 → 100644
View file @
e0fcb941
{
"name"
:
"消消乐"
,
"desc"
:
"消消乐模块"
,
"props"
:
{},
"assets"
:
[
{
"name"
:
"底图"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/109e30fa662276e0ee4f2e2c35b85bee6f300050.png"
,
"uuid"
:
"map"
,
"ext"
:
".png"
},
{
"name"
:
"房子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df155804a46c708a714365b7247141ba0add45e5.png"
,
"uuid"
:
"home"
,
"ext"
:
".png"
},
{
"name"
:
"白虎"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b486b4a72c58850bbd1930b994e08802e34fb3e3.png"
,
"uuid"
:
"btiger"
,
"ext"
:
".png"
},
{
"name"
:
"雌虎"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/c41afceb285432ed2c17c643df96efc20893adc8.png"
,
"uuid"
:
"gtiger"
,
"ext"
:
".png"
},
{
"name"
:
"猴子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/ef7bc5d1fc38267adba71e07d517330f249d23ba.png"
,
"uuid"
:
"monkey"
,
"ext"
:
".png"
},
{
"name"
:
"鸟"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/9ad18dfa34e1729e9893ac362975f9e062263f70.png"
,
"uuid"
:
"bird"
,
"ext"
:
".png"
},
{
"name"
:
"树熊"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/277aa43d9f1bf3dd7a18e627335a166f0509684c.png"
,
"uuid"
:
"koala"
,
"ext"
:
".png"
},
{
"name"
:
"选中框"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a3ce52a41ed53ccfa7ce404dbc10102961c4a805.png"
,
"uuid"
:
"selected"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"game-init"
:
{
"alias"
:
"初始化第一关"
,
"data"
:
{}
},
"game-reset"
:
{
"alias"
:
"关卡通过重玩之类的重置关卡"
,
"data"
:
{}
},
"game-start"
:
{
"alias"
:
"开始"
}
},
"out"
:
{
"game-score-update"
:
{
"alias"
:
"分数更新"
,
"data"
:
{
"score"
:
"分数"
}
},
"game-time-update"
:
{
"alias"
:
"倒计时更新"
,
"data"
:
{
"time"
:
"剩余时间"
}
},
"game-over"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{
"score"
:
"分数"
,
"reason"
:
"结束原因(1:时间到了,2:过关)"
}
}
}
},
"id"
:
"xiaoxiaole"
,
"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.xiaoxiaole = 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 Element = (function (_super) {
\r\n\t
tslib.__extends(Element, _super);
\r\n\t
function Element() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.width = MapData.itemsize;
\r\n\t
_this.height = MapData.itemsize;
\r\n\t
_this.eimage = new engine.Image();
\r\n\t
_this.addChild(_this.eimage);
\r\n\t
_this.touch = true;
\r\n\t
_this.addEventListener(engine.MouseEvent.CLICK, _this.selectele, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Object.defineProperty(Element.prototype,
\"
touch
\"
, {
\r\n\t
set: function (touch) {
\r\n\t
this.mouseEnabled = touch;
\r\n\t
this.mouseChildren = touch;
\r\n\t
},
\r\n\t
enumerable: true,
\r\n\t
configurable: true
\r\n\t
});
\r\n\t
Element.prototype.init = function (type) {
\r\n\t
this.scaleX = 1;
\r\n\t
this.scaleY = 1;
\r\n\t
this.type = type;
\r\n\t
var ename = MapData.getEtypeImgName(type);
\r\n\t
this.eimage.texture = getTextureByName(ename);
\r\n\t
var imgwid = this.eimage.texture.width;
\r\n\t
var imghei = this.eimage.texture.height;
\r\n\t
this.eimage.x = (this.width - imgwid) / 2;
\r\n\t
this.eimage.y = (this.height - imghei) / 2;
\r\n\t
};
\r\n\t
Element.prototype.setrc = function (r, c) {
\r\n\t
this.inrow = r;
\r\n\t
this.incol = c;
\r\n\t
};
\r\n\t
Element.prototype.selectele = function (e) {
\r\n\t
engine.globalEvent.dispatchEvent(GameEvent.SelectEle, {
\r\n\t
r: this.inrow,
\r\n\t
c: this.incol
\r\n\t
});
\r\n\t
};
\r\n\t
Element.prototype.flyToHome = function () {
\r\n\t
};
\r\n\t
Element.prototype.changePos = function () {
\r\n\t
};
\r\n\t
return Element;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=Element.js.map
\n\n\t
var ElementType;
\r\n\t
(function (ElementType) {
\r\n\t
ElementType[ElementType[
\"
btiger
\"
] = 1] =
\"
btiger
\"
;
\r\n\t
ElementType[ElementType[
\"
gtiger
\"
] = 2] =
\"
gtiger
\"
;
\r\n\t
ElementType[ElementType[
\"
monkey
\"
] = 3] =
\"
monkey
\"
;
\r\n\t
ElementType[ElementType[
\"
bird
\"
] = 4] =
\"
bird
\"
;
\r\n\t
ElementType[ElementType[
\"
koala
\"
] = 5] =
\"
koala
\"
;
\r\n\t
})(ElementType || (ElementType = {}));
\r\n\t
var GameEvent;
\r\n\t
(function (GameEvent) {
\r\n\t
GameEvent[
\"
SelectEle
\"
] =
\"
SelectEle
\"
;
\r\n\t
})(GameEvent || (GameEvent = {}));
\r\n\t
var MapData = (function () {
\r\n\t
function MapData() {
\r\n\t
}
\r\n\t
MapData.getRy = function (r) {
\r\n\t
return this.paddingb + r * (this.itemsize + this.paddingi);
\r\n\t
};
\r\n\t
MapData.getCx = function (c) {
\r\n\t
return this.paddingb + c * (this.itemsize + this.paddingi);
\r\n\t
};
\r\n\t
MapData.getRCPos = function (r, c) {
\r\n\t
var x = this.getCx(c);
\r\n\t
var y = this.getRy(r);
\r\n\t
return [x, y];
\r\n\t
};
\r\n\t
MapData.adaptElePos = function (pos, wid, hei) {
\r\n\t
var x = pos[0] + (this.itemsize - wid) / 2;
\r\n\t
var y = pos[1] + (this.itemsize - hei) / 2;
\r\n\t
return [x, y];
\r\n\t
};
\r\n\t
MapData.getEtypeImgName = function (type) {
\r\n\t
var ename;
\r\n\t
switch (type) {
\r\n\t
case ElementType.btiger:
\r\n\t
ename =
\"
白虎
\"
;
\r\n\t
break;
\r\n\t
case ElementType.gtiger:
\r\n\t
ename =
\"
雌虎
\"
;
\r\n\t
break;
\r\n\t
case ElementType.monkey:
\r\n\t
ename =
\"
猴子
\"
;
\r\n\t
break;
\r\n\t
case ElementType.bird:
\r\n\t
ename =
\"
鸟
\"
;
\r\n\t
break;
\r\n\t
case ElementType.koala:
\r\n\t
ename =
\"
树熊
\"
;
\r\n\t
break;
\r\n\t
default:
\r\n\t
console.error(
\"
未定义元素类型
\"
);
\r\n\t
break;
\r\n\t
}
\r\n\t
return ename;
\r\n\t
};
\r\n\t
MapData.getRandEtype = function () {
\r\n\t
var eletypeArr = [ElementType.btiger, ElementType.gtiger, ElementType.monkey, ElementType.bird, ElementType.koala];
\r\n\t
var etype = eletypeArr[Math.floor(Math.random() * eletypeArr.length)];
\r\n\t
return etype;
\r\n\t
};
\r\n\t
MapData.getOneEle = function (type) {
\r\n\t
var ele;
\r\n\t
if (this.elePool.length > 0) {
\r\n\t
ele = this.elePool.shift();
\r\n\t
}
\r\n\t
else {
\r\n\t
ele = new Element();
\r\n\t
}
\r\n\t
ele.name =
\"
ele_
\"
+ this.eleidx;
\r\n\t
this.eleidx += 1;
\r\n\t
ele.init(type);
\r\n\t
return ele;
\r\n\t
};
\r\n\t
MapData.recoverEle = function (ele) {
\r\n\t
this.elePool.push(ele);
\r\n\t
};
\r\n\t
MapData.getDistance = function (p1, p2) {
\r\n\t
var p1x = p1[0];
\r\n\t
var p1y = p1[1];
\r\n\t
var p2x = p2[0];
\r\n\t
var p2y = p2[1];
\r\n\t
var dis = Math.sqrt(Math.pow(p1x - p2x, 2) + Math.pow(p1y - p2y, 2));
\r\n\t
return dis;
\r\n\t
};
\r\n\t
MapData.itemsize = 129;
\r\n\t
MapData.paddingb = 10;
\r\n\t
MapData.paddingi = 5;
\r\n\t
MapData.row = 5;
\r\n\t
MapData.col = 5;
\r\n\t
MapData.posData = {};
\r\n\t
MapData.eleidx = 1;
\r\n\t
MapData.elePool = [];
\r\n\t
return MapData;
\r\n\t
}());
\r\n\t
//# sourceMappingURL=MapData.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.lattices = {};
\r\n\t
_this.eliminateArr = [];
\r\n\t
_this.selectArr = [];
\r\n\t
_this.conty = 140;
\r\n\t
_this.homex = 528;
\r\n\t
_this.anispeed = 860;
\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.setup = function () {
\r\n\t
this.selectimg = new engine.Image(getTextureByName(
\"
选中框
\"
));
\r\n\t
this.selectimg.mouseEnabled = false;
\r\n\t
var row = MapData.row;
\r\n\t
var col = MapData.col;
\r\n\t
this.homeimg = new engine.Image(getTextureByName(
\"
房子
\"
));
\r\n\t
this.addChild(this.homeimg);
\r\n\t
this.homeimg.x = this.homex;
\r\n\t
this.container = new engine.Container();
\r\n\t
this.addChild(this.container);
\r\n\t
this.container.y = this.conty;
\r\n\t
this.anicontainer = new engine.Container();
\r\n\t
this.addChild(this.anicontainer);
\r\n\t
this.anicontainer.mouseEnabled = false;
\r\n\t
this.anicontainer.mouseChildren = false;
\r\n\t
var map = new engine.Image(getTextureByName(
\"
底图
\"
));
\r\n\t
this.container.addChild(map);
\r\n\t
for (var r = 0; r < row; r++) {
\r\n\t
for (var c = 0; c < col; c++) {
\r\n\t
var rcpos = MapData.getRCPos(r, c);
\r\n\t
MapData.posData[r +
\"
_
\"
+ c] = rcpos;
\r\n\t
}
\r\n\t
}
\r\n\t
this.tanix = this.homex + this.homeimg.texture.width / 2;
\r\n\t
this.taniy = this.homeimg.texture.height / 2;
\r\n\t
engine.globalEvent.addEventListener(GameEvent.SelectEle, this.selectele, this);
\r\n\t
this.removeEventListener(engine.Event.ADDED_TO_STAGE, this.setup, this);
\r\n\t
};
\r\n\t
GameView.prototype.init = function () {
\r\n\t
this.initContainer();
\r\n\t
};
\r\n\t
GameView.prototype.reset = function () {
\r\n\t
};
\r\n\t
GameView.prototype.start = function () {
\r\n\t
};
\r\n\t
GameView.prototype.initContainer = function () {
\r\n\t
this.lattices = {};
\r\n\t
var testdata = [
\r\n\t
[1, 2, 5, 3, 4],
\r\n\t
[3, 1, 2, 4, 5],
\r\n\t
[2, 5, 3, 4, 1],
\r\n\t
[5, 4, 1, 2, 3],
\r\n\t
[4, 1, 3, 5, 2],
\r\n\t
];
\r\n\t
for (var r = 0; r < testdata.length; r++) {
\r\n\t
var rdata = testdata[r];
\r\n\t
for (var c = 0; c < rdata.length; c++) {
\r\n\t
var rctype = rdata[c];
\r\n\t
var rcele = MapData.getOneEle(rctype);
\r\n\t
var rcpos = MapData.getRCPos(r, c);
\r\n\t
this.container.addChild(rcele);
\r\n\t
rcele.x = rcpos[0];
\r\n\t
rcele.y = rcpos[1];
\r\n\t
var rcidx = r +
\"
_
\"
+ c;
\r\n\t
this.lattices[rcidx] = rcele.name;
\r\n\t
this.setLatticeEleRc(rcidx);
\r\n\t
}
\r\n\t
}
\r\n\t
this.checkEliminate();
\r\n\t
};
\r\n\t
GameView.prototype.setLatticeEleRc = function (rcidx) {
\r\n\t
var rename = this.lattices[rcidx];
\r\n\t
var rcnode = this.container.getChildByName(rename);
\r\n\t
var er = Number(rcidx.split(
\"
_
\"
)[0]);
\r\n\t
var ec = Number(rcidx.split(
\"
_
\"
)[1]);
\r\n\t
rcnode.setrc(er, ec);
\r\n\t
};
\r\n\t
GameView.prototype.selectele = function (e) {
\r\n\t
var data = e.data;
\r\n\t
var sr = data.r;
\r\n\t
var sc = data.c;
\r\n\t
var sname = sr +
\"
_
\"
+ sc;
\r\n\t
if (this.selectArr.length == 0) {
\r\n\t
this.selectArr.push(sname);
\r\n\t
}
\r\n\t
else if (this.selectArr.length == 1) {
\r\n\t
var aselect = this.selectArr[0];
\r\n\t
var asr = aselect.split(
\"
_
\"
)[0];
\r\n\t
var asc = aselect.split(
\"
_
\"
)[1];
\r\n\t
if ((sr == asr && Math.abs(sc - asc) == 1) || (sc == asc && Math.abs(sr - asr) == 1)) {
\r\n\t
this.selectArr.push(sname);
\r\n\t
}
\r\n\t
else {
\r\n\t
this.selectArr[0] = sname;
\r\n\t
}
\r\n\t
}
\r\n\t
if (this.selectArr.length == 1) {
\r\n\t
this.setSelectShow();
\r\n\t
}
\r\n\t
else if (this.selectArr.length == 2) {
\r\n\t
this.changeElePos();
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.setSelectShow = function () {
\r\n\t
var rcname = this.selectArr[0];
\r\n\t
var r = rcname.split(
\"
_
\"
)[0];
\r\n\t
var c = rcname.split(
\"
_
\"
)[1];
\r\n\t
var rcpos = MapData.getRCPos(r, c);
\r\n\t
this.container.addChild(this.selectimg);
\r\n\t
this.selectimg.x = rcpos[0];
\r\n\t
this.selectimg.y = rcpos[1];
\r\n\t
};
\r\n\t
GameView.prototype.changeElePos = function () {
\r\n\t
var _this = this;
\r\n\t
this.container.removeChild(this.selectimg);
\r\n\t
this.changeEnable(false);
\r\n\t
var sname1 = this.selectArr[0];
\r\n\t
var sname2 = this.selectArr[1];
\r\n\t
var sename1 = this.lattices[sname1];
\r\n\t
var sename2 = this.lattices[sname2];
\r\n\t
this.lattices[sname1] = sename2;
\r\n\t
this.lattices[sname2] = sename1;
\r\n\t
this.setLatticeEleRc(sname1);
\r\n\t
this.setLatticeEleRc(sname2);
\r\n\t
this.checkEliminate();
\r\n\t
var snode1 = this.container.getChildByName(sename1);
\r\n\t
var snode2 = this.container.getChildByName(sename2);
\r\n\t
var snode1x = snode1.x;
\r\n\t
var snode1y = snode1.y;
\r\n\t
var snode2x = snode2.x;
\r\n\t
var snode2y = snode2.y;
\r\n\t
var changetime = Math.ceil((MapData.itemsize / this.anispeed) * 2 * 1000);
\r\n\t
if (this.eliminateArr.length > 0) {
\r\n\t
engine.Tween.get(snode1).to({
\r\n\t
x: snode2x,
\r\n\t
y: snode2y
\r\n\t
}, changetime);
\r\n\t
engine.Tween.get(snode2).to({
\r\n\t
x: snode1x,
\r\n\t
y: snode1y
\r\n\t
}, changetime)
\r\n\t
.call(function () {
\r\n\t
_this.eliminate();
\r\n\t
});
\r\n\t
}
\r\n\t
else {
\r\n\t
engine.Tween.get(snode1).to({
\r\n\t
x: snode2x,
\r\n\t
y: snode2y
\r\n\t
}, changetime)
\r\n\t
.wait(100)
\r\n\t
.to({
\r\n\t
x: snode1x,
\r\n\t
y: snode1y
\r\n\t
}, changetime);
\r\n\t
engine.Tween.get(snode2).to({
\r\n\t
x: snode1x,
\r\n\t
y: snode1y
\r\n\t
}, changetime)
\r\n\t
.wait(100)
\r\n\t
.to({
\r\n\t
x: snode2x,
\r\n\t
y: snode2y
\r\n\t
}, changetime)
\r\n\t
.call(function () {
\r\n\t
_this.lattices[sname1] = sename1;
\r\n\t
_this.lattices[sname2] = sename2;
\r\n\t
_this.setLatticeEleRc(sname1);
\r\n\t
_this.setLatticeEleRc(sname2);
\r\n\t
_this.selectArr = new Array();
\r\n\t
_this.changeEnable(true);
\r\n\t
});
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.eliminate = function () {
\r\n\t
for (var i = 0; i < this.eliminateArr.length; i++) {
\r\n\t
var ielidata = this.eliminateArr[i];
\r\n\t
var ielidxname = ielidata.idxname;
\r\n\t
var ielitype = ielidata.type;
\r\n\t
var ieliname = this.lattices[ielidxname];
\r\n\t
var ielinode = this.container.getChildByName(ieliname);
\r\n\t
var ielix = ielinode.x;
\r\n\t
var ieliy = ielinode.y;
\r\n\t
this.container.removeChild(ielinode);
\r\n\t
this.lattices[ielidxname] =
\"
empty
\"
;
\r\n\t
this.goHomeAni(ielitype, ielix, ieliy);
\r\n\t
}
\r\n\t
this.fall();
\r\n\t
};
\r\n\t
GameView.prototype.fall = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var fallData, fcutr, fc, r, c, idxname, elename, frcname, fetype, fele, cutr, fepos, fallPromise, _loop_1, this_1, f;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
switch (_a.label) {
\r\n\t
case 0:
\r\n\t
fallData = new Array();
\r\n\t
fcutr = new Array();
\r\n\t
for (fc = 0; fc < MapData.col; fc++) {
\r\n\t
fcutr.push(-1);
\r\n\t
}
\r\n\t
for (r = MapData.row - 1; r > -1; r--) {
\r\n\t
for (c = MapData.col - 1; c > -1; c--) {
\r\n\t
idxname = r +
\"
_
\"
+ c;
\r\n\t
elename = this.lattices[idxname];
\r\n\t
if (elename ==
\"
empty
\"
) {
\r\n\t
frcname = this.getFallRcEle(r, c);
\r\n\t
if (!frcname) {
\r\n\t
fetype = MapData.getRandEtype();
\r\n\t
fele = MapData.getOneEle(fetype);
\r\n\t
cutr = fcutr[c];
\r\n\t
fepos = MapData.getRCPos(cutr, c);
\r\n\t
fcutr[c] = cutr - 1;
\r\n\t
this.container.addChild(fele);
\r\n\t
fele.x = fepos[0];
\r\n\t
fele.y = fepos[1];
\r\n\t
frcname = fele.name;
\r\n\t
}
\r\n\t
this.lattices[idxname] = frcname;
\r\n\t
this.setLatticeEleRc(idxname);
\r\n\t
fallData.push({
\r\n\t
rcname: frcname,
\r\n\t
trow: r,
\r\n\t
tcol: c
\r\n\t
});
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
fallPromise = new Array();
\r\n\t
_loop_1 = function (f) {
\r\n\t
var fdata = fallData[f];
\r\n\t
var frcname = fdata.rcname;
\r\n\t
var ftrow = fdata.trow;
\r\n\t
var ftcol = fdata.tcol;
\r\n\t
var ftpos = MapData.getRCPos(ftrow, ftcol);
\r\n\t
var frcnode = this_1.container.getChildByName(frcname);
\r\n\t
var nepos = [frcnode.x, frcnode.y];
\r\n\t
var fdis = MapData.getDistance(ftpos, nepos);
\r\n\t
var ftime = Math.ceil((fdis / this_1.anispeed) * 1000);
\r\n\t
var ifallpromise = new Promise(function (res) {
\r\n\t
engine.Tween.get(frcnode)
\r\n\t
.to({
\r\n\t
x: ftpos[0],
\r\n\t
y: ftpos[1]
\r\n\t
}, ftime).call(function () {
\r\n\t
res();
\r\n\t
});
\r\n\t
});
\r\n\t
fallPromise.push(ifallpromise);
\r\n\t
};
\r\n\t
this_1 = this;
\r\n\t
for (f = 0; f < fallData.length; f++) {
\r\n\t
_loop_1(f);
\r\n\t
}
\r\n\t
return [4, Promise.all(fallPromise)];
\r\n\t
case 1:
\r\n\t
_a.sent();
\r\n\t
this.checkEliminate();
\r\n\t
if (this.eliminateArr.length > 0) {
\r\n\t
return [2, this.eliminate()];
\r\n\t
}
\r\n\t
else {
\r\n\t
this.selectArr = new Array();
\r\n\t
this.changeEnable(true);
\r\n\t
}
\r\n\t
return [2];
\r\n\t
}
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.goHomeAni = function (ielitype, ielix, ieliy) {
\r\n\t
var aniele = MapData.getOneEle(ielitype);
\r\n\t
aniele.touch = false;
\r\n\t
var anix = ielix;
\r\n\t
var aniy = ieliy + this.conty;
\r\n\t
this.anicontainer.addChild(aniele);
\r\n\t
aniele.x = anix;
\r\n\t
aniele.y = aniy;
\r\n\t
var anidis = MapData.getDistance([this.tanix, this.taniy], [anix, aniy]);
\r\n\t
var anitime = Math.ceil((anidis / this.anispeed) * 1000);
\r\n\t
engine.Tween.get(aniele)
\r\n\t
.to({
\r\n\t
x: this.tanix,
\r\n\t
y: this.taniy,
\r\n\t
scaleX: 0,
\r\n\t
scaleY: 0
\r\n\t
}, anitime);
\r\n\t
};
\r\n\t
GameView.prototype.changeEnable = function (v) {
\r\n\t
for (var key in this.lattices) {
\r\n\t
var kname = this.lattices[key];
\r\n\t
var ele = this.container.getChildByName(kname);
\r\n\t
ele.touch = v;
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.attionEliminate = function () {
\r\n\t
};
\r\n\t
GameView.prototype.checkEliminate = function () {
\r\n\t
this.eliminateArr = new Array();
\r\n\t
for (var r = MapData.row - 1; r > -1; r--) {
\r\n\t
for (var c = MapData.col - 1; c > -1; c--) {
\r\n\t
var edata = this.getEliminate(r, c);
\r\n\t
if (edata) {
\r\n\t
var etype = edata.etype;
\r\n\t
var earr = edata.arr;
\r\n\t
this.checkAddEli(etype, earr);
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.getEliminate = function (x, y) {
\r\n\t
var checktype = this.getEleTypeByRc(x, y);
\r\n\t
var relearr = new Array();
\r\n\t
relearr.push(x +
\"
_
\"
+ y);
\r\n\t
for (var r = x - 1; r > -1; r--) {
\r\n\t
var reletype = this.getEleTypeByRc(r, y);
\r\n\t
if (checktype == reletype) {
\r\n\t
relearr.push(r +
\"
_
\"
+ y);
\r\n\t
}
\r\n\t
else {
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
var celearr = new Array();
\r\n\t
celearr.push(x +
\"
_
\"
+ y);
\r\n\t
for (var c = y - 1; c > -1; c--) {
\r\n\t
var celetype = this.getEleTypeByRc(x, c);
\r\n\t
if (checktype == celetype) {
\r\n\t
celearr.push(x +
\"
_
\"
+ c);
\r\n\t
}
\r\n\t
else {
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
var eliminatearr = new Array();
\r\n\t
if (relearr.length >= 3) {
\r\n\t
eliminatearr.push.apply(eliminatearr, relearr);
\r\n\t
}
\r\n\t
if (celearr.length >= 3) {
\r\n\t
eliminatearr.push.apply(eliminatearr, celearr);
\r\n\t
}
\r\n\t
if (eliminatearr.length > 0) {
\r\n\t
return {
\r\n\t
etype: checktype,
\r\n\t
arr: eliminatearr
\r\n\t
};
\r\n\t
}
\r\n\t
else {
\r\n\t
return false;
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.getEleTypeByRc = function (r, c) {
\r\n\t
var rc = r +
\"
_
\"
+ c;
\r\n\t
var elename = this.lattices[rc];
\r\n\t
var ele = this.container.getChildByName(elename);
\r\n\t
var eletype = ele.type;
\r\n\t
return eletype;
\r\n\t
};
\r\n\t
GameView.prototype.checkAddEli = function (etype, earr) {
\r\n\t
for (var e = 0; e < earr.length; e++) {
\r\n\t
var ename = earr[e];
\r\n\t
var needadd = true;
\r\n\t
for (var i = 0; i < this.eliminateArr.length; i++) {
\r\n\t
var ielidata = this.eliminateArr[i];
\r\n\t
var ielidxname = ielidata.idxname;
\r\n\t
if (ielidxname == ename) {
\r\n\t
needadd = false;
\r\n\t
break;
\r\n\t
}
\r\n\t
}
\r\n\t
if (needadd) {
\r\n\t
this.eliminateArr.push({
\r\n\t
idxname: ename,
\r\n\t
type: etype
\r\n\t
});
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.getFallRcEle = function (r, c) {
\r\n\t
for (var fr = r - 1; fr > -1; fr--) {
\r\n\t
var frc = fr +
\"
_
\"
+ c;
\r\n\t
var frcname = this.lattices[frc];
\r\n\t
if (frcname !=
\"
empty
\"
) {
\r\n\t
this.lattices[frc] =
\"
empty
\"
;
\r\n\t
return frcname;
\r\n\t
}
\r\n\t
}
\r\n\t
return 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
_this._gameView = new GameView();
\r\n\t
_this.addChild(_this._gameView);
\r\n\t
engine.globalEvent.addEventListener('game-init', _this.init, _this);
\r\n\t
engine.globalEvent.addEventListener('game-reset', _this.reset, _this);
\r\n\t
engine.globalEvent.addEventListener('game-start', _this.start, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.init = function () {
\r\n\t
this._gameView.init();
\r\n\t
};
\r\n\t
GameWrapper.prototype.reset = function () {
\r\n\t
this._gameView.reset();
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function () {
\r\n\t
this._gameView.start();
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.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
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/bjxd-game/meta.json
View file @
e0fcb941
...
...
@@ -97,19 +97,19 @@
"assets"
:
[
{
"name"
:
"bg1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
b2c76b2a753317e5ea935bab22097a43a4c9f7cb
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
e6ab7c1e191d30a2b068fa4a0e867040b9396226
.png"
,
"uuid"
:
"bg1"
,
"ext"
:
".png"
},
{
"name"
:
"bg2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7f8261a9dd7b83cdc3b95b6f3f385e7a91e49682
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
a2d611fa5af2b26ffd57a24ff524d2a0a4fe1564
.png"
,
"uuid"
:
"bg2"
,
"ext"
:
".png"
},
{
"name"
:
"bg3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
72c688f9c2f495fe234277256923804df2ab75e
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
9258aed59e36471a4136ce7fbc4ca7e300caf07
.png"
,
"uuid"
:
"bg3"
,
"ext"
:
".png"
},
...
...
@@ -121,13 +121,13 @@
},
{
"name"
:
"yindao1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
f21d5429dbd947e66613bd6c5d864fdcfd104bd4
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
4449285320882460ae0dd0b59b3c73e0bb92def6
.png"
,
"uuid"
:
"yindao1"
,
"ext"
:
".png"
},
{
"name"
:
"yindao2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7ece2d8c438ec06004f7f40d9798ab72f0e6a244
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
1c914031834736b93e9b2a94a4e8a643871795f7
.png"
,
"uuid"
:
"yindao2"
,
"ext"
:
".png"
},
...
...
src/custom/xiaoxiaole/debug/app.js
View file @
e0fcb941
...
...
@@ -2,7 +2,7 @@
* Created by renjianfeng on 2020-03-13.
*/
const
customId
=
'
food-fell
'
;
const
customId
=
'
xiaoxiaole
'
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
...
...
@@ -45,23 +45,9 @@ function launchWithCustomModule(customModule) {
},
100
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-reset'
,
{
"goodsProbability"
:
[
0.8
,
0.1
,
0.1
],
"countDown"
:
30
,
"acceleratedSpeed"
:
0.1
});
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-start'
);
engine
.
globalEvent
.
dispatchEvent
(
'game-init'
);
},
500
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-time-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-score-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-game-over'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
}
function
getAssetByUUID
(
uuid
)
{
...
...
src/custom/xiaoxiaole/debug/index.html
View file @
e0fcb941
...
...
@@ -3,7 +3,7 @@
<head>
<meta
charset=
"UTF-8"
>
<title>
美食从天而降
</title>
<title>
消消乐
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
...
...
@@ -22,7 +22,7 @@
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
red
;
/* background-color: red; */
}
</style>
</head>
...
...
src/custom/xiaoxiaole/debug/main.js
View file @
e0fcb941
"use strict"
;
var
tslib
=
require
(
"tslib"
),
props
=
{};
function
prepareProps
(){
var
e
=
getProps
();
engine
.
injectProp
(
props
,
e
)}
function
injectProps
(
e
){
engine
.
injectProp
(
props
,
e
)}
function
getTexture
(
e
){
return
engine
.
Texture
.
from
(
getAssetByUUID
(
e
).
uuid
)}
function
getTextureByName
(
e
){
return
getTexture
(
engine
.
getAssetByName
(
e
).
uuid
)}
function
createSvga
(
e
,
t
){
var
o
=
new
svga
.
Svga
;
return
o
.
source
=
"asset://"
+
engine
.
getAssetByName
(
e
).
uuid
,
o
}
var
Goods
=
function
(
s
){
function
e
(){
var
e
,
t
=
s
.
call
(
this
)
||
this
;
e
=
t
.
_body
=
new
engine
.
Rect
;
var
o
=
new
engine
.
Sprite
(
getTextureByName
(
"雨滴"
));
o
.
npcType
=
"rain"
;
var
n
=
new
engine
.
Sprite
(
getTextureByName
(
"石块"
));
n
.
npcType
=
"stone"
;
var
i
=
new
engine
.
Sprite
(
getTextureByName
(
"炸弹"
));
return
i
.
npcType
=
"boom"
,
o
.
visible
=!
1
,
n
.
visible
=!
1
,
i
.
visible
=!
1
,
e
.
addChild
(
o
),
e
.
addChild
(
n
),
e
.
addChild
(
i
),
t
.
addChild
(
e
),
e
.
width
=
1
e
-
4
,
e
.
height
=
1
e
-
4
,
e
.
mouseEnabled
=!
1
,
t
}
return
tslib
.
__extends
(
e
,
s
),
e
.
prototype
.
getRandomNumberByRange
=
function
(
e
,
t
){
return
Math
.
floor
(
Math
.
random
()
*
(
t
-
e
)
+
e
)},
e
.
prototype
.
reset
=
function
(){
this
.
visible
=!
0
,
this
.
rotation
=
0
,
this
.
anchorOffsetY
=
0
,
this
.
y
=
0
,
this
.
x
=
630
*
Math
.
random
()
+
30
,
this
.
rotation
=
0
;
var
e
=
Math
.
random
();
e
<
props
.
goodsProbability
[
0
]?
this
.
showNpc
(
"rain"
):
e
>=
props
.
goodsProbability
[
0
]
&&
e
<=
props
.
goodsProbability
[
0
]
+
props
.
goodsProbability
[
1
]?
this
.
showNpc
(
"stone"
):
e
>
props
.
goodsProbability
[
0
]
+
props
.
goodsProbability
[
1
]
&&
this
.
showNpc
(
"boom"
)},
e
.
prototype
.
showNpc
=
function
(
e
){
for
(
var
t
=
0
;
t
<
this
.
_body
.
children
.
length
;
t
++
)
this
.
_body
.
children
[
t
].
visible
=!
1
,
this
.
_body
.
children
[
t
].
mouseEnabled
=!
1
;
for
(
t
=
0
;
t
<
this
.
_body
.
children
.
length
;
t
++
)
this
.
_body
.
children
[
t
].
npcType
==
e
&&
(
this
.
npcType
=
e
,
this
.
_body
.
children
[
t
].
visible
=!
0
,
this
.
_body
.
children
[
t
].
mouseEnabled
=!
1
)},
Object
.
defineProperty
(
e
.
prototype
,
"anchorOffsetY"
,{
set
:
function
(
e
){
this
.
_body
.
y
=
e
},
enumerable
:
!
0
,
configurable
:
!
0
}),
e
}(
engine
.
Container
),
ObjectPool
=
engine
.
ObjectPool
,
PoolName
=
"goods"
;
ObjectPool
.
registerPool
(
PoolName
,
function
(){
return
new
Goods
},
function
(
e
,
t
){
e
.
reset
()});
var
ObjectPool$1
=
engine
.
ObjectPool
,
GameView
=
function
(
e
){
function
t
(){
var
t
=
e
.
call
(
this
)
||
this
;
return
t
.
goodsItems
=
[],
t
.
moveCatchX
=
0
,
t
.
playerCatchX
=
0
,
t
.
onDownStage
=
function
(
e
){
t
.
moveCatchX
=
e
.
localX
,
t
.
playerCatchX
=
t
.
player
.
x
},
t
.
onMoveStage
=
function
(
e
){
t
.
gameIng
&&
(
t
.
player
.
x
=
t
.
playerCatchX
+
(
e
.
localX
-
t
.
moveCatchX
))},
t
.
onOutStage
=
function
(
e
){
t
.
moveCatchX
=
0
},
t
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
t
.
setup
,
t
),
t
}
return
tslib
.
__extends
(
t
,
e
),
t
.
prototype
.
setup
=
function
(){
var
e
=
this
;
this
.
_hasSetup
||
(
this
.
_hasSetup
=!
0
,
this
.
NpcBg
=
new
engine
.
Container
,
this
.
NpcBg
.
alpha
=
1
,
this
.
NpcBg
.
width
=
0
,
this
.
NpcBg
.
height
=
0
,
this
.
addChild
(
this
.
NpcBg
),
this
.
player
=
new
engine
.
Container
,
this
.
player
.
mouseEnabled
=!
1
,
this
.
addChild
(
this
.
player
),
this
.
waterSvga
=
createSvga
(
"水花"
),
this
.
playerSvga
=
createSvga
(
"玩家"
),
this
.
boomSvga
=
createSvga
(
"炸弹svga"
),
this
.
player
.
addChild
(
this
.
playerSvga
),
this
.
player
.
addChild
(
this
.
waterSvga
),
this
.
player
.
addChild
(
this
.
boomSvga
),
this
.
playerSvga
.
gotoAndPlay
(
1
),
this
.
visible
=!
1
,
setTimeout
(
function
(){
e
.
visible
=!
0
,
e
.
player
.
anchorY
=
e
.
player
.
height
/
2
,
e
.
player
.
anchorX
=
e
.
player
.
width
/
2
,
console
.
log
(
e
.
player
.
width
),
console
.
log
(
e
.
playerSvga
.
width
),
e
.
player
.
x
=
375
-
e
.
player
.
width
/
2
,
e
.
player
.
y
=
props
.
playerPositionY
},
300
),
this
.
rectBg
=
new
engine
.
Rect
,
this
.
rectBg
.
alpha
=
0
,
this
.
rectBg
.
width
=
750
,
this
.
rectBg
.
height
=
1624
,
this
.
addChild
(
this
.
rectBg
),
this
.
rectBg
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDownStage
,
this
),
this
.
rectBg
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onMoveStage
,
this
),
this
.
rectBg
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_OUT
,
this
.
onOutStage
,
this
))},
t
.
prototype
.
reset
=
function
(){
this
.
recycleGoods
()},
t
.
prototype
.
start
=
function
(){
var
e
=
this
;
this
.
score
=
0
,
this
.
speed
=
1
,
this
.
gameIng
=!
0
,
this
.
creatNpc
(),
this
.
beginNpc
(),
this
.
countdown
=
props
.
countDown
,
this
.
countdownTimer
=
setInterval
(
function
(){
e
.
gameIng
&&
(
0
<
e
.
countdown
?(
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-time-update"
,{
time
:
e
.
countdown
}),
e
.
countdown
-=
1
):(
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-game-over"
,{
score
:
e
.
score
,
reason
:
1
}),
e
.
died
()))},
1
e3
)},
t
.
prototype
.
beginNpc
=
function
(){
var
e
=
this
;
this
.
timer
=
setTimeout
(
function
(){
e
.
gameIng
&&
(
e
.
speed
+=
props
.
acceleratedSpeed
,
e
.
creatNpc
()),
e
.
beginNpc
()},
2
e3
/
this
.
speed
)},
t
.
prototype
.
pause
=
function
(){
this
.
gameIng
=!
1
},
t
.
prototype
.
revive
=
function
(){
this
.
gameIng
=!
0
},
t
.
prototype
.
resume
=
function
(){
this
.
reset
(),
this
.
start
()},
t
.
prototype
.
creatNpc
=
function
(){
var
e
=
this
,
t
=
this
.
_goods
=
ObjectPool$1
.
getObject
(
PoolName
);
this
.
goodsItems
.
push
(
t
),
this
.
NpcBg
.
addChild
(
t
),
t
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
t
.
onGoodsEnter
=
function
(){
1624
<
t
.
y
?
e
.
removeNpc
(
t
):
e
.
gameIng
&&
(
t
.
y
+=
4
*
e
.
speed
,
e
.
hasHit
(
e
.
player
,
t
)
&&
(
"rain"
==
t
.
npcType
?(
console
.
log
(
"碰到雨滴"
),
e
.
score
+=
props
.
rainScore
,
e
.
waterSvga
.
visible
=!
0
,
e
.
waterSvga
.
play
(
!
1
,
!
1
),
e
.
waterSvga
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
e
.
waterSvga
.
visible
=!
1
},
e
)):
"stone"
==
t
.
npcType
?(
console
.
log
(
"碰到石头"
),
e
.
score
+=
props
.
stoneScore
):
"boom"
==
t
.
npcType
&&
(
console
.
log
(
"碰到炸弹"
),
e
.
boomSvga
.
visible
=!
0
,
e
.
boomSvga
.
play
(
!
1
,
!
1
),
e
.
boomSvga
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
e
.
boomSvga
.
visible
=!
1
},
e
),
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-game-over"
,{
score
:
e
.
score
,
reason
:
2
}),
e
.
died
()),
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-score-update"
,{
score
:
e
.
score
}),
e
.
removeNpc
(
t
)))},
this
)},
t
.
prototype
.
died
=
function
(){
this
.
score
=
0
,
this
.
pause
()},
t
.
prototype
.
removeNpc
=
function
(
e
){
this
.
NpcBg
.
removeChild
(
e
),
ObjectPool$1
.
recycleObject
(
PoolName
,
e
),
e
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
e
.
onGoodsEnter
,
this
);
var
t
=
this
.
goodsItems
.
indexOf
(
e
);
-
1
<
t
&&
this
.
goodsItems
.
splice
(
t
,
1
)},
t
.
prototype
.
recycleGoods
=
function
(){
clearTimeout
(
this
.
timer
),
clearInterval
(
this
.
countdownTimer
);
for
(
var
e
=
0
,
t
=
this
.
goodsItems
;
e
<
t
.
length
;
e
++
){
var
o
=
t
[
e
];
o
&&
(
this
.
removeChild
(
o
),
ObjectPool$1
.
recycleObject
(
PoolName
,
o
),
o
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
o
.
onGoodsEnter
,
this
))}
this
.
goodsItems
=
[]},
t
.
prototype
.
hasHit
=
function
(
e
,
t
){
return
Math
.
abs
(
e
.
x
+
e
.
width
/
2
-
(
t
.
x
+
t
.
width
/
2
))
<
e
.
width
/
2
+
t
.
width
/
2
&&
Math
.
abs
(
e
.
y
+
e
.
height
/
2
-
(
t
.
y
+
t
.
height
/
2
))
<
e
.
height
/
2
+
t
.
height
/
2
},
t
}(
engine
.
Container
),
GameWrapper
=
function
(
o
){
function
e
(){
var
e
=
o
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
"food-fell-reset"
,
e
.
reset
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-start"
,
e
.
start
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-pause"
,
e
.
pause
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-resume"
,
e
.
resume
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-revive"
,
e
.
revive
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-clear"
,
e
.
clear
,
e
),
e
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
e
.
onTap
,
e
);
var
t
=
e
.
_gameView
=
new
GameView
;
return
e
.
addChild
(
t
),
e
}
return
tslib
.
__extends
(
e
,
o
),
e
.
prototype
.
reset
=
function
(
e
){
injectProps
(
e
.
data
),
this
.
_gameView
.
visible
=!
0
,
this
.
_gameView
.
reset
()},
e
.
prototype
.
start
=
function
(
e
){
injectProps
(
e
.
data
),
this
.
_status
=
1
,
this
.
_gameView
.
start
()},
e
.
prototype
.
pause
=
function
(){
this
.
_gameView
.
pause
()},
e
.
prototype
.
resume
=
function
(){
this
.
_gameView
.
resume
()},
e
.
prototype
.
revive
=
function
(){
this
.
_gameView
.
revive
()},
e
.
prototype
.
clear
=
function
(){
this
.
_gameView
.
visible
=!
1
},
e
.
prototype
.
onTap
=
function
(
e
){},
e
}(
engine
.
Container
);
function
index
(
e
){
return
prepareProps
(),
injectProps
(
e
),
new
GameWrapper
}
module
.
exports
=
index
;
(
function
(
global
,
factory
)
{
typeof
exports
===
'object'
&&
typeof
module
!==
'undefined'
?
module
.
exports
=
factory
(
require
(
'tslib'
))
:
typeof
define
===
'function'
&&
define
.
amd
?
define
([
'tslib'
],
factory
)
:
(
global
=
global
||
self
,
global
.
xiaoxiaole
=
factory
(
global
.
tslib
));
}(
this
,
(
function
(
tslib
)
{
'use strict'
;
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
//# sourceMappingURL=utils.js.map
var
Element
=
(
function
(
_super
)
{
tslib
.
__extends
(
Element
,
_super
);
function
Element
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
width
=
MapData
.
itemsize
;
_this
.
height
=
MapData
.
itemsize
;
_this
.
eimage
=
new
engine
.
Image
();
_this
.
addChild
(
_this
.
eimage
);
_this
.
touch
=
true
;
_this
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
_this
.
selectele
,
_this
);
return
_this
;
}
Object
.
defineProperty
(
Element
.
prototype
,
"touch"
,
{
set
:
function
(
touch
)
{
this
.
mouseEnabled
=
touch
;
this
.
mouseChildren
=
touch
;
},
enumerable
:
true
,
configurable
:
true
});
Element
.
prototype
.
init
=
function
(
type
)
{
this
.
scaleX
=
1
;
this
.
scaleY
=
1
;
this
.
type
=
type
;
var
ename
=
MapData
.
getEtypeImgName
(
type
);
this
.
eimage
.
texture
=
getTextureByName
(
ename
);
var
imgwid
=
this
.
eimage
.
texture
.
width
;
var
imghei
=
this
.
eimage
.
texture
.
height
;
this
.
eimage
.
x
=
(
this
.
width
-
imgwid
)
/
2
;
this
.
eimage
.
y
=
(
this
.
height
-
imghei
)
/
2
;
};
Element
.
prototype
.
setrc
=
function
(
r
,
c
)
{
this
.
inrow
=
r
;
this
.
incol
=
c
;
};
Element
.
prototype
.
selectele
=
function
(
e
)
{
engine
.
globalEvent
.
dispatchEvent
(
GameEvent
.
SelectEle
,
{
r
:
this
.
inrow
,
c
:
this
.
incol
});
};
Element
.
prototype
.
flyToHome
=
function
()
{
};
Element
.
prototype
.
changePos
=
function
()
{
};
return
Element
;
}(
engine
.
Container
));
//# sourceMappingURL=Element.js.map
var
ElementType
;
(
function
(
ElementType
)
{
ElementType
[
ElementType
[
"btiger"
]
=
1
]
=
"btiger"
;
ElementType
[
ElementType
[
"gtiger"
]
=
2
]
=
"gtiger"
;
ElementType
[
ElementType
[
"monkey"
]
=
3
]
=
"monkey"
;
ElementType
[
ElementType
[
"bird"
]
=
4
]
=
"bird"
;
ElementType
[
ElementType
[
"koala"
]
=
5
]
=
"koala"
;
})(
ElementType
||
(
ElementType
=
{}));
var
GameEvent
;
(
function
(
GameEvent
)
{
GameEvent
[
"SelectEle"
]
=
"SelectEle"
;
})(
GameEvent
||
(
GameEvent
=
{}));
var
MapData
=
(
function
()
{
function
MapData
()
{
}
MapData
.
getRy
=
function
(
r
)
{
return
this
.
paddingb
+
r
*
(
this
.
itemsize
+
this
.
paddingi
);
};
MapData
.
getCx
=
function
(
c
)
{
return
this
.
paddingb
+
c
*
(
this
.
itemsize
+
this
.
paddingi
);
};
MapData
.
getRCPos
=
function
(
r
,
c
)
{
var
x
=
this
.
getCx
(
c
);
var
y
=
this
.
getRy
(
r
);
return
[
x
,
y
];
};
MapData
.
adaptElePos
=
function
(
pos
,
wid
,
hei
)
{
var
x
=
pos
[
0
]
+
(
this
.
itemsize
-
wid
)
/
2
;
var
y
=
pos
[
1
]
+
(
this
.
itemsize
-
hei
)
/
2
;
return
[
x
,
y
];
};
MapData
.
getEtypeImgName
=
function
(
type
)
{
var
ename
;
switch
(
type
)
{
case
ElementType
.
btiger
:
ename
=
"白虎"
;
break
;
case
ElementType
.
gtiger
:
ename
=
"雌虎"
;
break
;
case
ElementType
.
monkey
:
ename
=
"猴子"
;
break
;
case
ElementType
.
bird
:
ename
=
"鸟"
;
break
;
case
ElementType
.
koala
:
ename
=
"树熊"
;
break
;
default
:
console
.
error
(
"未定义元素类型"
);
break
;
}
return
ename
;
};
MapData
.
getRandEtype
=
function
()
{
var
eletypeArr
=
[
ElementType
.
btiger
,
ElementType
.
gtiger
,
ElementType
.
monkey
,
ElementType
.
bird
,
ElementType
.
koala
];
var
etype
=
eletypeArr
[
Math
.
floor
(
Math
.
random
()
*
eletypeArr
.
length
)];
return
etype
;
};
MapData
.
getOneEle
=
function
(
type
)
{
var
ele
;
if
(
this
.
elePool
.
length
>
0
)
{
ele
=
this
.
elePool
.
shift
();
}
else
{
ele
=
new
Element
();
}
ele
.
name
=
"ele_"
+
this
.
eleidx
;
this
.
eleidx
+=
1
;
ele
.
init
(
type
);
return
ele
;
};
MapData
.
recoverEle
=
function
(
ele
)
{
this
.
elePool
.
push
(
ele
);
};
MapData
.
getDistance
=
function
(
p1
,
p2
)
{
var
p1x
=
p1
[
0
];
var
p1y
=
p1
[
1
];
var
p2x
=
p2
[
0
];
var
p2y
=
p2
[
1
];
var
dis
=
Math
.
sqrt
(
Math
.
pow
(
p1x
-
p2x
,
2
)
+
Math
.
pow
(
p1y
-
p2y
,
2
));
return
dis
;
};
MapData
.
itemsize
=
129
;
MapData
.
paddingb
=
10
;
MapData
.
paddingi
=
5
;
MapData
.
row
=
5
;
MapData
.
col
=
5
;
MapData
.
posData
=
{};
MapData
.
eleidx
=
1
;
MapData
.
elePool
=
[];
return
MapData
;
}());
//# sourceMappingURL=MapData.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
lattices
=
{};
_this
.
eliminateArr
=
[];
_this
.
selectArr
=
[];
_this
.
conty
=
140
;
_this
.
homex
=
528
;
_this
.
anispeed
=
860
;
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
}
GameView
.
prototype
.
setup
=
function
()
{
this
.
selectimg
=
new
engine
.
Image
(
getTextureByName
(
"选中框"
));
this
.
selectimg
.
mouseEnabled
=
false
;
var
row
=
MapData
.
row
;
var
col
=
MapData
.
col
;
this
.
homeimg
=
new
engine
.
Image
(
getTextureByName
(
"房子"
));
this
.
addChild
(
this
.
homeimg
);
this
.
homeimg
.
x
=
this
.
homex
;
this
.
container
=
new
engine
.
Container
();
this
.
addChild
(
this
.
container
);
this
.
container
.
y
=
this
.
conty
;
this
.
anicontainer
=
new
engine
.
Container
();
this
.
addChild
(
this
.
anicontainer
);
this
.
anicontainer
.
mouseEnabled
=
false
;
this
.
anicontainer
.
mouseChildren
=
false
;
var
map
=
new
engine
.
Image
(
getTextureByName
(
"底图"
));
this
.
container
.
addChild
(
map
);
for
(
var
r
=
0
;
r
<
row
;
r
++
)
{
for
(
var
c
=
0
;
c
<
col
;
c
++
)
{
var
rcpos
=
MapData
.
getRCPos
(
r
,
c
);
MapData
.
posData
[
r
+
"_"
+
c
]
=
rcpos
;
}
}
this
.
tanix
=
this
.
homex
+
this
.
homeimg
.
texture
.
width
/
2
;
this
.
taniy
=
this
.
homeimg
.
texture
.
height
/
2
;
engine
.
globalEvent
.
addEventListener
(
GameEvent
.
SelectEle
,
this
.
selectele
,
this
);
this
.
removeEventListener
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
};
GameView
.
prototype
.
init
=
function
()
{
this
.
initContainer
();
};
GameView
.
prototype
.
reset
=
function
()
{
};
GameView
.
prototype
.
start
=
function
()
{
};
GameView
.
prototype
.
initContainer
=
function
()
{
this
.
lattices
=
{};
var
testdata
=
[
[
1
,
2
,
5
,
3
,
4
],
[
3
,
1
,
2
,
4
,
5
],
[
2
,
5
,
3
,
4
,
1
],
[
5
,
4
,
1
,
2
,
3
],
[
4
,
1
,
3
,
5
,
2
],
];
for
(
var
r
=
0
;
r
<
testdata
.
length
;
r
++
)
{
var
rdata
=
testdata
[
r
];
for
(
var
c
=
0
;
c
<
rdata
.
length
;
c
++
)
{
var
rctype
=
rdata
[
c
];
var
rcele
=
MapData
.
getOneEle
(
rctype
);
var
rcpos
=
MapData
.
getRCPos
(
r
,
c
);
this
.
container
.
addChild
(
rcele
);
rcele
.
x
=
rcpos
[
0
];
rcele
.
y
=
rcpos
[
1
];
var
rcidx
=
r
+
"_"
+
c
;
this
.
lattices
[
rcidx
]
=
rcele
.
name
;
this
.
setLatticeEleRc
(
rcidx
);
}
}
this
.
checkEliminate
();
};
GameView
.
prototype
.
setLatticeEleRc
=
function
(
rcidx
)
{
var
rename
=
this
.
lattices
[
rcidx
];
var
rcnode
=
this
.
container
.
getChildByName
(
rename
);
var
er
=
Number
(
rcidx
.
split
(
"_"
)[
0
]);
var
ec
=
Number
(
rcidx
.
split
(
"_"
)[
1
]);
rcnode
.
setrc
(
er
,
ec
);
};
GameView
.
prototype
.
selectele
=
function
(
e
)
{
var
data
=
e
.
data
;
var
sr
=
data
.
r
;
var
sc
=
data
.
c
;
var
sname
=
sr
+
"_"
+
sc
;
if
(
this
.
selectArr
.
length
==
0
)
{
this
.
selectArr
.
push
(
sname
);
}
else
if
(
this
.
selectArr
.
length
==
1
)
{
var
aselect
=
this
.
selectArr
[
0
];
var
asr
=
aselect
.
split
(
"_"
)[
0
];
var
asc
=
aselect
.
split
(
"_"
)[
1
];
if
((
sr
==
asr
&&
Math
.
abs
(
sc
-
asc
)
==
1
)
||
(
sc
==
asc
&&
Math
.
abs
(
sr
-
asr
)
==
1
))
{
this
.
selectArr
.
push
(
sname
);
}
else
{
this
.
selectArr
[
0
]
=
sname
;
}
}
if
(
this
.
selectArr
.
length
==
1
)
{
this
.
setSelectShow
();
}
else
if
(
this
.
selectArr
.
length
==
2
)
{
this
.
changeElePos
();
}
};
GameView
.
prototype
.
setSelectShow
=
function
()
{
var
rcname
=
this
.
selectArr
[
0
];
var
r
=
rcname
.
split
(
"_"
)[
0
];
var
c
=
rcname
.
split
(
"_"
)[
1
];
var
rcpos
=
MapData
.
getRCPos
(
r
,
c
);
this
.
container
.
addChild
(
this
.
selectimg
);
this
.
selectimg
.
x
=
rcpos
[
0
];
this
.
selectimg
.
y
=
rcpos
[
1
];
};
GameView
.
prototype
.
changeElePos
=
function
()
{
var
_this
=
this
;
this
.
container
.
removeChild
(
this
.
selectimg
);
this
.
changeEnable
(
false
);
var
sname1
=
this
.
selectArr
[
0
];
var
sname2
=
this
.
selectArr
[
1
];
var
sename1
=
this
.
lattices
[
sname1
];
var
sename2
=
this
.
lattices
[
sname2
];
this
.
lattices
[
sname1
]
=
sename2
;
this
.
lattices
[
sname2
]
=
sename1
;
this
.
setLatticeEleRc
(
sname1
);
this
.
setLatticeEleRc
(
sname2
);
this
.
checkEliminate
();
var
snode1
=
this
.
container
.
getChildByName
(
sename1
);
var
snode2
=
this
.
container
.
getChildByName
(
sename2
);
var
snode1x
=
snode1
.
x
;
var
snode1y
=
snode1
.
y
;
var
snode2x
=
snode2
.
x
;
var
snode2y
=
snode2
.
y
;
var
changetime
=
Math
.
ceil
((
MapData
.
itemsize
/
this
.
anispeed
)
*
2
*
1000
);
if
(
this
.
eliminateArr
.
length
>
0
)
{
engine
.
Tween
.
get
(
snode1
).
to
({
x
:
snode2x
,
y
:
snode2y
},
changetime
);
engine
.
Tween
.
get
(
snode2
).
to
({
x
:
snode1x
,
y
:
snode1y
},
changetime
)
.
call
(
function
()
{
_this
.
eliminate
();
});
}
else
{
engine
.
Tween
.
get
(
snode1
).
to
({
x
:
snode2x
,
y
:
snode2y
},
changetime
)
.
wait
(
100
)
.
to
({
x
:
snode1x
,
y
:
snode1y
},
changetime
);
engine
.
Tween
.
get
(
snode2
).
to
({
x
:
snode1x
,
y
:
snode1y
},
changetime
)
.
wait
(
100
)
.
to
({
x
:
snode2x
,
y
:
snode2y
},
changetime
)
.
call
(
function
()
{
_this
.
lattices
[
sname1
]
=
sename1
;
_this
.
lattices
[
sname2
]
=
sename2
;
_this
.
setLatticeEleRc
(
sname1
);
_this
.
setLatticeEleRc
(
sname2
);
_this
.
selectArr
=
new
Array
();
_this
.
changeEnable
(
true
);
});
}
};
GameView
.
prototype
.
eliminate
=
function
()
{
for
(
var
i
=
0
;
i
<
this
.
eliminateArr
.
length
;
i
++
)
{
var
ielidata
=
this
.
eliminateArr
[
i
];
var
ielidxname
=
ielidata
.
idxname
;
var
ielitype
=
ielidata
.
type
;
var
ieliname
=
this
.
lattices
[
ielidxname
];
var
ielinode
=
this
.
container
.
getChildByName
(
ieliname
);
var
ielix
=
ielinode
.
x
;
var
ieliy
=
ielinode
.
y
;
this
.
container
.
removeChild
(
ielinode
);
this
.
lattices
[
ielidxname
]
=
"empty"
;
this
.
goHomeAni
(
ielitype
,
ielix
,
ieliy
);
}
this
.
fall
();
};
GameView
.
prototype
.
fall
=
function
()
{
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
fallData
,
fcutr
,
fc
,
r
,
c
,
idxname
,
elename
,
frcname
,
fetype
,
fele
,
cutr
,
fepos
,
fallPromise
,
_loop_1
,
this_1
,
f
;
return
tslib
.
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
fallData
=
new
Array
();
fcutr
=
new
Array
();
for
(
fc
=
0
;
fc
<
MapData
.
col
;
fc
++
)
{
fcutr
.
push
(
-
1
);
}
for
(
r
=
MapData
.
row
-
1
;
r
>
-
1
;
r
--
)
{
for
(
c
=
MapData
.
col
-
1
;
c
>
-
1
;
c
--
)
{
idxname
=
r
+
"_"
+
c
;
elename
=
this
.
lattices
[
idxname
];
if
(
elename
==
"empty"
)
{
frcname
=
this
.
getFallRcEle
(
r
,
c
);
if
(
!
frcname
)
{
fetype
=
MapData
.
getRandEtype
();
fele
=
MapData
.
getOneEle
(
fetype
);
cutr
=
fcutr
[
c
];
fepos
=
MapData
.
getRCPos
(
cutr
,
c
);
fcutr
[
c
]
=
cutr
-
1
;
this
.
container
.
addChild
(
fele
);
fele
.
x
=
fepos
[
0
];
fele
.
y
=
fepos
[
1
];
frcname
=
fele
.
name
;
}
this
.
lattices
[
idxname
]
=
frcname
;
this
.
setLatticeEleRc
(
idxname
);
fallData
.
push
({
rcname
:
frcname
,
trow
:
r
,
tcol
:
c
});
}
}
}
fallPromise
=
new
Array
();
_loop_1
=
function
(
f
)
{
var
fdata
=
fallData
[
f
];
var
frcname
=
fdata
.
rcname
;
var
ftrow
=
fdata
.
trow
;
var
ftcol
=
fdata
.
tcol
;
var
ftpos
=
MapData
.
getRCPos
(
ftrow
,
ftcol
);
var
frcnode
=
this_1
.
container
.
getChildByName
(
frcname
);
var
nepos
=
[
frcnode
.
x
,
frcnode
.
y
];
var
fdis
=
MapData
.
getDistance
(
ftpos
,
nepos
);
var
ftime
=
Math
.
ceil
((
fdis
/
this_1
.
anispeed
)
*
1000
);
var
ifallpromise
=
new
Promise
(
function
(
res
)
{
engine
.
Tween
.
get
(
frcnode
)
.
to
({
x
:
ftpos
[
0
],
y
:
ftpos
[
1
]
},
ftime
).
call
(
function
()
{
res
();
});
});
fallPromise
.
push
(
ifallpromise
);
};
this_1
=
this
;
for
(
f
=
0
;
f
<
fallData
.
length
;
f
++
)
{
_loop_1
(
f
);
}
return
[
4
,
Promise
.
all
(
fallPromise
)];
case
1
:
_a
.
sent
();
this
.
checkEliminate
();
if
(
this
.
eliminateArr
.
length
>
0
)
{
return
[
2
,
this
.
eliminate
()];
}
else
{
this
.
selectArr
=
new
Array
();
this
.
changeEnable
(
true
);
}
return
[
2
];
}
});
});
};
GameView
.
prototype
.
goHomeAni
=
function
(
ielitype
,
ielix
,
ieliy
)
{
var
aniele
=
MapData
.
getOneEle
(
ielitype
);
aniele
.
touch
=
false
;
var
anix
=
ielix
;
var
aniy
=
ieliy
+
this
.
conty
;
this
.
anicontainer
.
addChild
(
aniele
);
aniele
.
x
=
anix
;
aniele
.
y
=
aniy
;
var
anidis
=
MapData
.
getDistance
([
this
.
tanix
,
this
.
taniy
],
[
anix
,
aniy
]);
var
anitime
=
Math
.
ceil
((
anidis
/
this
.
anispeed
)
*
1000
);
engine
.
Tween
.
get
(
aniele
)
.
to
({
x
:
this
.
tanix
,
y
:
this
.
taniy
,
scaleX
:
0
,
scaleY
:
0
},
anitime
);
};
GameView
.
prototype
.
changeEnable
=
function
(
v
)
{
for
(
var
key
in
this
.
lattices
)
{
var
kname
=
this
.
lattices
[
key
];
var
ele
=
this
.
container
.
getChildByName
(
kname
);
ele
.
touch
=
v
;
}
};
GameView
.
prototype
.
attionEliminate
=
function
()
{
};
GameView
.
prototype
.
checkEliminate
=
function
()
{
this
.
eliminateArr
=
new
Array
();
for
(
var
r
=
MapData
.
row
-
1
;
r
>
-
1
;
r
--
)
{
for
(
var
c
=
MapData
.
col
-
1
;
c
>
-
1
;
c
--
)
{
var
edata
=
this
.
getEliminate
(
r
,
c
);
if
(
edata
)
{
var
etype
=
edata
.
etype
;
var
earr
=
edata
.
arr
;
this
.
checkAddEli
(
etype
,
earr
);
}
}
}
};
GameView
.
prototype
.
getEliminate
=
function
(
x
,
y
)
{
var
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
var
relearr
=
new
Array
();
relearr
.
push
(
x
+
"_"
+
y
);
for
(
var
r
=
x
-
1
;
r
>
-
1
;
r
--
)
{
var
reletype
=
this
.
getEleTypeByRc
(
r
,
y
);
if
(
checktype
==
reletype
)
{
relearr
.
push
(
r
+
"_"
+
y
);
}
else
{
break
;
}
}
var
celearr
=
new
Array
();
celearr
.
push
(
x
+
"_"
+
y
);
for
(
var
c
=
y
-
1
;
c
>
-
1
;
c
--
)
{
var
celetype
=
this
.
getEleTypeByRc
(
x
,
c
);
if
(
checktype
==
celetype
)
{
celearr
.
push
(
x
+
"_"
+
c
);
}
else
{
break
;
}
}
var
eliminatearr
=
new
Array
();
if
(
relearr
.
length
>=
3
)
{
eliminatearr
.
push
.
apply
(
eliminatearr
,
relearr
);
}
if
(
celearr
.
length
>=
3
)
{
eliminatearr
.
push
.
apply
(
eliminatearr
,
celearr
);
}
if
(
eliminatearr
.
length
>
0
)
{
return
{
etype
:
checktype
,
arr
:
eliminatearr
};
}
else
{
return
false
;
}
};
GameView
.
prototype
.
getEleTypeByRc
=
function
(
r
,
c
)
{
var
rc
=
r
+
"_"
+
c
;
var
elename
=
this
.
lattices
[
rc
];
var
ele
=
this
.
container
.
getChildByName
(
elename
);
var
eletype
=
ele
.
type
;
return
eletype
;
};
GameView
.
prototype
.
checkAddEli
=
function
(
etype
,
earr
)
{
for
(
var
e
=
0
;
e
<
earr
.
length
;
e
++
)
{
var
ename
=
earr
[
e
];
var
needadd
=
true
;
for
(
var
i
=
0
;
i
<
this
.
eliminateArr
.
length
;
i
++
)
{
var
ielidata
=
this
.
eliminateArr
[
i
];
var
ielidxname
=
ielidata
.
idxname
;
if
(
ielidxname
==
ename
)
{
needadd
=
false
;
break
;
}
}
if
(
needadd
)
{
this
.
eliminateArr
.
push
({
idxname
:
ename
,
type
:
etype
});
}
}
};
GameView
.
prototype
.
getFallRcEle
=
function
(
r
,
c
)
{
for
(
var
fr
=
r
-
1
;
fr
>
-
1
;
fr
--
)
{
var
frc
=
fr
+
"_"
+
c
;
var
frcname
=
this
.
lattices
[
frc
];
if
(
frcname
!=
"empty"
)
{
this
.
lattices
[
frc
]
=
"empty"
;
return
frcname
;
}
}
return
false
;
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
_gameView
=
new
GameView
();
_this
.
addChild
(
_this
.
_gameView
);
engine
.
globalEvent
.
addEventListener
(
'game-init'
,
_this
.
init
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'game-reset'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'game-start'
,
_this
.
start
,
_this
);
return
_this
;
}
GameWrapper
.
prototype
.
init
=
function
()
{
this
.
_gameView
.
init
();
};
GameWrapper
.
prototype
.
reset
=
function
()
{
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
()
{
this
.
_gameView
.
start
();
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
function
index
(
props
)
{
prepareProps
();
injectProps
(
props
);
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
src/custom/xiaoxiaole/debug/main.js.map
0 → 100644
View file @
e0fcb941
{"version":3,"file":"index.js","sources":["src/custom/xiaoxiaole/src/game/utils.ts","src/custom/xiaoxiaole/src/game/ele/Element.ts","src/custom/xiaoxiaole/src/game/MapData.ts","src/custom/xiaoxiaole/src/game/GameView.ts","src/custom/xiaoxiaole/src/game/GameWrapper.ts","src/custom/xiaoxiaole/src/props.ts","src/custom/xiaoxiaole/src/index.ts"],"sourcesContent":["/**\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 createSvga(name, anchorName?) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\treturn inst;\r\n}","import MapData, { ElementType, GameEvent } from \"../MapData\";\r\n\r\nimport { getTextureByName } from \"../utils\";\r\nexport default class Element extends engine.Container{\r\n type:ElementType;\r\n eimage:engine.Image;\r\n\r\n inrow;\r\n incol;\r\n set touch(touch){\r\n this.mouseEnabled = touch;\r\n this.mouseChildren = touch;\r\n }\r\n constructor(){\r\n super();\r\n this.width = MapData.itemsize;\r\n this.height = MapData.itemsize;\r\n\r\n this.eimage = new engine.Image();\r\n this.addChild(this.eimage);\r\n this.touch = true;\r\n this.addEventListener(engine.MouseEvent.CLICK,this.selectele,this);\r\n }\r\n init(type:ElementType){\r\n this.scaleX = 1;\r\n this.scaleY = 1;\r\n\r\n this.type = type;\r\n let ename = MapData.getEtypeImgName(type);\r\n this.eimage.texture = getTextureByName(ename);\r\n let imgwid = this.eimage.texture.width;\r\n let imghei = this.eimage.texture.height;\r\n\r\n // console.log(\"大小\",imgwid,imghei);\r\n this.eimage.x = (this.width - imgwid)/2;\r\n this.eimage.y = (this.height-imghei)/2;\r\n\r\n\r\n }\r\n setrc(r,c){\r\n this.inrow = r;\r\n this.incol = c;\r\n }\r\n selectele(e:engine.MouseEvent){\r\n engine.globalEvent.dispatchEvent(GameEvent.SelectEle,{\r\n r:this.inrow,\r\n c:this.incol\r\n })\r\n }\r\n\r\n //飞到小屋\r\n flyToHome(){\r\n \r\n }\r\n\r\n changePos(){\r\n\r\n }\r\n}","import Element from \"./ele/Element\";\r\n\r\nexport enum ElementType{\r\n btiger = 1,\r\n gtiger,\r\n monkey,\r\n bird,\r\n koala\r\n}\r\nexport enum GameEvent{\r\n SelectEle = \"SelectEle\",\r\n\r\n}\r\nexport default class MapData{\r\n //单格大小\r\n\tstatic itemsize = 129;\r\n\t//\r\n\tstatic paddingb = 10;\r\n\tstatic paddingi = 5;\r\n\t//\r\n\tstatic row = 5;\r\n\tstatic col = 5;\r\n //行-列,对应位置\r\n static posData = {\r\n\r\n };\r\n static eleidx = 1;\r\n static elePool = [];\r\n static getRy(r){\r\n return this.paddingb+r*(this.itemsize+this.paddingi);\r\n }\r\n static getCx(c){\r\n return this.paddingb+c*(this.itemsize+this.paddingi);\r\n }\r\n static getRCPos(r,c){\r\n let x = this.getCx(c);\r\n let y = this.getRy(r);\r\n return [x,y];\r\n }\r\n static adaptElePos(pos,wid,hei){\r\n let x = pos[0]+(this.itemsize-wid)/2;\r\n let y = pos[1]+(this.itemsize-hei)/2;\r\n return [x,y];\r\n }\r\n\r\n static getEtypeImgName(type:ElementType){\r\n let ename:string;\r\n switch(type){\r\n case ElementType.btiger:\r\n ename = \"白虎\";\r\n break;\r\n case ElementType.gtiger:\r\n ename = \"雌虎\";\r\n break;\r\n case ElementType.monkey:\r\n ename = \"猴子\";\r\n break;\r\n case ElementType.bird:\r\n ename = \"鸟\";\r\n break;\r\n case ElementType.koala:\r\n ename = \"树熊\";\r\n break;\r\n default:\r\n console.error(\"未定义元素类型\");\r\n break;\r\n }\r\n return ename;\r\n }\r\n\r\n static getRandEtype(){\r\n let eletypeArr = [ElementType.btiger,ElementType.gtiger,ElementType.monkey,ElementType.bird,ElementType.koala];\r\n let etype = eletypeArr[Math.floor(Math.random()*eletypeArr.length)];\r\n return etype;\r\n }\r\n\r\n static getOneEle(type:ElementType):Element{\r\n let ele:Element;\r\n if(this.elePool.length>0){\r\n ele = this.elePool.shift();\r\n }else{\r\n ele = new Element();\r\n }\r\n ele.name = \"ele_\"+this.eleidx;\r\n this.eleidx += 1;\r\n\r\n\r\n ele.init(type)\r\n return ele;\r\n }\r\n static recoverEle(ele:Element){\r\n this.elePool.push(ele);\r\n }\r\n static getDistance(p1,p2){\r\n let p1x = p1[0];\r\n let p1y = p1[1];\r\n \r\n let p2x = p2[0];\r\n let p2y = p2[1];\r\n\r\n let dis = Math.sqrt(Math.pow(p1x-p2x,2)+Math.pow(p1y-p2y,2));\r\n return dis;\r\n }\r\n}","/**\r\n * Created by zjz on 2020/7/10.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport { playSound, createSvga } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\nimport { getTextureByName } from \"./utils\";\r\nimport MapData, { GameEvent } from \"./MapData\";\r\nimport Element from \"./ele/Element\";\r\n\r\n\r\n\r\nexport default class GameView extends engine.Container {\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n\t}\r\n\t//元素容器\r\n\tcontainer:engine.Container;\r\n\t//动画层\r\n\tanicontainer:engine.Container;\r\n\r\n\r\n\t//格子,位置-name\r\n\tlattices = {};\r\n\t//一次消除组\r\n\teliminateArr = [];\r\n\t//选中\r\n\tselectArr = [];\r\n\tselectimg:engine.Image;\r\n\r\n\t//屋子\r\n\thomeimg:engine.Image;\r\n\r\n\tconty = 140;\r\n\thomex = 528;\r\n\r\n\ttanix;\r\n\ttaniy;\r\n\tanispeed = 860;\r\n\r\n\tsetup() {\r\n\t\tthis.selectimg = new engine.Image(getTextureByName(\"选中框\"));\r\n\t\tthis.selectimg.mouseEnabled = false;\r\n\r\n\t\tlet row = MapData.row;\r\n\t\tlet col = MapData.col;\r\n\r\n\t\tthis.homeimg = new engine.Image(getTextureByName(\"房子\"));\r\n\t\tthis.addChild(this.homeimg);\r\n\t\tthis.homeimg.x = this.homex;\r\n\r\n\t\tthis.container = new engine.Container();\r\n\t\tthis.addChild(this.container);\r\n\t\tthis.container.y = this.conty;\r\n\r\n\t\tthis.anicontainer = new engine.Container();\r\n\t\tthis.addChild(this.anicontainer);\r\n\t\tthis.anicontainer.mouseEnabled = false;\r\n\t\tthis.anicontainer.mouseChildren = false;\r\n\t\t\r\n\r\n\t\tlet map = new engine.Image(getTextureByName(\"底图\"));\r\n\t\tthis.container.addChild(map);\r\n\r\n\t\t\r\n\r\n\t\t//初始化底图\r\n\t\tfor(let r=0;r<row;r++){\r\n\t\t\tfor(let c=0;c<col;c++){\r\n\t\t\t\tlet rcpos = MapData.getRCPos(r,c);\r\n\t\t\t\tMapData.posData[r+\"_\"+c] = rcpos;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.tanix = this.homex+this.homeimg.texture.width/2;\r\n\t\tthis.taniy = this.homeimg.texture.height/2;\r\n\r\n\t\tengine.globalEvent.addEventListener(GameEvent.SelectEle,this.selectele,this);\r\n\t\tthis.removeEventListener(engine.Event.ADDED_TO_STAGE,this.setup,this);\r\n\t}\r\n\r\n\tinit(){\r\n\t\tthis.initContainer();\r\n\t}\r\n\treset(){\r\n\r\n\t}\r\n\tstart(){\r\n\r\n\t}\r\n\r\n\tinitContainer(){\r\n\t\tthis.lattices = {};\r\n\t\tlet testdata = [\r\n\t\t\t[1,2,5,3,4],\r\n\t\t\t[3,1,2,4,5],\r\n\t\t\t[2,5,3,4,1],\r\n\t\t\t[5,4,1,2,3],\r\n\t\t\t[4,1,3,5,2],\r\n\t\t]\r\n\t\tfor(let r=0;r<testdata.length;r++){\r\n\t\t\tlet rdata = testdata[r];\r\n\t\t\tfor(let c=0;c<rdata.length;c++){\r\n\t\t\t\tlet rctype = rdata[c];\r\n\t\t\t\tlet rcele = MapData.getOneEle(rctype);\r\n\t\t\t\tlet rcpos = MapData.getRCPos(r,c);\r\n\t\t\t\tthis.container.addChild(rcele);\r\n\t\t\t\t\r\n\t\t\t\trcele.x = rcpos[0];\r\n\t\t\t\trcele.y = rcpos[1];\r\n\r\n\t\t\t\tlet rcidx = r+\"_\"+c;\r\n\t\t\t\tthis.lattices[rcidx] = rcele.name;\r\n\t\t\t\tthis.setLatticeEleRc(rcidx);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.checkEliminate();\r\n\t}\r\n\t//关联\r\n\tsetLatticeEleRc(rcidx){\r\n\t\tlet rename = this.lattices[rcidx];\r\n\t\tlet rcnode:Element = this.container.getChildByName(rename);\r\n\t\tlet er = Number(rcidx.split(\"_\")[0]);\r\n\t\tlet ec = Number(rcidx.split(\"_\")[1]);\r\n\t\trcnode.setrc(er,ec);\r\n\t}\r\n\r\n\tselectele(e:engine.Event){\r\n\t\tlet data = e.data;\r\n\t\tlet sr = data.r;\r\n\t\tlet sc = data.c;\r\n\t\tlet sname = sr+\"_\"+sc;\r\n\t\tif(this.selectArr.length==0){\r\n\t\t\t// console.log(\"选中元素\",data);\r\n\t\t\tthis.selectArr.push(sname);\r\n\t\t}else if(this.selectArr.length==1){\r\n\t\t\tlet aselect = this.selectArr[0];\r\n\t\t\tlet asr = aselect.split(\"_\")[0];\r\n\t\t\tlet asc = aselect.split(\"_\")[1];\r\n\r\n\t\t\tif((sr==asr&&Math.abs(sc-asc)==1)||(sc==asc&&Math.abs(sr-asr)==1)){\r\n\t\t\t\tthis.selectArr.push(sname);\r\n\t\t\t}else{\r\n\t\t\t\tthis.selectArr[0] = sname;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(this.selectArr.length==1){\r\n\t\t\tthis.setSelectShow();\r\n\t\t}else if(this.selectArr.length==2){\r\n\t\t\tthis.changeElePos();\r\n\t\t}\r\n\t}\r\n\tsetSelectShow(){\r\n\t\tlet rcname = this.selectArr[0];\r\n\t\tlet r = rcname.split(\"_\")[0];\r\n\t\tlet c = rcname.split(\"_\")[1];\r\n\t\tlet rcpos = MapData.getRCPos(r,c);\r\n\r\n\t\tthis.container.addChild(this.selectimg);\r\n\t\tthis.selectimg.x = rcpos[0];\r\n\t\tthis.selectimg.y = rcpos[1];\r\n\r\n\t}\r\n\r\n\tchangeElePos(){\r\n\t\tthis.container.removeChild(this.selectimg);\r\n\t\tthis.changeEnable(false);\r\n\r\n\t\tlet sname1 = this.selectArr[0];\r\n\t\tlet sname2 = this.selectArr[1];\r\n\r\n\t\tlet sename1 = this.lattices[sname1];\r\n\t\tlet sename2 = this.lattices[sname2];\r\n\r\n\t\t// console.log(\"交换测试\",sname1,sname2,this.lattices);\r\n\r\n\t\tthis.lattices[sname1] = sename2;\r\n\t\tthis.lattices[sname2] = sename1;\r\n\t\tthis.setLatticeEleRc(sname1);\r\n\t\tthis.setLatticeEleRc(sname2);\r\n\r\n\t\tthis.checkEliminate();\r\n\t\t\r\n\t\tlet snode1 = this.container.getChildByName(sename1);\r\n\t\tlet snode2 = this.container.getChildByName(sename2);\r\n\r\n\t\tlet snode1x = snode1.x;\r\n\t\tlet snode1y = snode1.y;\r\n\r\n\t\tlet snode2x = snode2.x;\r\n\t\tlet snode2y = snode2.y;\r\n\r\n\t\tlet changetime = Math.ceil((MapData.itemsize/this.anispeed)*2*1000)\r\n\t\tif(this.eliminateArr.length>0){\r\n\t\t\tengine.Tween.get(snode1).to({\r\n\t\t\t\tx:snode2x,\r\n\t\t\t\ty:snode2y\r\n\t\t\t},changetime)\r\n\t\t\tengine.Tween.get(snode2).to({\r\n\t\t\t\tx:snode1x,\r\n\t\t\t\ty:snode1y\r\n\t\t\t},changetime)\r\n\t\t\t.call(()=>{\r\n\t\t\t\tthis.eliminate();\r\n\t\t\t})\r\n\t\t}else{\r\n\t\t\tengine.Tween.get(snode1).to({\r\n\t\t\t\tx:snode2x,\r\n\t\t\t\ty:snode2y\r\n\t\t\t},changetime)\r\n\t\t\t.wait(100)\r\n\t\t\t.to({\r\n\t\t\t\tx:snode1x,\r\n\t\t\t\ty:snode1y\r\n\t\t\t},changetime)\r\n\t\t\t\r\n\t\t\tengine.Tween.get(snode2).to({\r\n\t\t\t\tx:snode1x,\r\n\t\t\t\ty:snode1y\r\n\t\t\t},changetime)\r\n\t\t\t.wait(100)\r\n\t\t\t.to({\r\n\t\t\t\tx:snode2x,\r\n\t\t\t\ty:snode2y\r\n\t\t\t},changetime)\r\n\t\t\t.call(()=>{\r\n\t\t\t\tthis.lattices[sname1] = sename1;\r\n\t\t\t\tthis.lattices[sname2] = sename2;\r\n\t\t\t\tthis.setLatticeEleRc(sname1);\r\n\t\t\t\tthis.setLatticeEleRc(sname2);\r\n\t\t\t\tthis.selectArr = new Array();\r\n\r\n\t\t\t\tthis.changeEnable(true);\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\t\r\n\t//消除\r\n\teliminate(){\r\n\t\tfor(let i=0;i<this.eliminateArr.length;i++){\r\n\t\t\tlet ielidata = this.eliminateArr[i];\r\n\t\t\tlet ielidxname = ielidata.idxname;\r\n\t\t\tlet ielitype = ielidata.type;\r\n\r\n\t\t\tlet ieliname = this.lattices[ielidxname];\r\n\t\t\tlet ielinode = this.container.getChildByName(ieliname);\r\n\t\t\tlet ielix = ielinode.x;\r\n\t\t\tlet ieliy = ielinode.y;\r\n\t\t\tthis.container.removeChild(ielinode);\r\n\r\n\t\t\tthis.lattices[ielidxname] = \"empty\";\r\n\t\t\t//元素层消除,动画层添加\r\n\t\t\tthis.goHomeAni(ielitype,ielix,ieliy);\r\n\t\t}\r\n\t\tthis.fall();\r\n\t}\r\n\t//掉落\r\n\tasync fall(){\r\n\t\tlet fallData = new Array();\r\n\t\t\r\n\t\tlet fcutr = new Array();\r\n\t\tfor(let fc=0;fc<MapData.col;fc++){\r\n\t\t\tfcutr.push(-1);\r\n\t\t}\r\n\r\n\t\tfor(let r = MapData.row-1;r>-1;r--){\r\n\t\t\tfor(let c=MapData.col-1;c>-1;c--){\r\n\t\t\t\t\r\n\t\t\t\tlet idxname = r+\"_\"+c;\r\n\t\t\t\tlet elename = this.lattices[idxname];\r\n\t\t\t\tif(elename==\"empty\"){\r\n\t\t\t\t\tlet frcname = this.getFallRcEle(r,c);\r\n\t\t\t\t\tif(!frcname){\r\n\t\t\t\t\t\tlet fetype = MapData.getRandEtype();\r\n\t\t\t\t\t\tlet fele = MapData.getOneEle(fetype);\r\n\r\n\t\t\t\t\t\tlet cutr = fcutr[c];\r\n\t\t\t\t\t\tlet fepos = MapData.getRCPos(cutr,c);\r\n\t\t\t\t\t\tfcutr[c] = cutr-1;\r\n\r\n\t\t\t\t\t\tthis.container.addChild(fele);\r\n\t\t\t\t\t\tfele.x = fepos[0];\r\n\t\t\t\t\t\tfele.y = fepos[1];\r\n\t\t\t\t\t\tfrcname = fele.name;\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.lattices[idxname] = frcname;\r\n\t\t\t\t\tthis.setLatticeEleRc(idxname);\r\n\t\t\t\t\tfallData.push({\r\n\t\t\t\t\t\trcname:frcname,\r\n\t\t\t\t\t\ttrow:r,\r\n\t\t\t\t\t\ttcol:c\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// return;\r\n\t\t// console.log(\"动画掉落组准备完毕\",fallData);\r\n\t\tlet fallPromise = new Array();\r\n\t\tfor(let f=0;f<fallData.length;f++){\r\n\t\t\tlet fdata = fallData[f];\r\n\t\t\tlet frcname = fdata.rcname;\r\n\t\t\tlet ftrow = fdata.trow;\r\n\t\t\tlet ftcol = fdata.tcol;\r\n\t\t\tlet ftpos = MapData.getRCPos(ftrow,ftcol);\r\n\t\t\tlet frcnode = this.container.getChildByName(frcname);\r\n\r\n\t\t\tlet nepos = [frcnode.x,frcnode.y];\r\n\t\t\tlet fdis = MapData.getDistance(ftpos,nepos);\r\n\t\t\tlet ftime = Math.ceil((fdis/this.anispeed)*1000);\r\n\r\n\t\t\tlet ifallpromise = new Promise(res=>{\r\n\t\t\t\tengine.Tween.get(frcnode)\r\n\t\t\t\t.to({\r\n\t\t\t\t\tx:ftpos[0],\r\n\t\t\t\t\ty:ftpos[1]\r\n\t\t\t\t},ftime).call(()=>{\r\n\t\t\t\t\tres();\r\n\t\t\t\t})\r\n\t\t\t})\r\n\t\t\tfallPromise.push(ifallpromise);\r\n\t\t}\r\n\t\tawait Promise.all(fallPromise);\r\n\t\t\r\n\t\tthis.checkEliminate();\r\n\t\tif(this.eliminateArr.length>0){\r\n\t\t\treturn this.eliminate();\r\n\t\t}else{//一次操作完毕\r\n\t\t\tthis.selectArr = new Array();\r\n\t\t\tthis.changeEnable(true);\r\n\t\t}\r\n\t}\r\n\tgoHomeAni(ielitype,ielix,ieliy){\r\n\t\tlet aniele = MapData.getOneEle(ielitype);\r\n\t\taniele.touch = false;\r\n\t\tlet anix = ielix;\r\n\t\tlet aniy = ieliy + this.conty;\r\n\t\tthis.anicontainer.addChild(aniele);\r\n\t\taniele.x = anix;\r\n\t\taniele.y = aniy;\r\n\t\t\r\n\t\tlet anidis = MapData.getDistance([this.tanix,this.taniy],[anix,aniy]);\r\n\t\tlet anitime = Math.ceil((anidis/this.anispeed)*1000);\r\n\r\n\t\tengine.Tween.get(aniele)\r\n\t\t.to({\r\n\t\t\tx:this.tanix,\r\n\t\t\ty:this.taniy,\r\n\t\t\tscaleX:0,\r\n\t\t\tscaleY:0\r\n\t\t},anitime);\r\n\t}\r\n\r\n\t//修改元素点击\r\n\tchangeEnable(v:boolean){\r\n\t\tfor(let key in this.lattices){\r\n\t\t\tlet kname = this.lattices[key];\r\n\t\t\tlet ele:Element = this.container.getChildByName(kname);\r\n\t\t\tele.touch = v;\r\n\t\t}\r\n\t}\r\n\r\n\tattionEliminate(){\r\n\t\t\r\n\t}\r\n\t//检测消除\r\n\tcheckEliminate(){\r\n\t\tthis.eliminateArr = new Array();\r\n for(let r=MapData.row-1;r>-1;r--){\r\n for(let c=MapData.col-1;c>-1;c--){\r\n\t\t\t\tlet edata = this.getEliminate(r,c);\r\n\t\t\t\tif(edata){\r\n\t\t\t\t\tlet etype = edata.etype;\r\n\t\t\t\t\tlet earr = edata.arr;\r\n\t\t\t\t\tthis.checkAddEli(etype,earr);\r\n\t\t\t\t}\r\n }\r\n\t\t}\r\n\t\t\r\n\t}\r\n\tgetEliminate(x,y){\r\n\t\tlet checktype = this.getEleTypeByRc(x,y);\r\n\r\n\t\tlet relearr = new Array();\r\n\t\trelearr.push(x+\"_\"+y);\r\n\t\tfor(let r=x-1;r>-1;r--){\r\n\t\t\tlet reletype = this.getEleTypeByRc(r,y);\r\n\t\t\tif(checktype==reletype){\r\n\t\t\t\trelearr.push(r+\"_\"+y);\r\n\t\t\t}else{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet celearr = new Array();\r\n\t\tcelearr.push(x+\"_\"+y);\r\n\t\tfor(let c=y-1;c>-1;c--){\r\n\t\t\tlet celetype = this.getEleTypeByRc(x,c);\r\n\t\t\tif(checktype==celetype){\r\n\t\t\t\tcelearr.push(x+\"_\"+c);\r\n\t\t\t}else{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet eliminatearr = new Array();\r\n\t\tif(relearr.length>=3){\r\n\t\t\teliminatearr.push(...relearr);\r\n\t\t}\r\n\t\tif(celearr.length>=3){\r\n\t\t\teliminatearr.push(...celearr);\r\n\t\t}\r\n\t\tif(eliminatearr.length>0){\r\n\t\t\treturn {\r\n\t\t\t\tetype:checktype,\r\n\t\t\t\tarr:eliminatearr\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\tgetEleTypeByRc(r,c){\r\n\t\tlet rc = r+\"_\"+c;\r\n\t\tlet elename = this.lattices[rc];\r\n\t\tlet ele:Element = this.container.getChildByName(elename);\r\n\t\tlet eletype = ele.type;\r\n\t\treturn eletype;\r\n\t}\r\n\tcheckAddEli(etype,earr){\r\n\t\tfor(let e=0;e<earr.length;e++){\r\n\t\t\tlet ename = earr[e];\r\n\r\n\t\t\tlet needadd = true;\r\n\t\t\tfor(let i=0;i<this.eliminateArr.length;i++){\r\n\t\t\t\tlet ielidata = this.eliminateArr[i];\r\n\t\t\t\tlet ielidxname = ielidata.idxname;\r\n\t\t\t\tif(ielidxname==ename){\r\n\t\t\t\t\tneedadd = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(needadd){\r\n\t\t\t\tthis.eliminateArr.push({\r\n\t\t\t\t\tidxname:ename,\r\n\t\t\t\t\ttype:etype\r\n\t\t\t\t})\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\t//获得这个位置掉落的元素\r\n\tgetFallRcEle(r,c){\r\n\t\tfor(let fr=r-1;fr>-1;fr--){\r\n\t\t\tlet frc = fr+\"_\"+c;\r\n\t\t\tlet frcname = this.lattices[frc];\r\n\t\t\tif(frcname!=\"empty\"){\r\n\t\t\t\tthis.lattices[frc] = \"empty\";\r\n\t\t\t\treturn frcname;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\nimport {injectProps} from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _gameView: GameView;\r\n\t\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis._gameView = new GameView();\r\n\t\tthis.addChild(this._gameView);\r\n\r\n\t\tengine.globalEvent.addEventListener('game-init',this.init,this);\r\n\t\tengine.globalEvent.addEventListener('game-reset',this.reset,this);\r\n\t\tengine.globalEvent.addEventListener('game-start',this.start,this);\r\n\t}\r\n\r\n\tinit(){\r\n\t\tthis._gameView.init();\r\n\t}\r\n\treset(){\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\tstart(){\r\n\t\tthis._gameView.start();\r\n\t}\r\n}\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\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":";;;;;;UAIgB,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;AAED;;CCTA;KAAqCA,iCAAgB;KAUjD;SAAA,YACI,iBAAO,SAQV;SAPG,KAAI,CAAC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC;SAC9B,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;SAE/B,KAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;SACjC,KAAI,CAAC,QAAQ,CAAC,KAAI,CAAC,MAAM,CAAC,CAAC;SAC3B,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SAClB,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,CAAC,IAAI,EAAE,CAAC;MACtB;KACD,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACF,kBAAC;CAAD,CAAC,CAtBgC,MAAM,CAAC,SAAS,GAsBhD;;;CC1BM,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,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;iBCPwB,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
src/custom/xiaoxiaole/meta.json
View file @
e0fcb941
...
...
@@ -6,16 +6,64 @@
},
"assets"
:
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"name"
:
"底图"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/109e30fa662276e0ee4f2e2c35b85bee6f300050.png"
,
"uuid"
:
"map"
,
"ext"
:
".png"
},
{
"name"
:
"房子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df155804a46c708a714365b7247141ba0add45e5.png"
,
"uuid"
:
"home"
,
"ext"
:
".png"
},
{
"name"
:
"白虎"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b486b4a72c58850bbd1930b994e08802e34fb3e3.png"
,
"uuid"
:
"btiger"
,
"ext"
:
".png"
},
{
"name"
:
"雌虎"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/c41afceb285432ed2c17c643df96efc20893adc8.png"
,
"uuid"
:
"gtiger"
,
"ext"
:
".png"
},
{
"name"
:
"猴子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/ef7bc5d1fc38267adba71e07d517330f249d23ba.png"
,
"uuid"
:
"monkey"
,
"ext"
:
".png"
},
{
"name"
:
"鸟"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/9ad18dfa34e1729e9893ac362975f9e062263f70.png"
,
"uuid"
:
"bird"
,
"ext"
:
".png"
},
{
"name"
:
"树熊"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/277aa43d9f1bf3dd7a18e627335a166f0509684c.png"
,
"uuid"
:
"koala"
,
"ext"
:
".png"
},
{
"name"
:
"选中框"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a3ce52a41ed53ccfa7ce404dbc10102961c4a805.png"
,
"uuid"
:
"selected"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"game-init"
:{
"alias"
:
"初始化第一关"
,
"data"
:
{
}
},
"game-reset"
:
{
"alias"
:
"
重置
"
,
"alias"
:
"
关卡通过重玩之类的重置关卡
"
,
"data"
:
{
}
...
...
src/custom/xiaoxiaole/src/game/GameView.ts
View file @
e0fcb941
/**
* Created by
rockyl on 2018/8/16
.
* Created by
zjz on 2020/7/10
.
*/
import
{
props
}
from
"../props"
;
import
{
playSound
,
createSvga
}
from
"./utils"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
{
getTextureByName
}
from
"./utils"
;
import
MapData
,
{
GameEvent
}
from
"./MapData"
;
import
Element
from
"./ele/Element"
;
...
...
@@ -14,7 +16,450 @@ export default class GameView extends engine.Container {
super
();
this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
}
//元素容器
container
:
engine
.
Container
;
//动画层
anicontainer
:
engine
.
Container
;
//格子,位置-name
lattices
=
{};
//一次消除组
eliminateArr
=
[];
//选中
selectArr
=
[];
selectimg
:
engine
.
Image
;
//屋子
homeimg
:
engine
.
Image
;
conty
=
140
;
homex
=
528
;
tanix
;
taniy
;
anispeed
=
860
;
setup
()
{
this
.
selectimg
=
new
engine
.
Image
(
getTextureByName
(
"选中框"
));
this
.
selectimg
.
mouseEnabled
=
false
;
let
row
=
MapData
.
row
;
let
col
=
MapData
.
col
;
this
.
homeimg
=
new
engine
.
Image
(
getTextureByName
(
"房子"
));
this
.
addChild
(
this
.
homeimg
);
this
.
homeimg
.
x
=
this
.
homex
;
this
.
container
=
new
engine
.
Container
();
this
.
addChild
(
this
.
container
);
this
.
container
.
y
=
this
.
conty
;
this
.
anicontainer
=
new
engine
.
Container
();
this
.
addChild
(
this
.
anicontainer
);
this
.
anicontainer
.
mouseEnabled
=
false
;
this
.
anicontainer
.
mouseChildren
=
false
;
let
map
=
new
engine
.
Image
(
getTextureByName
(
"底图"
));
this
.
container
.
addChild
(
map
);
//初始化底图
for
(
let
r
=
0
;
r
<
row
;
r
++
){
for
(
let
c
=
0
;
c
<
col
;
c
++
){
let
rcpos
=
MapData
.
getRCPos
(
r
,
c
);
MapData
.
posData
[
r
+
"_"
+
c
]
=
rcpos
;
}
}
this
.
tanix
=
this
.
homex
+
this
.
homeimg
.
texture
.
width
/
2
;
this
.
taniy
=
this
.
homeimg
.
texture
.
height
/
2
;
engine
.
globalEvent
.
addEventListener
(
GameEvent
.
SelectEle
,
this
.
selectele
,
this
);
this
.
removeEventListener
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
}
init
(){
this
.
initContainer
();
}
reset
(){
}
start
(){
}
initContainer
(){
this
.
lattices
=
{};
let
testdata
=
[
[
1
,
2
,
5
,
3
,
4
],
[
3
,
1
,
2
,
4
,
5
],
[
2
,
5
,
3
,
4
,
1
],
[
5
,
4
,
1
,
2
,
3
],
[
4
,
1
,
3
,
5
,
2
],
]
for
(
let
r
=
0
;
r
<
testdata
.
length
;
r
++
){
let
rdata
=
testdata
[
r
];
for
(
let
c
=
0
;
c
<
rdata
.
length
;
c
++
){
let
rctype
=
rdata
[
c
];
let
rcele
=
MapData
.
getOneEle
(
rctype
);
let
rcpos
=
MapData
.
getRCPos
(
r
,
c
);
this
.
container
.
addChild
(
rcele
);
rcele
.
x
=
rcpos
[
0
];
rcele
.
y
=
rcpos
[
1
];
let
rcidx
=
r
+
"_"
+
c
;
this
.
lattices
[
rcidx
]
=
rcele
.
name
;
this
.
setLatticeEleRc
(
rcidx
);
}
}
this
.
checkEliminate
();
}
//关联
setLatticeEleRc
(
rcidx
){
let
rename
=
this
.
lattices
[
rcidx
];
let
rcnode
:
Element
=
this
.
container
.
getChildByName
(
rename
);
let
er
=
Number
(
rcidx
.
split
(
"_"
)[
0
]);
let
ec
=
Number
(
rcidx
.
split
(
"_"
)[
1
]);
rcnode
.
setrc
(
er
,
ec
);
}
selectele
(
e
:
engine
.
Event
){
let
data
=
e
.
data
;
let
sr
=
data
.
r
;
let
sc
=
data
.
c
;
let
sname
=
sr
+
"_"
+
sc
;
if
(
this
.
selectArr
.
length
==
0
){
// console.log("选中元素",data);
this
.
selectArr
.
push
(
sname
);
}
else
if
(
this
.
selectArr
.
length
==
1
){
let
aselect
=
this
.
selectArr
[
0
];
let
asr
=
aselect
.
split
(
"_"
)[
0
];
let
asc
=
aselect
.
split
(
"_"
)[
1
];
if
((
sr
==
asr
&&
Math
.
abs
(
sc
-
asc
)
==
1
)
||
(
sc
==
asc
&&
Math
.
abs
(
sr
-
asr
)
==
1
)){
this
.
selectArr
.
push
(
sname
);
}
else
{
this
.
selectArr
[
0
]
=
sname
;
}
}
if
(
this
.
selectArr
.
length
==
1
){
this
.
setSelectShow
();
}
else
if
(
this
.
selectArr
.
length
==
2
){
this
.
changeElePos
();
}
}
setSelectShow
(){
let
rcname
=
this
.
selectArr
[
0
];
let
r
=
rcname
.
split
(
"_"
)[
0
];
let
c
=
rcname
.
split
(
"_"
)[
1
];
let
rcpos
=
MapData
.
getRCPos
(
r
,
c
);
this
.
container
.
addChild
(
this
.
selectimg
);
this
.
selectimg
.
x
=
rcpos
[
0
];
this
.
selectimg
.
y
=
rcpos
[
1
];
}
changeElePos
(){
this
.
container
.
removeChild
(
this
.
selectimg
);
this
.
changeEnable
(
false
);
let
sname1
=
this
.
selectArr
[
0
];
let
sname2
=
this
.
selectArr
[
1
];
let
sename1
=
this
.
lattices
[
sname1
];
let
sename2
=
this
.
lattices
[
sname2
];
// console.log("交换测试",sname1,sname2,this.lattices);
this
.
lattices
[
sname1
]
=
sename2
;
this
.
lattices
[
sname2
]
=
sename1
;
this
.
setLatticeEleRc
(
sname1
);
this
.
setLatticeEleRc
(
sname2
);
this
.
checkEliminate
();
let
snode1
=
this
.
container
.
getChildByName
(
sename1
);
let
snode2
=
this
.
container
.
getChildByName
(
sename2
);
let
snode1x
=
snode1
.
x
;
let
snode1y
=
snode1
.
y
;
let
snode2x
=
snode2
.
x
;
let
snode2y
=
snode2
.
y
;
let
changetime
=
Math
.
ceil
((
MapData
.
itemsize
/
this
.
anispeed
)
*
2
*
1000
)
if
(
this
.
eliminateArr
.
length
>
0
){
engine
.
Tween
.
get
(
snode1
).
to
({
x
:
snode2x
,
y
:
snode2y
},
changetime
)
engine
.
Tween
.
get
(
snode2
).
to
({
x
:
snode1x
,
y
:
snode1y
},
changetime
)
.
call
(()
=>
{
this
.
eliminate
();
})
}
else
{
engine
.
Tween
.
get
(
snode1
).
to
({
x
:
snode2x
,
y
:
snode2y
},
changetime
)
.
wait
(
100
)
.
to
({
x
:
snode1x
,
y
:
snode1y
},
changetime
)
engine
.
Tween
.
get
(
snode2
).
to
({
x
:
snode1x
,
y
:
snode1y
},
changetime
)
.
wait
(
100
)
.
to
({
x
:
snode2x
,
y
:
snode2y
},
changetime
)
.
call
(()
=>
{
this
.
lattices
[
sname1
]
=
sename1
;
this
.
lattices
[
sname2
]
=
sename2
;
this
.
setLatticeEleRc
(
sname1
);
this
.
setLatticeEleRc
(
sname2
);
this
.
selectArr
=
new
Array
();
this
.
changeEnable
(
true
);
})
}
}
//消除
eliminate
(){
for
(
let
i
=
0
;
i
<
this
.
eliminateArr
.
length
;
i
++
){
let
ielidata
=
this
.
eliminateArr
[
i
];
let
ielidxname
=
ielidata
.
idxname
;
let
ielitype
=
ielidata
.
type
;
let
ieliname
=
this
.
lattices
[
ielidxname
];
let
ielinode
=
this
.
container
.
getChildByName
(
ieliname
);
let
ielix
=
ielinode
.
x
;
let
ieliy
=
ielinode
.
y
;
this
.
container
.
removeChild
(
ielinode
);
this
.
lattices
[
ielidxname
]
=
"empty"
;
//元素层消除,动画层添加
this
.
goHomeAni
(
ielitype
,
ielix
,
ieliy
);
}
this
.
fall
();
}
//掉落
async
fall
(){
let
fallData
=
new
Array
();
let
fcutr
=
new
Array
();
for
(
let
fc
=
0
;
fc
<
MapData
.
col
;
fc
++
){
fcutr
.
push
(
-
1
);
}
for
(
let
r
=
MapData
.
row
-
1
;
r
>-
1
;
r
--
){
for
(
let
c
=
MapData
.
col
-
1
;
c
>-
1
;
c
--
){
let
idxname
=
r
+
"_"
+
c
;
let
elename
=
this
.
lattices
[
idxname
];
if
(
elename
==
"empty"
){
let
frcname
=
this
.
getFallRcEle
(
r
,
c
);
if
(
!
frcname
){
let
fetype
=
MapData
.
getRandEtype
();
let
fele
=
MapData
.
getOneEle
(
fetype
);
let
cutr
=
fcutr
[
c
];
let
fepos
=
MapData
.
getRCPos
(
cutr
,
c
);
fcutr
[
c
]
=
cutr
-
1
;
this
.
container
.
addChild
(
fele
);
fele
.
x
=
fepos
[
0
];
fele
.
y
=
fepos
[
1
];
frcname
=
fele
.
name
;
}
this
.
lattices
[
idxname
]
=
frcname
;
this
.
setLatticeEleRc
(
idxname
);
fallData
.
push
({
rcname
:
frcname
,
trow
:
r
,
tcol
:
c
});
}
}
}
// return;
// console.log("动画掉落组准备完毕",fallData);
let
fallPromise
=
new
Array
();
for
(
let
f
=
0
;
f
<
fallData
.
length
;
f
++
){
let
fdata
=
fallData
[
f
];
let
frcname
=
fdata
.
rcname
;
let
ftrow
=
fdata
.
trow
;
let
ftcol
=
fdata
.
tcol
;
let
ftpos
=
MapData
.
getRCPos
(
ftrow
,
ftcol
);
let
frcnode
=
this
.
container
.
getChildByName
(
frcname
);
let
nepos
=
[
frcnode
.
x
,
frcnode
.
y
];
let
fdis
=
MapData
.
getDistance
(
ftpos
,
nepos
);
let
ftime
=
Math
.
ceil
((
fdis
/
this
.
anispeed
)
*
1000
);
let
ifallpromise
=
new
Promise
(
res
=>
{
engine
.
Tween
.
get
(
frcnode
)
.
to
({
x
:
ftpos
[
0
],
y
:
ftpos
[
1
]
},
ftime
).
call
(()
=>
{
res
();
})
})
fallPromise
.
push
(
ifallpromise
);
}
await
Promise
.
all
(
fallPromise
);
this
.
checkEliminate
();
if
(
this
.
eliminateArr
.
length
>
0
){
return
this
.
eliminate
();
}
else
{
//一次操作完毕
this
.
selectArr
=
new
Array
();
this
.
changeEnable
(
true
);
}
}
goHomeAni
(
ielitype
,
ielix
,
ieliy
){
let
aniele
=
MapData
.
getOneEle
(
ielitype
);
aniele
.
touch
=
false
;
let
anix
=
ielix
;
let
aniy
=
ieliy
+
this
.
conty
;
this
.
anicontainer
.
addChild
(
aniele
);
aniele
.
x
=
anix
;
aniele
.
y
=
aniy
;
let
anidis
=
MapData
.
getDistance
([
this
.
tanix
,
this
.
taniy
],[
anix
,
aniy
]);
let
anitime
=
Math
.
ceil
((
anidis
/
this
.
anispeed
)
*
1000
);
engine
.
Tween
.
get
(
aniele
)
.
to
({
x
:
this
.
tanix
,
y
:
this
.
taniy
,
scaleX
:
0
,
scaleY
:
0
},
anitime
);
}
//修改元素点击
changeEnable
(
v
:
boolean
){
for
(
let
key
in
this
.
lattices
){
let
kname
=
this
.
lattices
[
key
];
let
ele
:
Element
=
this
.
container
.
getChildByName
(
kname
);
ele
.
touch
=
v
;
}
}
attionEliminate
(){
}
//检测消除
checkEliminate
(){
this
.
eliminateArr
=
new
Array
();
for
(
let
r
=
MapData
.
row
-
1
;
r
>-
1
;
r
--
){
for
(
let
c
=
MapData
.
col
-
1
;
c
>-
1
;
c
--
){
let
edata
=
this
.
getEliminate
(
r
,
c
);
if
(
edata
){
let
etype
=
edata
.
etype
;
let
earr
=
edata
.
arr
;
this
.
checkAddEli
(
etype
,
earr
);
}
}
}
}
getEliminate
(
x
,
y
){
let
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
let
relearr
=
new
Array
();
relearr
.
push
(
x
+
"_"
+
y
);
for
(
let
r
=
x
-
1
;
r
>-
1
;
r
--
){
let
reletype
=
this
.
getEleTypeByRc
(
r
,
y
);
if
(
checktype
==
reletype
){
relearr
.
push
(
r
+
"_"
+
y
);
}
else
{
break
;
}
}
let
celearr
=
new
Array
();
celearr
.
push
(
x
+
"_"
+
y
);
for
(
let
c
=
y
-
1
;
c
>-
1
;
c
--
){
let
celetype
=
this
.
getEleTypeByRc
(
x
,
c
);
if
(
checktype
==
celetype
){
celearr
.
push
(
x
+
"_"
+
c
);
}
else
{
break
;
}
}
let
eliminatearr
=
new
Array
();
if
(
relearr
.
length
>=
3
){
eliminatearr
.
push
(...
relearr
);
}
if
(
celearr
.
length
>=
3
){
eliminatearr
.
push
(...
celearr
);
}
if
(
eliminatearr
.
length
>
0
){
return
{
etype
:
checktype
,
arr
:
eliminatearr
}
}
else
{
return
false
;
}
}
getEleTypeByRc
(
r
,
c
){
let
rc
=
r
+
"_"
+
c
;
let
elename
=
this
.
lattices
[
rc
];
let
ele
:
Element
=
this
.
container
.
getChildByName
(
elename
);
let
eletype
=
ele
.
type
;
return
eletype
;
}
checkAddEli
(
etype
,
earr
){
for
(
let
e
=
0
;
e
<
earr
.
length
;
e
++
){
let
ename
=
earr
[
e
];
let
needadd
=
true
;
for
(
let
i
=
0
;
i
<
this
.
eliminateArr
.
length
;
i
++
){
let
ielidata
=
this
.
eliminateArr
[
i
];
let
ielidxname
=
ielidata
.
idxname
;
if
(
ielidxname
==
ename
){
needadd
=
false
;
break
;
}
}
if
(
needadd
){
this
.
eliminateArr
.
push
({
idxname
:
ename
,
type
:
etype
})
}
}
}
//获得这个位置掉落的元素
getFallRcEle
(
r
,
c
){
for
(
let
fr
=
r
-
1
;
fr
>-
1
;
fr
--
){
let
frc
=
fr
+
"_"
+
c
;
let
frcname
=
this
.
lattices
[
frc
];
if
(
frcname
!=
"empty"
){
this
.
lattices
[
frc
]
=
"empty"
;
return
frcname
;
}
}
return
false
;
}
}
src/custom/xiaoxiaole/src/game/GameWrapper.ts
View file @
e0fcb941
...
...
@@ -7,12 +7,25 @@ import {injectProps} from "../props";
export
class
GameWrapper
extends
engine
.
Container
{
private
_status
;
private
_gameView
:
GameView
;
constructor
()
{
super
();
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
this
.
_gameView
);
engine
.
globalEvent
.
addEventListener
(
'game-init'
,
this
.
init
,
this
);
engine
.
globalEvent
.
addEventListener
(
'game-reset'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'game-start'
,
this
.
start
,
this
);
}
init
(){
this
.
_gameView
.
init
();
}
reset
(){
this
.
_gameView
.
reset
();
}
start
(){
this
.
_gameView
.
start
();
}
}
src/custom/xiaoxiaole/src/game/MapData.ts
0 → 100644
View file @
e0fcb941
import
Element
from
"./ele/Element"
;
export
enum
ElementType
{
btiger
=
1
,
gtiger
,
monkey
,
bird
,
koala
}
export
enum
GameEvent
{
SelectEle
=
"SelectEle"
,
}
export
default
class
MapData
{
//单格大小
static
itemsize
=
129
;
//
static
paddingb
=
10
;
static
paddingi
=
5
;
//
static
row
=
5
;
static
col
=
5
;
//行-列,对应位置
static
posData
=
{
};
static
eleidx
=
1
;
static
elePool
=
[];
static
getRy
(
r
){
return
this
.
paddingb
+
r
*
(
this
.
itemsize
+
this
.
paddingi
);
}
static
getCx
(
c
){
return
this
.
paddingb
+
c
*
(
this
.
itemsize
+
this
.
paddingi
);
}
static
getRCPos
(
r
,
c
){
let
x
=
this
.
getCx
(
c
);
let
y
=
this
.
getRy
(
r
);
return
[
x
,
y
];
}
static
adaptElePos
(
pos
,
wid
,
hei
){
let
x
=
pos
[
0
]
+
(
this
.
itemsize
-
wid
)
/
2
;
let
y
=
pos
[
1
]
+
(
this
.
itemsize
-
hei
)
/
2
;
return
[
x
,
y
];
}
static
getEtypeImgName
(
type
:
ElementType
){
let
ename
:
string
;
switch
(
type
){
case
ElementType
.
btiger
:
ename
=
"白虎"
;
break
;
case
ElementType
.
gtiger
:
ename
=
"雌虎"
;
break
;
case
ElementType
.
monkey
:
ename
=
"猴子"
;
break
;
case
ElementType
.
bird
:
ename
=
"鸟"
;
break
;
case
ElementType
.
koala
:
ename
=
"树熊"
;
break
;
default
:
console
.
error
(
"未定义元素类型"
);
break
;
}
return
ename
;
}
static
getRandEtype
(){
let
eletypeArr
=
[
ElementType
.
btiger
,
ElementType
.
gtiger
,
ElementType
.
monkey
,
ElementType
.
bird
,
ElementType
.
koala
];
let
etype
=
eletypeArr
[
Math
.
floor
(
Math
.
random
()
*
eletypeArr
.
length
)];
return
etype
;
}
static
getOneEle
(
type
:
ElementType
):
Element
{
let
ele
:
Element
;
if
(
this
.
elePool
.
length
>
0
){
ele
=
this
.
elePool
.
shift
();
}
else
{
ele
=
new
Element
();
}
ele
.
name
=
"ele_"
+
this
.
eleidx
;
this
.
eleidx
+=
1
;
ele
.
init
(
type
)
return
ele
;
}
static
recoverEle
(
ele
:
Element
){
this
.
elePool
.
push
(
ele
);
}
static
getDistance
(
p1
,
p2
){
let
p1x
=
p1
[
0
];
let
p1y
=
p1
[
1
];
let
p2x
=
p2
[
0
];
let
p2y
=
p2
[
1
];
let
dis
=
Math
.
sqrt
(
Math
.
pow
(
p1x
-
p2x
,
2
)
+
Math
.
pow
(
p1y
-
p2y
,
2
));
return
dis
;
}
}
\ No newline at end of file
src/custom/xiaoxiaole/src/game/ele/Element.ts
0 → 100644
View file @
e0fcb941
import
MapData
,
{
ElementType
,
GameEvent
}
from
"../MapData"
;
import
{
getTextureByName
}
from
"../utils"
;
export
default
class
Element
extends
engine
.
Container
{
type
:
ElementType
;
eimage
:
engine
.
Image
;
inrow
;
incol
;
set
touch
(
touch
){
this
.
mouseEnabled
=
touch
;
this
.
mouseChildren
=
touch
;
}
constructor
(){
super
();
this
.
width
=
MapData
.
itemsize
;
this
.
height
=
MapData
.
itemsize
;
this
.
eimage
=
new
engine
.
Image
();
this
.
addChild
(
this
.
eimage
);
this
.
touch
=
true
;
this
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
selectele
,
this
);
}
init
(
type
:
ElementType
){
this
.
scaleX
=
1
;
this
.
scaleY
=
1
;
this
.
type
=
type
;
let
ename
=
MapData
.
getEtypeImgName
(
type
);
this
.
eimage
.
texture
=
getTextureByName
(
ename
);
let
imgwid
=
this
.
eimage
.
texture
.
width
;
let
imghei
=
this
.
eimage
.
texture
.
height
;
// console.log("大小",imgwid,imghei);
this
.
eimage
.
x
=
(
this
.
width
-
imgwid
)
/
2
;
this
.
eimage
.
y
=
(
this
.
height
-
imghei
)
/
2
;
}
setrc
(
r
,
c
){
this
.
inrow
=
r
;
this
.
incol
=
c
;
}
selectele
(
e
:
engine
.
MouseEvent
){
engine
.
globalEvent
.
dispatchEvent
(
GameEvent
.
SelectEle
,{
r
:
this
.
inrow
,
c
:
this
.
incol
})
}
//飞到小屋
flyToHome
(){
}
changePos
(){
}
}
\ No newline at end of file
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