Commit 4efdedb5 authored by zjz1994's avatar zjz1994

代码暂存

parent 4ec33419
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -47,7 +47,8 @@ function launchWithCustomModule(customModule) { ...@@ -47,7 +47,8 @@ function launchWithCustomModule(customModule) {
setTimeout(() => { setTimeout(() => {
engine.globalEvent.dispatchEvent('game-init',{ engine.globalEvent.dispatchEvent('game-init',{
time:100000, time:100000,
level:1 level:1,
mode:"day"
}); });
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
......
...@@ -373,6 +373,34 @@ ...@@ -373,6 +373,34 @@
MapData.initPoolEle(); MapData.initPoolEle();
this.selectimg = new engine.Image(getTextureByName("选中框")); this.selectimg = new engine.Image(getTextureByName("选中框"));
this.selectimg.mouseEnabled = false; this.selectimg.mouseEnabled = false;
this.jiantou1 = new engine.Image(getTextureByName("交换箭头"));
this.jiantou2 = new engine.Image(getTextureByName("交换箭头"));
this.jiantou1.mouseEnabled = false;
this.jiantou2.mouseEnabled = false;
var jiantwid = 31;
var jianthei = 24;
this.jiantou1.anchorX = jiantwid / 2;
this.jiantou1.anchorY = jianthei / 2;
this.jiantou2.anchorX = jiantwid / 2;
this.jiantou2.anchorY = jianthei / 2;
this.jiantoucont = new engine.Container();
this.jiantoucont.width = MapData.itemsize;
this.jiantoucont.height = MapData.itemsize;
this.jtsx1 = MapData.itemsize / 2 - jiantwid / 2;
this.jtsx2 = MapData.itemsize / 2 - jiantwid / 2;
this.jtsy1 = MapData.itemsize / 2 - jianthei;
this.jtsy2 = MapData.itemsize / 2;
this.jtex1 = this.jtsx1 - 10;
this.jtex2 = this.jtsx2 + 10;
this.jtey1 = this.jtsy1;
this.jtey2 = this.jtsy2;
this.jiantou1.x = this.jtsx1;
this.jiantou2.rotation = 180;
this.jiantou2.x = this.jtsx2;
this.jiantou1.y = this.jtsy1;
this.jiantou2.y = this.jtsy2;
this.jiantoucont.addChild(this.jiantou1);
this.jiantoucont.addChild(this.jiantou2);
var row = MapData.row; var row = MapData.row;
var col = MapData.col; var col = MapData.col;
this.homeimgday = createSvga("房子动画"); this.homeimgday = createSvga("房子动画");
...@@ -536,7 +564,7 @@ ...@@ -536,7 +564,7 @@
var ntime = Date.now(); var ntime = Date.now();
if (this.gamestat == 1) { if (this.gamestat == 1) {
var passtime = ntime - this.lastframeTime; var passtime = ntime - this.lastframeTime;
if (ntime - this.lastatime >= 5000 && !this.ination && this.canation && this.selectArr.length == 0) { if (ntime - this.lastatime >= 2000 && !this.ination && this.canation && this.selectArr.length == 0) {
this.attionEliShow(); this.attionEliShow();
} }
if (this.gametime && this.gametime > 0) { if (this.gametime && this.gametime > 0) {
...@@ -574,11 +602,11 @@ ...@@ -574,11 +602,11 @@
this.lattices = {}; this.lattices = {};
} }
var testdata = [ var testdata = [
[1, 2, 5, 3, 4], [1, 2, 1, 4, 1],
[3, 1, 5, 4, 5], [3, 1, 4, 5, 4],
[2, 5, 3, 5, 1], [2, 5, 3, 5, 1],
[5, 4, 5, 2, 3], [5, 4, 1, 2, 3],
[4, 1, 5, 5, 2], [4, 1, 3, 1, 2],
]; ];
this.levelData = testdata; this.levelData = testdata;
for (var r = 0; r < testdata.length; r++) { for (var r = 0; r < testdata.length; r++) {
...@@ -644,6 +672,7 @@ ...@@ -644,6 +672,7 @@
atnode1.y = atpos1[1]; atnode1.y = atpos1[1];
atnode2.x = atpos2[0]; atnode2.x = atpos2[0];
atnode2.y = atpos2[1]; atnode2.y = atpos2[1];
this.anicontainer.removeChild(this.jiantoucont);
} }
}; };
GameView.prototype.selectele = function (e) { GameView.prototype.selectele = function (e) {
...@@ -1031,11 +1060,62 @@ ...@@ -1031,11 +1060,62 @@
x: atx2, x: atx2,
y: aty2 y: aty2
}, 500); }, 500);
var jtx = (atx2 - atx1) * 0.5 + atx1;
var jty = (aty2 - aty1) * 0.5 + aty1 + this.conty;
var chax1 = atx1 - atpos1[0];
var chay1 = aty1 - atpos1[1];
var roa1 = 0;
if (Math.abs(chax1) > Math.abs(chay1)) {
jty += 25;
console.log("横向移动");
}
else {
jtx += MapData.itemsize;
roa1 = 90;
console.log("竖向移动");
}
this.anicontainer.addChild(this.jiantoucont);
this.jiantoucont.x = jtx;
this.jiantoucont.y = jty;
this.jiantoucont.rotation = roa1;
this.startJtAni();
} }
else { else {
this.solveDieMap(); this.solveDieMap();
} }
}; };
GameView.prototype.startJtAni = function () {
engine.Tween.removeTweens(this.jiantou1);
engine.Tween.removeTweens(this.jiantou2);
this.jiantou1.x = this.jtex1;
this.jiantou1.y = this.jtey1;
this.jiantou2.x = this.jtex2;
this.jiantou2.y = this.jtey2;
this.jiantou1.alpha = 1;
this.jiantou2.alpha = 1;
engine.Tween.get(this.jiantou1, { loop: true })
.to({
x: this.jtsx1,
y: this.jtsy1,
alpha: 0
}, 500)
.to({
x: this.jtex1,
y: this.jtey1,
alpha: 1
}, 500);
engine.Tween.get(this.jiantou2, { loop: true })
.to({
x: this.jtsx2,
y: this.jtsy2,
alpha: 0
}, 500)
.to({
x: this.jtex2,
y: this.jtey2,
alpha: 1
}, 500);
};
GameView.prototype.solveDieMap = function (type) { GameView.prototype.solveDieMap = function (type) {
if (type === void 0) { type = "normal"; } if (type === void 0) { type = "normal"; }
if (this.gamestat != 1) { if (this.gamestat != 1) {
...@@ -1124,6 +1204,7 @@ ...@@ -1124,6 +1204,7 @@
var edatacol = this.getEliminateCol(r, c); var edatacol = this.getEliminateCol(r, c);
if (edatarow.length > 2 || edatacol.length > 2) ; if (edatarow.length > 2 || edatacol.length > 2) ;
if (edatarow.length == 2) { if (edatarow.length == 2) {
console.log("横向查找", edatarow, checktype);
var releidx1 = edatarow[0]; var releidx1 = edatarow[0];
var releidx2 = edatarow[1]; var releidx2 = edatarow[1];
var relerow1 = Number(releidx1.split("_")[0]); var relerow1 = Number(releidx1.split("_")[0]);
...@@ -1183,6 +1264,7 @@ ...@@ -1183,6 +1264,7 @@
} }
} }
if (edatacol.length == 2) { if (edatacol.length == 2) {
console.log("竖向查找", edatacol, checktype);
var releidx1 = edatacol[0]; var releidx1 = edatacol[0];
var releidx2 = edatacol[1]; var releidx2 = edatacol[1];
var relerow = Number(releidx1.split("_")[0]); var relerow = Number(releidx1.split("_")[0]);
...@@ -1243,6 +1325,7 @@ ...@@ -1243,6 +1325,7 @@
} }
var jianrow = this.getEliminateRowR(r, c); var jianrow = this.getEliminateRowR(r, c);
if (jianrow.length == 2) { if (jianrow.length == 2) {
console.log("中间插入33", jianrow);
var jianr = Number(jianrow[0].split("_")[0]) - 1; var jianr = Number(jianrow[0].split("_")[0]) - 1;
var jianc = Number(jianrow[0].split("_")[1]); var jianc = Number(jianrow[0].split("_")[1]);
var ljianc = jianc - 1; var ljianc = jianc - 1;
...@@ -1264,6 +1347,7 @@ ...@@ -1264,6 +1347,7 @@
} }
var jiancol = this.getEliminateRowC(r, c); var jiancol = this.getEliminateRowC(r, c);
if (jiancol.length == 2) { if (jiancol.length == 2) {
console.log("中间插入44", jiancol);
var jianr = Number(jiancol[0].split("_")[0]); var jianr = Number(jiancol[0].split("_")[0]);
var jianc = Number(jianrow[0].split("_")[1]) - 1; var jianc = Number(jianrow[0].split("_")[1]) - 1;
var ujianr = jianr - 1; var ujianr = jianr - 1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -61,6 +61,12 @@ ...@@ -61,6 +61,12 @@
"uuid": "selected", "uuid": "selected",
"ext": ".png" "ext": ".png"
}, },
{
"name": "交换箭头",
"url": "//yun.duiba.com.cn/aurora/assets/438ca6e721eab32728aceaca5df0095e1387f340.png",
"uuid": "jiantou",
"ext": ".png"
},
{ {
"name": "房子动画", "name": "房子动画",
"url": "//yun.duiba.com.cn/aurora/assets/10d6c3c657e4f26eee2e6f1edca36ec468d57353.svga", "url": "//yun.duiba.com.cn/aurora/assets/10d6c3c657e4f26eee2e6f1edca36ec468d57353.svga",
......
...@@ -55,6 +55,20 @@ export default class GameView extends engine.Container { ...@@ -55,6 +55,20 @@ export default class GameView extends engine.Container {
_gamestat=2; _gamestat=2;
ingameover = false; ingameover = false;
jiantou1:engine.Image;
jiantou2:engine.Image;
jiantoucont:engine.Container;
jtsx1;
jtsy1;
jtsx2;
jtsy2;
jtex1;
jtey1;
jtex2;
jtey2;
set gamestat(stat){//1游戏中,2,游戏外 set gamestat(stat){//1游戏中,2,游戏外
this._gamestat = stat; this._gamestat = stat;
if(stat==2){ if(stat==2){
...@@ -81,10 +95,50 @@ export default class GameView extends engine.Container { ...@@ -81,10 +95,50 @@ export default class GameView extends engine.Container {
this.selectimg = new engine.Image(getTextureByName("选中框")); this.selectimg = new engine.Image(getTextureByName("选中框"));
this.selectimg.mouseEnabled = false; this.selectimg.mouseEnabled = false;
//箭头cont
this.jiantou1 = new engine.Image(getTextureByName("交换箭头"));
this.jiantou2 = new engine.Image(getTextureByName("交换箭头"));
this.jiantou1.mouseEnabled = false;
this.jiantou2.mouseEnabled = false;
let jiantwid = 31;
let jianthei = 24;
this.jiantou1.anchorX = jiantwid/2;
this.jiantou1.anchorY = jianthei/2;
this.jiantou2.anchorX = jiantwid/2;
this.jiantou2.anchorY = jianthei/2;
this.jiantoucont = new engine.Container();
this.jiantoucont.width = MapData.itemsize;
this.jiantoucont.height = MapData.itemsize;
this.jtsx1 = MapData.itemsize/2-jiantwid/2;
this.jtsx2 = MapData.itemsize/2-jiantwid/2;
this.jtsy1 = MapData.itemsize/2-jianthei;
this.jtsy2 = MapData.itemsize/2;
this.jtex1 = this.jtsx1-10;
this.jtex2 = this.jtsx2+10;
this.jtey1 = this.jtsy1;
this.jtey2 = this.jtsy2;
this.jiantou1.x = this.jtsx1;
this.jiantou2.rotation = 180;
this.jiantou2.x = this.jtsx2;
this.jiantou1.y = this.jtsy1;
this.jiantou2.y = this.jtsy2;
this.jiantoucont.addChild(this.jiantou1);
this.jiantoucont.addChild(this.jiantou2);
let row = MapData.row; let row = MapData.row;
let col = MapData.col; let col = MapData.col;
this.homeimgday = createSvga("房子动画"); this.homeimgday = createSvga("房子动画");
this.homeimgday.x = this.homex; this.homeimgday.x = this.homex;
this.homeimgday.y = this.homey; this.homeimgday.y = this.homey;
...@@ -129,7 +183,6 @@ export default class GameView extends engine.Container { ...@@ -129,7 +183,6 @@ export default class GameView extends engine.Container {
let map = new engine.Image(getTextureByName("底图")); let map = new engine.Image(getTextureByName("底图"));
this.container.addChild(map); this.container.addChild(map);
//初始化底图 //初始化底图
for(let r=0;r<row;r++){ for(let r=0;r<row;r++){
...@@ -264,7 +317,7 @@ export default class GameView extends engine.Container { ...@@ -264,7 +317,7 @@ export default class GameView extends engine.Container {
let ntime = Date.now(); let ntime = Date.now();
if(this.gamestat==1){ if(this.gamestat==1){
let passtime = ntime - this.lastframeTime; let passtime = ntime - this.lastframeTime;
if(ntime-this.lastatime>=5000&&!this.ination&&this.canation&&this.selectArr.length==0){ if(ntime-this.lastatime>=2000&&!this.ination&&this.canation&&this.selectArr.length==0){
this.attionEliShow(); this.attionEliShow();
} }
if(this.gametime&&this.gametime>0){ if(this.gametime&&this.gametime>0){
...@@ -302,13 +355,20 @@ export default class GameView extends engine.Container { ...@@ -302,13 +355,20 @@ export default class GameView extends engine.Container {
this.lattices = {}; this.lattices = {};
} }
// let testdata = [
// [1,2,5,3,4],
// [3,1,5,4,5],
// [2,5,3,5,1],
// [5,4,5,2,3],
// [4,1,5,5,2],
// ];
let testdata = [ let testdata = [
[1,2,5,3,4], [1,2,1,4,1],
[3,1,5,4,5], [3,1,4,5,4],
[2,5,3,5,1], [2,5,3,5,1],
[5,4,5,2,3], [5,4,1,2,3],
[4,1,5,5,2], [4,1,3,1,2],
] ];
this.levelData = testdata; this.levelData = testdata;
for(let r=0;r<testdata.length;r++){ for(let r=0;r<testdata.length;r++){
...@@ -383,6 +443,8 @@ export default class GameView extends engine.Container { ...@@ -383,6 +443,8 @@ export default class GameView extends engine.Container {
atnode2.x = atpos2[0]; atnode2.x = atpos2[0];
atnode2.y = atpos2[1]; atnode2.y = atpos2[1];
this.anicontainer.removeChild(this.jiantoucont);
} }
} }
//选择元素 //选择元素
...@@ -797,11 +859,72 @@ export default class GameView extends engine.Container { ...@@ -797,11 +859,72 @@ export default class GameView extends engine.Container {
x:atx2, x:atx2,
y:aty2 y:aty2
},500); },500);
//箭头动画
let jtx = (atx2-atx1)*0.5+atx1;
let jty = (aty2-aty1)*0.5+aty1+this.conty;
let chax1 = atx1-atpos1[0];
let chay1 = aty1-atpos1[1];
let roa1 = 0;
if(Math.abs(chax1)>Math.abs(chay1)){
jty += 25;
console.log("横向移动");
}else{
jtx += MapData.itemsize;
roa1 = 90;
console.log("竖向移动");
}
this.anicontainer.addChild(this.jiantoucont);
this.jiantoucont.x = jtx;
this.jiantoucont.y = jty;
this.jiantoucont.rotation = roa1;
this.startJtAni();
}else{//死图处理 }else{//死图处理
this.solveDieMap(); this.solveDieMap();
} }
} }
startJtAni(){
engine.Tween.removeTweens(this.jiantou1);
engine.Tween.removeTweens(this.jiantou2);
this.jiantou1.x = this.jtex1;
this.jiantou1.y = this.jtey1;
this.jiantou2.x = this.jtex2;
this.jiantou2.y = this.jtey2;
this.jiantou1.alpha = 1;
this.jiantou2.alpha = 1;
// console.log("欢动测试",this.jtsx1,this.jtsy1,this.jtex1,this.jtey1);
// return;
engine.Tween.get(this.jiantou1,{loop:true})
.to({
x:this.jtsx1,
y:this.jtsy1,
alpha:0
},500)
.to({
x:this.jtex1,
y:this.jtey1,
alpha:1
},500)
engine.Tween.get(this.jiantou2,{loop:true})
.to({
x:this.jtsx2,
y:this.jtsy2,
alpha:0
},500)
.to({
x:this.jtex2,
y:this.jtey2,
alpha:1
},500)
}
//死图调整 //死图调整
solveDieMap(type="normal"){ solveDieMap(type="normal"){
if(this.gamestat!=1){ if(this.gamestat!=1){
...@@ -896,7 +1019,7 @@ export default class GameView extends engine.Container { ...@@ -896,7 +1019,7 @@ export default class GameView extends engine.Container {
// console.error("啥情况,检查----------------"); // console.error("啥情况,检查----------------");
} }
if(edatarow.length==2){ if(edatarow.length==2){
// console.log("横向查找",edatarow,checktype); console.log("横向查找",edatarow,checktype);
let releidx1 = edatarow[0]; let releidx1 = edatarow[0];
let releidx2 = edatarow[1]; let releidx2 = edatarow[1];
...@@ -960,23 +1083,9 @@ export default class GameView extends engine.Container { ...@@ -960,23 +1083,9 @@ export default class GameView extends engine.Container {
break; break;
} }
} }
// 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){ if(edatacol.length==2){
// console.log("竖向查找",edatacol,checktype); console.log("竖向查找",edatacol,checktype);
let releidx1 = edatacol[0]; let releidx1 = edatacol[0];
let releidx2 = edatacol[1]; let releidx2 = edatacol[1];
...@@ -1044,7 +1153,7 @@ export default class GameView extends engine.Container { ...@@ -1044,7 +1153,7 @@ export default class GameView extends engine.Container {
//中间插的,俩边一样的这种 //中间插的,俩边一样的这种
let jianrow = this.getEliminateRowR(r,c); let jianrow = this.getEliminateRowR(r,c);
if(jianrow.length==2){ if(jianrow.length==2){
// console.log("中间插入33",jianrow); console.log("中间插入33",jianrow);
let jianr = Number(jianrow[0].split("_")[0])-1; let jianr = Number(jianrow[0].split("_")[0])-1;
let jianc = Number(jianrow[0].split("_")[1]); let jianc = Number(jianrow[0].split("_")[1]);
...@@ -1068,7 +1177,7 @@ export default class GameView extends engine.Container { ...@@ -1068,7 +1177,7 @@ export default class GameView extends engine.Container {
let jiancol = this.getEliminateRowC(r,c); let jiancol = this.getEliminateRowC(r,c);
if(jiancol.length==2){ if(jiancol.length==2){
// console.log("中间插入44",jiancol); console.log("中间插入44",jiancol);
let jianr = Number(jiancol[0].split("_")[0]); let jianr = Number(jiancol[0].split("_")[0]);
let jianc = Number(jianrow[0].split("_")[1])-1; let jianc = Number(jianrow[0].split("_")[1])-1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment