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
403187b9
Commit
403187b9
authored
Jul 10, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
e0fcb941
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
235 additions
and
25 deletions
+235
-25
xiaoxiaole.json
dist/customs/xiaoxiaole.json
+1
-1
main.js
src/custom/xiaoxiaole/debug/main.js
+103
-11
main.js.map
src/custom/xiaoxiaole/debug/main.js.map
+1
-1
GameView.ts
src/custom/xiaoxiaole/src/game/GameView.ts
+94
-11
Element.ts
src/custom/xiaoxiaole/src/game/ele/Element.ts
+36
-1
No files found.
dist/customs/xiaoxiaole.json
View file @
403187b9
...
...
@@ -89,5 +89,5 @@
}
},
"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
"
"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
Object.defineProperty(Element.prototype,
\"
factor
\"
, {
\r\n\t
get: function () {
\r\n\t
return 0;
\r\n\t
},
\r\n\t
set: function (value) {
\r\n\t
this.x = (1 - value) * (1 - value) * this.p1x + 2 * value * (1 - value) * this.c1x + value * value * this.p2x;
\r\n\t
this.y = (1 - value) * (1 - value) * this.p1y + 2 * value * (1 - value) * this.c1y + value * value * this.p2y;
\r\n\t
var mscale = (1 - value) * (1 - value) * 1 + 2 * value * (1 - value) * 0.6 + value * value * 0;
\r\n\t
this.scaleX = mscale;
\r\n\t
this.scaleY = mscale;
\r\n\t
},
\r\n\t
enumerable: true,
\r\n\t
configurable: true
\r\n\t
});
\r\n\t
Element.prototype.flyToHome = function (tx, ty, time) {
\r\n\t
var _this = this;
\r\n\t
this.p1x = this.x;
\r\n\t
this.p1y = this.y;
\r\n\t
this.c1x = (this.p1x - tx) / 4 + tx;
\r\n\t
this.c1y = ty;
\r\n\t
this.p2x = tx;
\r\n\t
this.p2y = ty;
\r\n\t
engine.Tween.get(this).to({
\r\n\t
factor: 1
\r\n\t
}, time)
\r\n\t
.call(function () {
\r\n\t
var nodeparent = _this.parent;
\r\n\t
nodeparent && nodeparent.removeChild(_this);
\r\n\t
MapData.recoverEle(_this);
\r\n\t
});
\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
this.attionEliminate();
\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
MapData.recoverEle(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
var anix = ielix;
\r\n\t
var aniy = ieliy + this.conty;
\r\n\t
this.anicontainer.addChild(aniele);
\r\n\t
aniele.touch = false;
\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
aniele.flyToHome(this.tanix, this.taniy, 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
var attiondata;
\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 checktype = this.getEleTypeByRc(r, c);
\r\n\t
var edatarow = this.getEliminateRow(r, c);
\r\n\t
var edatacol = this.getEliminateCol(r, c);
\r\n\t
if (edatarow.length > 2 || edatacol.length > 2) {
\r\n\t
console.error(
\"
啥情况,检查----------------
\"
);
\r\n\t
}
\r\n\t
if (edatarow.length == 2) {
\r\n\t
console.log(
\"
横向查找
\"
, edatarow);
\r\n\t
var releidx1 = edatarow[0];
\r\n\t
var releidx2 = edatarow[1];
\r\n\t
var relerow1 = Number(releidx1.split(
\"
_
\"
)[0]);
\r\n\t
var relerow2 = Number(releidx2.split(
\"
_
\"
)[0]);
\r\n\t
var relecol = Number(releidx1.split(
\"
_
\"
)[1]);
\r\n\t
var downrow = relerow1 + 1;
\r\n\t
var uprow = relerow2 - 1;
\r\n\t
var rightcol = relecol + 1;
\r\n\t
var leftcol = relecol - 1;
\r\n\t
var mayeleidxs = new Array();
\r\n\t
if (downrow < MapData.row) {
\r\n\t
if (rightcol < MapData.col) {
\r\n\t
mayeleidxs.push(downrow +
\"
_
\"
+ rightcol);
\r\n\t
}
\r\n\t
if (leftcol > -1) {
\r\n\t
mayeleidxs.push(downrow +
\"
_
\"
+ leftcol);
\r\n\t
}
\r\n\t
}
\r\n\t
if (uprow > -1) {
\r\n\t
if (rightcol < MapData.col) {
\r\n\t
mayeleidxs.push(uprow +
\"
_
\"
+ rightcol);
\r\n\t
}
\r\n\t
if (leftcol > -1) {
\r\n\t
mayeleidxs.push(uprow +
\"
_
\"
+ leftcol);
\r\n\t
}
\r\n\t
}
\r\n\t
for (var ir = 0; ir < mayeleidxs.length; ir++) {
\r\n\t
var iridx = mayeleidxs[ir];
\r\n\t
var irename = this.lattices[iridx];
\r\n\t
if (irename) {
\r\n\t
var irerow = Number(iridx.split(
\"
_
\"
)[0]);
\r\n\t
var irecol = Number(iridx.split(
\"
_
\"
)[1]);
\r\n\t
var iretype = this.getEleTypeByRc(irerow, irecol);
\r\n\t
if (iretype == checktype) {
\r\n\t
console.log(
\"
相邻检测到了
\"
, iridx);
\r\n\t
attiondata = iridx;
\r\n\t
return;
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
if (edatacol.length == 2) {
\r\n\t
console.log(
\"
竖向查找
\"
, edatacol);
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
console.log(
\"
相邻检测--------------
\"
, attiondata);
\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.getEliminateRow = 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
return relearr;
\r\n\t
};
\r\n\t
GameView.prototype.getEliminateCol = function (x, y) {
\r\n\t
var checktype = this.getEleTypeByRc(x, y);
\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
return celearr;
\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 = this.getEliminateRow(x, y);
\r\n\t
var celearr = this.getEliminateCol(x, y);
\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));
\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/xiaoxiaole/debug/main.js
View file @
403187b9
...
...
@@ -53,7 +53,36 @@
c
:
this
.
incol
});
};
Element
.
prototype
.
flyToHome
=
function
()
{
Object
.
defineProperty
(
Element
.
prototype
,
"factor"
,
{
get
:
function
()
{
return
0
;
},
set
:
function
(
value
)
{
this
.
x
=
(
1
-
value
)
*
(
1
-
value
)
*
this
.
p1x
+
2
*
value
*
(
1
-
value
)
*
this
.
c1x
+
value
*
value
*
this
.
p2x
;
this
.
y
=
(
1
-
value
)
*
(
1
-
value
)
*
this
.
p1y
+
2
*
value
*
(
1
-
value
)
*
this
.
c1y
+
value
*
value
*
this
.
p2y
;
var
mscale
=
(
1
-
value
)
*
(
1
-
value
)
*
1
+
2
*
value
*
(
1
-
value
)
*
0.6
+
value
*
value
*
0
;
this
.
scaleX
=
mscale
;
this
.
scaleY
=
mscale
;
},
enumerable
:
true
,
configurable
:
true
});
Element
.
prototype
.
flyToHome
=
function
(
tx
,
ty
,
time
)
{
var
_this
=
this
;
this
.
p1x
=
this
.
x
;
this
.
p1y
=
this
.
y
;
this
.
c1x
=
(
this
.
p1x
-
tx
)
/
4
+
tx
;
this
.
c1y
=
ty
;
this
.
p2x
=
tx
;
this
.
p2y
=
ty
;
engine
.
Tween
.
get
(
this
).
to
({
factor
:
1
},
time
)
.
call
(
function
()
{
var
nodeparent
=
_this
.
parent
;
nodeparent
&&
nodeparent
.
removeChild
(
_this
);
MapData
.
recoverEle
(
_this
);
});
};
Element
.
prototype
.
changePos
=
function
()
{
};
...
...
@@ -229,6 +258,7 @@
}
}
this
.
checkEliminate
();
this
.
attionEliminate
();
};
GameView
.
prototype
.
setLatticeEleRc
=
function
(
rcidx
)
{
var
rename
=
this
.
lattices
[
rcidx
];
...
...
@@ -344,6 +374,7 @@
var
ielix
=
ielinode
.
x
;
var
ieliy
=
ielinode
.
y
;
this
.
container
.
removeChild
(
ielinode
);
MapData
.
recoverEle
(
ielinode
);
this
.
lattices
[
ielidxname
]
=
"empty"
;
this
.
goHomeAni
(
ielitype
,
ielix
,
ieliy
);
}
...
...
@@ -431,21 +462,15 @@
};
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
.
touch
=
false
;
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
);
aniele
.
flyToHome
(
this
.
tanix
,
this
.
taniy
,
anitime
);
};
GameView
.
prototype
.
changeEnable
=
function
(
v
)
{
for
(
var
key
in
this
.
lattices
)
{
...
...
@@ -455,6 +480,64 @@
}
};
GameView
.
prototype
.
attionEliminate
=
function
()
{
var
attiondata
;
for
(
var
r
=
MapData
.
row
-
1
;
r
>
-
1
;
r
--
)
{
for
(
var
c
=
MapData
.
col
-
1
;
c
>
-
1
;
c
--
)
{
var
checktype
=
this
.
getEleTypeByRc
(
r
,
c
);
var
edatarow
=
this
.
getEliminateRow
(
r
,
c
);
var
edatacol
=
this
.
getEliminateCol
(
r
,
c
);
if
(
edatarow
.
length
>
2
||
edatacol
.
length
>
2
)
{
console
.
error
(
"啥情况,检查----------------"
);
}
if
(
edatarow
.
length
==
2
)
{
console
.
log
(
"横向查找"
,
edatarow
);
var
releidx1
=
edatarow
[
0
];
var
releidx2
=
edatarow
[
1
];
var
relerow1
=
Number
(
releidx1
.
split
(
"_"
)[
0
]);
var
relerow2
=
Number
(
releidx2
.
split
(
"_"
)[
0
]);
var
relecol
=
Number
(
releidx1
.
split
(
"_"
)[
1
]);
var
downrow
=
relerow1
+
1
;
var
uprow
=
relerow2
-
1
;
var
rightcol
=
relecol
+
1
;
var
leftcol
=
relecol
-
1
;
var
mayeleidxs
=
new
Array
();
if
(
downrow
<
MapData
.
row
)
{
if
(
rightcol
<
MapData
.
col
)
{
mayeleidxs
.
push
(
downrow
+
"_"
+
rightcol
);
}
if
(
leftcol
>
-
1
)
{
mayeleidxs
.
push
(
downrow
+
"_"
+
leftcol
);
}
}
if
(
uprow
>
-
1
)
{
if
(
rightcol
<
MapData
.
col
)
{
mayeleidxs
.
push
(
uprow
+
"_"
+
rightcol
);
}
if
(
leftcol
>
-
1
)
{
mayeleidxs
.
push
(
uprow
+
"_"
+
leftcol
);
}
}
for
(
var
ir
=
0
;
ir
<
mayeleidxs
.
length
;
ir
++
)
{
var
iridx
=
mayeleidxs
[
ir
];
var
irename
=
this
.
lattices
[
iridx
];
if
(
irename
)
{
var
irerow
=
Number
(
iridx
.
split
(
"_"
)[
0
]);
var
irecol
=
Number
(
iridx
.
split
(
"_"
)[
1
]);
var
iretype
=
this
.
getEleTypeByRc
(
irerow
,
irecol
);
if
(
iretype
==
checktype
)
{
console
.
log
(
"相邻检测到了"
,
iridx
);
attiondata
=
iridx
;
return
;
}
}
}
}
if
(
edatacol
.
length
==
2
)
{
console
.
log
(
"竖向查找"
,
edatacol
);
}
}
}
console
.
log
(
"相邻检测--------------"
,
attiondata
);
};
GameView
.
prototype
.
checkEliminate
=
function
()
{
this
.
eliminateArr
=
new
Array
();
...
...
@@ -469,7 +552,7 @@
}
}
};
GameView
.
prototype
.
getEliminate
=
function
(
x
,
y
)
{
GameView
.
prototype
.
getEliminate
Row
=
function
(
x
,
y
)
{
var
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
var
relearr
=
new
Array
();
relearr
.
push
(
x
+
"_"
+
y
);
...
...
@@ -482,6 +565,10 @@
break
;
}
}
return
relearr
;
};
GameView
.
prototype
.
getEliminateCol
=
function
(
x
,
y
)
{
var
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
var
celearr
=
new
Array
();
celearr
.
push
(
x
+
"_"
+
y
);
for
(
var
c
=
y
-
1
;
c
>
-
1
;
c
--
)
{
...
...
@@ -493,6 +580,12 @@
break
;
}
}
return
celearr
;
};
GameView
.
prototype
.
getEliminate
=
function
(
x
,
y
)
{
var
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
var
relearr
=
this
.
getEliminateRow
(
x
,
y
);
var
celearr
=
this
.
getEliminateCol
(
x
,
y
);
var
eliminatearr
=
new
Array
();
if
(
relearr
.
length
>=
3
)
{
eliminatearr
.
push
.
apply
(
eliminatearr
,
relearr
);
...
...
@@ -550,7 +643,6 @@
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
...
...
src/custom/xiaoxiaole/debug/main.js.map
View file @
403187b9
{"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,KAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAC,KAAI,CAAC,SAAS,EAAC,KAAI,CAAC,CAAC;;MACtE;KAbD,sBAAI,0BAAK;cAAT,UAAU,KAAK;aACX,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;aAC1B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;UAC9B;;;QAAA;KAWD,sBAAI,GAAJ,UAAK,IAAgB;SACjB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SAChB,IAAI,CAAC,MAA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AM,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
{"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 public get factor():number {\r\n return 0;\r\n }\r\n public set factor(value:number) {\r\n this.x = (1 - value) * (1 - value) * this.p1x + 2 * value * (1 - value) * this.c1x + value * value * this.p2x;\r\n this.y = (1 - value) * (1 - value) * this.p1y + 2 * value * (1 - value) * this.c1y + value * value * this.p2y;\r\n \r\n var mscale = (1 - value) * (1 - value) * 1 + 2 * value * (1 - value) * 0.6 + value * value * 0;\r\n this.scaleX = mscale;\r\n this.scaleY = mscale;\r\n }\r\n p1x;\r\n p1y;\r\n\r\n c1x;\r\n c1y;\r\n\r\n p2x;\r\n p2y;\r\n //飞到小屋\r\n flyToHome(tx,ty,time){\r\n this.p1x = this.x;\r\n this.p1y = this.y;\r\n\r\n this.c1x = (this.p1x-tx)/4+tx;\r\n this.c1y = ty;\r\n\r\n this.p2x = tx;\r\n this.p2y = ty;\r\n \r\n engine.Tween.get(this).to({\r\n factor:1\r\n },time)\r\n .call(()=>{\r\n let nodeparent:engine.Container = this.parent;\r\n nodeparent&&nodeparent.removeChild(this);\r\n MapData.recoverEle(this);\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\r\n\t\tthis.attionEliminate();\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\t\t\tMapData.recoverEle(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\tlet anix = ielix;\r\n\t\tlet aniy = ieliy + this.conty;\r\n\t\tthis.anicontainer.addChild(aniele);\r\n\t\taniele.touch = false;\r\n\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\taniele.flyToHome(this.tanix,this.taniy,anitime);\r\n\t\t// engine.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\t//相邻检测\r\n\tattionEliminate(){\r\n\t\tlet attiondata;\r\n\t\tfor(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 checktype = this.getEleTypeByRc(r,c);\r\n\r\n\t\t\t\tlet edatarow = this.getEliminateRow(r,c);\r\n\t\t\t\tlet edatacol = this.getEliminateCol(r,c);\r\n\r\n\t\t\t\tif(edatarow.length>2||edatacol.length>2){\r\n\t\t\t\t\tconsole.error(\"啥情况,检查----------------\");\r\n\t\t\t\t}\r\n\t\t\t\tif(edatarow.length==2){\r\n\t\t\t\t\tconsole.log(\"横向查找\",edatarow);\r\n\t\t\t\t\tlet releidx1 = edatarow[0];\r\n\t\t\t\t\tlet releidx2 = edatarow[1];\r\n\r\n\t\t\t\t\tlet relerow1 = Number(releidx1.split(\"_\")[0]);\r\n\t\t\t\t\tlet relerow2 = Number(releidx2.split(\"_\")[0]);\r\n\t\t\t\t\tlet relecol = Number(releidx1.split(\"_\")[1]);\r\n\t\t\t\t\t\r\n\t\t\t\t\tlet downrow = relerow1+1;\r\n\t\t\t\t\tlet uprow = relerow2-1;\r\n\t\t\t\t\tlet rightcol = relecol+1;\r\n\t\t\t\t\tlet leftcol = relecol-1;\r\n\t\t\t\t\t\r\n\t\t\t\t\tlet mayeleidxs = new Array();\r\n\t\t\t\t\tif(downrow<MapData.row){\r\n\t\t\t\t\t\tif(rightcol<MapData.col){\r\n\t\t\t\t\t\t\tmayeleidxs.push(downrow+\"_\"+rightcol)\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif(leftcol>-1){\r\n\t\t\t\t\t\t\tmayeleidxs.push(downrow+\"_\"+leftcol);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(uprow>-1){\r\n\t\t\t\t\t\tif(rightcol<MapData.col){\r\n\t\t\t\t\t\t\tmayeleidxs.push(uprow+\"_\"+rightcol)\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif(leftcol>-1){\r\n\t\t\t\t\t\t\tmayeleidxs.push(uprow+\"_\"+leftcol);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor(let ir=0;ir<mayeleidxs.length;ir++){\r\n\t\t\t\t\t\tlet iridx = mayeleidxs[ir];\r\n\t\t\t\t\t\tlet irename = this.lattices[iridx];\r\n\t\t\t\t\t\tif(irename){\r\n\t\t\t\t\t\t\tlet irerow = Number(iridx.split(\"_\")[0]);\r\n\t\t\t\t\t\t\tlet irecol = Number(iridx.split(\"_\")[1]);\r\n\t\t\t\t\t\t\tlet iretype = this.getEleTypeByRc(irerow,irecol);\r\n\t\t\t\t\t\t\tif(iretype==checktype){\r\n\t\t\t\t\t\t\t\tconsole.log(\"相邻检测到了\",iridx);\r\n\t\t\t\t\t\t\t\tattiondata = iridx;\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(edatacol.length==2){\r\n\t\t\t\t\tconsole.log(\"竖向查找\",edatacol);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconsole.log(\"相邻检测--------------\",attiondata);\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\tgetEliminateRow(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\t\treturn relearr;\r\n\t}\r\n\tgetEliminateCol(x,y){\r\n\t\tlet checktype = this.getEleTypeByRc(x,y);\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\t\treturn celearr;\r\n\t}\r\n\tgetEliminate(x,y){\r\n\t\tlet checktype = this.getEleTypeByRc(x,y);\r\n\r\n\t\tlet relearr = this.getEliminateRow(x,y);\r\n\r\n\t\tlet celearr = this.getEliminateCol(x,y);\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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,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/src/game/GameView.ts
View file @
403187b9
...
...
@@ -117,6 +117,8 @@ export default class GameView extends engine.Container {
}
this
.
checkEliminate
();
this
.
attionEliminate
();
}
//关联
setLatticeEleRc
(
rcidx
){
...
...
@@ -250,6 +252,7 @@ export default class GameView extends engine.Container {
let
ielix
=
ielinode
.
x
;
let
ieliy
=
ielinode
.
y
;
this
.
container
.
removeChild
(
ielinode
);
MapData
.
recoverEle
(
ielinode
);
this
.
lattices
[
ielidxname
]
=
"empty"
;
//元素层消除,动画层添加
...
...
@@ -334,23 +337,25 @@ export default class GameView extends engine.Container {
}
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
.
touch
=
false
;
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
);
aniele
.
flyToHome
(
this
.
tanix
,
this
.
taniy
,
anitime
);
// engine.Tween.get(aniele)
// .to({
// x:this.tanix,
// y:this.taniy,
// scaleX:0,
// scaleY:0
// },anitime);
}
//修改元素点击
...
...
@@ -362,8 +367,75 @@ export default class GameView extends engine.Container {
}
}
//相邻检测
attionEliminate
(){
let
attiondata
;
for
(
let
r
=
MapData
.
row
-
1
;
r
>-
1
;
r
--
){
for
(
let
c
=
MapData
.
col
-
1
;
c
>-
1
;
c
--
){
let
checktype
=
this
.
getEleTypeByRc
(
r
,
c
);
let
edatarow
=
this
.
getEliminateRow
(
r
,
c
);
let
edatacol
=
this
.
getEliminateCol
(
r
,
c
);
if
(
edatarow
.
length
>
2
||
edatacol
.
length
>
2
){
console
.
error
(
"啥情况,检查----------------"
);
}
if
(
edatarow
.
length
==
2
){
console
.
log
(
"横向查找"
,
edatarow
);
let
releidx1
=
edatarow
[
0
];
let
releidx2
=
edatarow
[
1
];
let
relerow1
=
Number
(
releidx1
.
split
(
"_"
)[
0
]);
let
relerow2
=
Number
(
releidx2
.
split
(
"_"
)[
0
]);
let
relecol
=
Number
(
releidx1
.
split
(
"_"
)[
1
]);
let
downrow
=
relerow1
+
1
;
let
uprow
=
relerow2
-
1
;
let
rightcol
=
relecol
+
1
;
let
leftcol
=
relecol
-
1
;
let
mayeleidxs
=
new
Array
();
if
(
downrow
<
MapData
.
row
){
if
(
rightcol
<
MapData
.
col
){
mayeleidxs
.
push
(
downrow
+
"_"
+
rightcol
)
}
if
(
leftcol
>-
1
){
mayeleidxs
.
push
(
downrow
+
"_"
+
leftcol
);
}
}
if
(
uprow
>-
1
){
if
(
rightcol
<
MapData
.
col
){
mayeleidxs
.
push
(
uprow
+
"_"
+
rightcol
)
}
if
(
leftcol
>-
1
){
mayeleidxs
.
push
(
uprow
+
"_"
+
leftcol
);
}
}
for
(
let
ir
=
0
;
ir
<
mayeleidxs
.
length
;
ir
++
){
let
iridx
=
mayeleidxs
[
ir
];
let
irename
=
this
.
lattices
[
iridx
];
if
(
irename
){
let
irerow
=
Number
(
iridx
.
split
(
"_"
)[
0
]);
let
irecol
=
Number
(
iridx
.
split
(
"_"
)[
1
]);
let
iretype
=
this
.
getEleTypeByRc
(
irerow
,
irecol
);
if
(
iretype
==
checktype
){
console
.
log
(
"相邻检测到了"
,
iridx
);
attiondata
=
iridx
;
return
;
}
}
}
}
if
(
edatacol
.
length
==
2
){
console
.
log
(
"竖向查找"
,
edatacol
);
}
}
}
console
.
log
(
"相邻检测--------------"
,
attiondata
);
}
//检测消除
checkEliminate
(){
...
...
@@ -380,7 +452,7 @@ export default class GameView extends engine.Container {
}
}
getEliminate
(
x
,
y
){
getEliminate
Row
(
x
,
y
){
let
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
let
relearr
=
new
Array
();
...
...
@@ -393,7 +465,10 @@ export default class GameView extends engine.Container {
break
;
}
}
return
relearr
;
}
getEliminateCol
(
x
,
y
){
let
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
let
celearr
=
new
Array
();
celearr
.
push
(
x
+
"_"
+
y
);
for
(
let
c
=
y
-
1
;
c
>-
1
;
c
--
){
...
...
@@ -404,6 +479,14 @@ export default class GameView extends engine.Container {
break
;
}
}
return
celearr
;
}
getEliminate
(
x
,
y
){
let
checktype
=
this
.
getEleTypeByRc
(
x
,
y
);
let
relearr
=
this
.
getEliminateRow
(
x
,
y
);
let
celearr
=
this
.
getEliminateCol
(
x
,
y
);
let
eliminatearr
=
new
Array
();
if
(
relearr
.
length
>=
3
){
...
...
src/custom/xiaoxiaole/src/game/ele/Element.ts
View file @
403187b9
...
...
@@ -48,9 +48,44 @@ export default class Element extends engine.Container{
})
}
public
get
factor
():
number
{
return
0
;
}
public
set
factor
(
value
:
number
)
{
this
.
x
=
(
1
-
value
)
*
(
1
-
value
)
*
this
.
p1x
+
2
*
value
*
(
1
-
value
)
*
this
.
c1x
+
value
*
value
*
this
.
p2x
;
this
.
y
=
(
1
-
value
)
*
(
1
-
value
)
*
this
.
p1y
+
2
*
value
*
(
1
-
value
)
*
this
.
c1y
+
value
*
value
*
this
.
p2y
;
var
mscale
=
(
1
-
value
)
*
(
1
-
value
)
*
1
+
2
*
value
*
(
1
-
value
)
*
0.6
+
value
*
value
*
0
;
this
.
scaleX
=
mscale
;
this
.
scaleY
=
mscale
;
}
p1x
;
p1y
;
c1x
;
c1y
;
p2x
;
p2y
;
//飞到小屋
flyToHome
(){
flyToHome
(
tx
,
ty
,
time
){
this
.
p1x
=
this
.
x
;
this
.
p1y
=
this
.
y
;
this
.
c1x
=
(
this
.
p1x
-
tx
)
/
4
+
tx
;
this
.
c1y
=
ty
;
this
.
p2x
=
tx
;
this
.
p2y
=
ty
;
engine
.
Tween
.
get
(
this
).
to
({
factor
:
1
},
time
)
.
call
(()
=>
{
let
nodeparent
:
engine
.
Container
=
this
.
parent
;
nodeparent
&&
nodeparent
.
removeChild
(
this
);
MapData
.
recoverEle
(
this
);
})
}
changePos
(){
...
...
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