Commit beb4bf2e authored by zjz1994's avatar zjz1994

暂存1

parent f2c6af7b
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -52,9 +52,9 @@ function launchWithCustomModule(customModule) { ...@@ -52,9 +52,9 @@ function launchWithCustomModule(customModule) {
}); });
}, 500); }, 500);
setTimeout(() => { // setTimeout(() => {
engine.globalEvent.dispatchEvent('game-newuserguide'); // engine.globalEvent.dispatchEvent('game-newuserguide');
}, 700); // }, 700);
// setTimeout(() => { // setTimeout(() => {
// engine.globalEvent.dispatchEvent('game-start'); // engine.globalEvent.dispatchEvent('game-start');
// }, 700); // }, 700);
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
function getTextureByName(name) { function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid); return getTexture(engine.getAssetByName(name).uuid);
} }
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
var Element = (function (_super) { var Element = (function (_super) {
...@@ -391,6 +396,86 @@ ...@@ -391,6 +396,86 @@
}()); }());
//# sourceMappingURL=MapData.js.map //# sourceMappingURL=MapData.js.map
var boomAni = (function (_super) {
tslib.__extends(boomAni, _super);
function boomAni() {
var _this = _super.call(this) || this;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
boomAni.prototype.setup = function () {
this.boomimg = new engine.Image(getTextureByName("炸弹中心"));
this.boomimg.anchorX = 95;
this.boomimg.anchorY = 108;
this.boomimg.x = -32;
this.boomimg.y = -47;
var boomtex = getTextureByName("爆炸闪光");
var boomwid = boomtex.width;
var boomhei = boomtex.height;
this.hboomimg = new engine.Image();
this.vboomimg = new engine.Image();
this.hboomimg.texture = boomtex;
this.vboomimg.texture = boomtex;
this.hboomimg.width = boomwid;
this.hboomimg.height = boomhei;
this.hboomimg.anchorX = boomwid / 2;
this.hboomimg.anchorY = boomhei / 2;
this.hboomimg.y = -boomhei / 2 + 65;
this.hboomimg.x = -20;
this.vboomimg.width = boomwid;
this.vboomimg.height = boomhei;
this.vboomimg.anchorX = boomwid / 2;
this.vboomimg.anchorY = boomhei / 2;
this.vboomimg.rotation = 90;
this.vboomimg.y = -boomhei / 2 + 65;
this.vboomimg.x = -20;
this.hboomimg.scaleY = 0.1;
this.vboomimg.scaleY = 0.1;
this.addChild(this.boomimg);
this.addChild(this.hboomimg);
this.addChild(this.vboomimg);
this.mouseEnabled = false;
this.mouseChildren = false;
this.alpha = 0;
};
boomAni.prototype.playBoomAni = function () {
var _this = this;
this.alpha = 1;
this.boomimg.scaleX = 0;
this.boomimg.scaleY = 0;
engine.Tween.get(this.boomimg)
.to({
scaleX: 1.2,
scaleY: 1.2
}, 200, engine.Ease.quadIn);
this.hboomimg.scaleY = 0.1;
this.hboomimg.alpha = 1;
this.vboomimg.scaleY = 0.1;
this.vboomimg.alpha = 1;
engine.Tween.get(this.hboomimg)
.to({
scaleY: 1,
alpha: 0.8
}, 150, engine.Ease.quadIn)
.to({
alpha: 0
}, 50, engine.Ease.quadIn);
engine.Tween.get(this.vboomimg)
.to({
scaleY: 1,
alpha: 0.8
}, 150, engine.Ease.quadIn)
.to({
alpha: 0
}, 50, engine.Ease.quadIn)
.call(function () {
_this.alpha = 0;
});
};
return boomAni;
}(engine.Container));
//# sourceMappingURL=boomAni.js.map
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
function GameView() { function GameView() {
...@@ -412,6 +497,7 @@ ...@@ -412,6 +497,7 @@
_this.requestGameOver = false; _this.requestGameOver = false;
_this.elitype = 1; _this.elitype = 1;
_this.inguide = false; _this.inguide = false;
_this.diseffectArr = [];
_this._seq = 1; _this._seq = 1;
_this.sptime = Date.now(); _this.sptime = Date.now();
_this.useBoom = false; _this.useBoom = false;
...@@ -483,6 +569,7 @@ ...@@ -483,6 +569,7 @@
this.jiantoucont.addChild(this.jiantou2); this.jiantoucont.addChild(this.jiantou2);
var row = MapData.row; var row = MapData.row;
var col = MapData.col; var col = MapData.col;
this.shoueffect = createSvga("手指动效");
this.container = new engine.Container(); this.container = new engine.Container();
this.addChild(this.container); this.addChild(this.container);
this.container.y = this.conty; this.container.y = this.conty;
...@@ -523,7 +610,13 @@ ...@@ -523,7 +610,13 @@
this.guideCont.addChild(this.guideDraw); this.guideCont.addChild(this.guideDraw);
this.guideCont.visible = false; this.guideCont.visible = false;
this.guideCont.mouseEnabled = false; this.guideCont.mouseEnabled = false;
this.guideCont.addChild(this.shoueffect);
this.shoueffect.mouseEnabled = false;
this.shoueffect.mouseChildren = false;
this.shoueffect.visible = false;
this.setGuidePath(); this.setGuidePath();
this.boomani = new boomAni();
this.anicontainer.addChild(this.boomani);
}; };
GameView.prototype.changeAni = function () { GameView.prototype.changeAni = function () {
this.changeHomeShow("night"); this.changeHomeShow("night");
...@@ -739,19 +832,17 @@ ...@@ -739,19 +832,17 @@
} }
}; };
GameView.prototype.selectele = function (e) { GameView.prototype.selectele = function (e) {
console.log("选中元素");
if (!this.ingame) { if (!this.ingame) {
return; return;
} }
var data = e.data; var data = e.data;
console.log(data);
var sr = data.r; var sr = data.r;
var sc = data.c; var sc = data.c;
var type = data.type; var type = data.type;
var sname = sr + "_" + sc; var sname = sr + "_" + sc;
if (this.useBoom) { if (this.useBoom) {
if (type == "mouse_down") { if (type == "mouse_down") {
this.unShowEleAttion(); this.changeEnable(false);
this.boomeEle(sr, sc); this.boomeEle(sr, sc);
} }
return; return;
...@@ -864,6 +955,8 @@ ...@@ -864,6 +955,8 @@
engine.Tween.removeTweens(snode2); engine.Tween.removeTweens(snode2);
if (this.eliminateArr.length > 0) { if (this.eliminateArr.length > 0) {
if (this.inguide) { if (this.inguide) {
this.shoueffect.stop(0);
this.shoueffect.visible = false;
this.inguide = false; this.inguide = false;
engine.Tween.removeTweens(this.guideCont); engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont) engine.Tween.get(this.guideCont)
...@@ -1115,6 +1208,11 @@ ...@@ -1115,6 +1208,11 @@
_this.container.removeChild(rcele); _this.container.removeChild(rcele);
MapData.recoverEle(rcele, rcetype); MapData.recoverEle(rcele, rcetype);
}); });
var oneffect = this.getOneEffect();
oneffect.x = rcelex;
oneffect.y = rceley;
this.anicontainer.addChild(oneffect);
oneffect.play(1);
}; };
GameView.prototype.goDisplayAni = function (ielitype, ielix, ieliy) { GameView.prototype.goDisplayAni = function (ielitype, ielix, ieliy) {
var _this = this; var _this = this;
...@@ -1770,10 +1868,10 @@ ...@@ -1770,10 +1868,10 @@
GameView.prototype.changeHomeShow = function (mode) { GameView.prototype.changeHomeShow = function (mode) {
}; };
GameView.prototype.boomeEle = function (row, col) { GameView.prototype.boomeEle = function (row, col) {
this.unShowEleAttion();
this.useBoom = false; this.useBoom = false;
engine.globalEvent.dispatchEvent('game-useboomafter', {}); engine.globalEvent.dispatchEvent('game-useboomafter', {});
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.changeEnable(false);
this.selectArr = new Array(); this.selectArr = new Array();
this.eliminateArr = new Array(); this.eliminateArr = new Array();
for (var r = 0; r < MapData.row; r++) { for (var r = 0; r < MapData.row; r++) {
...@@ -1806,6 +1904,9 @@ ...@@ -1806,6 +1904,9 @@
} }
} }
} }
this.boomani.x = MapData.getCx(col);
this.boomani.y = MapData.getRy(row);
this.boomani.playBoomAni();
this.eliminate(); this.eliminate();
}; };
GameView.prototype.setGuidePath = function () { GameView.prototype.setGuidePath = function () {
...@@ -1822,6 +1923,8 @@ ...@@ -1822,6 +1923,8 @@
this.guideDraw.lineTo(609, 607); this.guideDraw.lineTo(609, 607);
this.guideDraw.lineTo(0, 607); this.guideDraw.lineTo(0, 607);
this.guideDraw.lineTo(0, 0); this.guideDraw.lineTo(0, 0);
this.shoueffect.x = 409;
this.shoueffect.y = -40;
this.guideDraw.moveTo(path[0][0], path[0][1]); this.guideDraw.moveTo(path[0][0], path[0][1]);
for (var i = 1; i < path.length; i++) { for (var i = 1; i < path.length; i++) {
var idotx = path[i][0]; var idotx = path[i][0];
...@@ -1835,6 +1938,8 @@ ...@@ -1835,6 +1938,8 @@
this.inguide = true; this.inguide = true;
this.guideCont.visible = true; this.guideCont.visible = true;
this.guideCont.alpha = 0; this.guideCont.alpha = 0;
this.shoueffect.visible = true;
this.shoueffect.play(1);
var ableidx = ["0_3", "1_3"]; var ableidx = ["0_3", "1_3"];
for (var key in this.lattices) { for (var key in this.lattices) {
var isinable = ableidx.indexOf(key); var isinable = ableidx.indexOf(key);
...@@ -1867,6 +1972,29 @@ ...@@ -1867,6 +1972,29 @@
this.useBoom = use; this.useBoom = use;
} }
}; };
GameView.prototype.getOneEffect = function () {
var oneffect;
if (this.diseffectArr.length > 0) {
oneffect = this.diseffectArr.shift();
}
else {
oneffect = createSvga("消除动效");
oneffect.addEventListener(engine.Event.ENTER_FRAME, this.playDisEffectComplete, this);
oneffect.mouseEnabled = false;
oneffect.mouseChildren = false;
}
return oneffect;
};
GameView.prototype.playDisEffectComplete = function (e) {
var target = e.target;
var curframe = target.currentFrame;
var totalframe = target.totalFrames;
if (curframe >= totalframe) {
target.stop(1);
this.anicontainer.removeChild(target);
this.diseffectArr.push(target);
}
};
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -66,6 +66,30 @@ ...@@ -66,6 +66,30 @@
"url": "//yun.duiba.com.cn/aurora/assets/438ca6e721eab32728aceaca5df0095e1387f340.png", "url": "//yun.duiba.com.cn/aurora/assets/438ca6e721eab32728aceaca5df0095e1387f340.png",
"uuid": "jiantou", "uuid": "jiantou",
"ext": ".png" "ext": ".png"
},
{
"name": "手指动效",
"url": "//yun.duiba.com.cn/aurora/assets/038f2a14e1bfff4e2fc3f786152f03f56048d426.svga",
"uuid": "shouani",
"ext": ".svga"
},
{
"name": "消除动效",
"url": "//yun.duiba.com.cn/aurora/assets/5cde14d822eb85ac5e8bbcbae795e6107689543c.svga",
"uuid": "diseffect",
"ext": ".svga"
},
{
"name": "炸弹中心",
"url": "//yun.duiba.com.cn/aurora/assets/30795e057013978807e1a52351b6debbf034d174.png",
"uuid": "shine1",
"ext": ".png"
},
{
"name": "爆炸闪光",
"url": "//yun.duiba.com.cn/aurora/assets/e200b34d25020bd1d5430cf6f3e52c6866826076.png",
"uuid": "shine2",
"ext": ".png"
} }
], ],
"events": { "events": {
...@@ -146,6 +170,12 @@ ...@@ -146,6 +170,12 @@
"alias": "炸弹使用完毕", "alias": "炸弹使用完毕",
"data": { "data": {
}
},
"game-useBoom": {
"alias": "使用炸弹==考虑性能使用上面的方式,直接使用",
"data": {
} }
} }
} }
......
...@@ -7,6 +7,7 @@ import { playSound, createSvga,getTextureByName } from "./utils"; ...@@ -7,6 +7,7 @@ import { playSound, createSvga,getTextureByName } from "./utils";
import ObjectPool = engine.ObjectPool; import ObjectPool = engine.ObjectPool;
import MapData, { GameEvent, ElementType } from "./MapData"; import MapData, { GameEvent, ElementType } from "./MapData";
import Element from "./ele/Element"; import Element from "./ele/Element";
import boomAni from "./boomAni";
export default class GameView extends engine.Container { export default class GameView extends engine.Container {
constructor() { constructor() {
...@@ -80,6 +81,9 @@ export default class GameView extends engine.Container { ...@@ -80,6 +81,9 @@ export default class GameView extends engine.Container {
guideCont:engine.Container; guideCont:engine.Container;
guideDraw:engine.Shape; guideDraw:engine.Shape;
inguide:boolean = false; inguide:boolean = false;
//手指动效
shoueffect;
diseffectArr:Array<any> = [];
set gamestat(stat){//1游戏中,2,游戏外 set gamestat(stat){//1游戏中,2,游戏外
this._gamestat = stat; this._gamestat = stat;
...@@ -102,7 +106,7 @@ export default class GameView extends engine.Container { ...@@ -102,7 +106,7 @@ export default class GameView extends engine.Container {
seqscore; seqscore;
//使用炸弹 //使用炸弹
useBoom:boolean = false; useBoom:boolean = false;
boomani:boomAni;//炸弹动效
setup() { setup() {
console.log("setup----game"); console.log("setup----game");
...@@ -157,6 +161,10 @@ export default class GameView extends engine.Container { ...@@ -157,6 +161,10 @@ export default class GameView extends engine.Container {
let row = MapData.row; let row = MapData.row;
let col = MapData.col; let col = MapData.col;
//手指动效
this.shoueffect = createSvga("手指动效");
// console.log("手指动效",this.shoueffect);
// this.homeimgday = createSvga("房子动画"); // this.homeimgday = createSvga("房子动画");
// this.homeimgday.x = this.homex; // this.homeimgday.x = this.homex;
...@@ -226,7 +234,16 @@ export default class GameView extends engine.Container { ...@@ -226,7 +234,16 @@ export default class GameView extends engine.Container {
this.guideCont.addChild(this.guideDraw); this.guideCont.addChild(this.guideDraw);
this.guideCont.visible = false; this.guideCont.visible = false;
this.guideCont.mouseEnabled = false; this.guideCont.mouseEnabled = false;
this.guideCont.addChild(this.shoueffect);
this.shoueffect.mouseEnabled = false;
this.shoueffect.mouseChildren = false;
this.shoueffect.visible = false;
this.setGuidePath(); this.setGuidePath();
this.boomani = new boomAni();
this.anicontainer.addChild(this.boomani);
// this.setGuideShow(); // this.setGuideShow();
...@@ -547,7 +564,12 @@ export default class GameView extends engine.Container { ...@@ -547,7 +564,12 @@ export default class GameView extends engine.Container {
//使用炸弹 //使用炸弹
if(this.useBoom){ if(this.useBoom){
if(type=="mouse_down"){ if(type=="mouse_down"){
this.unShowEleAttion(); this.changeEnable(false);
// //使用炸弹
// engine.globalEvent.dispatchEvent('game-useBoom',{
// boomr:sr,
// boomc:sc
// });
this.boomeEle(sr,sc); this.boomeEle(sr,sc);
} }
return; return;
...@@ -681,6 +703,8 @@ export default class GameView extends engine.Container { ...@@ -681,6 +703,8 @@ export default class GameView extends engine.Container {
if(this.eliminateArr.length>0){ if(this.eliminateArr.length>0){
if(this.inguide){ if(this.inguide){
this.shoueffect.stop(0);
this.shoueffect.visible = false;
this.inguide = false; this.inguide = false;
engine.Tween.removeTweens(this.guideCont); engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont) engine.Tween.get(this.guideCont)
...@@ -691,6 +715,7 @@ export default class GameView extends engine.Container { ...@@ -691,6 +715,7 @@ export default class GameView extends engine.Container {
this.guideCont.visible = false; this.guideCont.visible = false;
//引导完毕 //引导完毕
engine.globalEvent.dispatchEvent('game-guidecomplete',{}); engine.globalEvent.dispatchEvent('game-guidecomplete',{});
// this.start();
}) })
} }
this.inEliminate = true; this.inEliminate = true;
...@@ -929,6 +954,12 @@ export default class GameView extends engine.Container { ...@@ -929,6 +954,12 @@ export default class GameView extends engine.Container {
this.container.removeChild(rcele); this.container.removeChild(rcele);
MapData.recoverEle(rcele,rcetype); MapData.recoverEle(rcele,rcetype);
}) })
let oneffect = this.getOneEffect();
oneffect.x = rcelex;
oneffect.y = rceley;
this.anicontainer.addChild(oneffect);
oneffect.play(1);
} }
//原地消失 //原地消失
goDisplayAni(ielitype,ielix,ieliy){ goDisplayAni(ielitype,ielix,ieliy){
...@@ -1681,12 +1712,13 @@ export default class GameView extends engine.Container { ...@@ -1681,12 +1712,13 @@ export default class GameView extends engine.Container {
//使用炸弹 //使用炸弹
boomeEle(row,col){ boomeEle(row,col){
this.unShowEleAttion();
this.useBoom = false; this.useBoom = false;
//炸弹使用完毕 //炸弹使用完毕
engine.globalEvent.dispatchEvent('game-useboomafter',{}); engine.globalEvent.dispatchEvent('game-useboomafter',{});
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.changeEnable(false); // this.changeEnable(false);
this.selectArr = new Array(); this.selectArr = new Array();
// console.log("使用炸弹rc",row,col); // console.log("使用炸弹rc",row,col);
this.eliminateArr = new Array(); this.eliminateArr = new Array();
...@@ -1724,6 +1756,9 @@ export default class GameView extends engine.Container { ...@@ -1724,6 +1756,9 @@ export default class GameView extends engine.Container {
} }
// console.log("使用炸弹消除的元素",this.eliminateArr); // console.log("使用炸弹消除的元素",this.eliminateArr);
this.boomani.x = MapData.getCx(col);
this.boomani.y = MapData.getRy(row);
this.boomani.playBoomAni();
this.eliminate(); this.eliminate();
} }
...@@ -1748,6 +1783,9 @@ export default class GameView extends engine.Container { ...@@ -1748,6 +1783,9 @@ export default class GameView extends engine.Container {
this.guideDraw.lineTo(0,607); this.guideDraw.lineTo(0,607);
this.guideDraw.lineTo(0,0); this.guideDraw.lineTo(0,0);
this.shoueffect.x = 409;
this.shoueffect.y = -40;
this.guideDraw.moveTo(path[0][0],path[0][1]); this.guideDraw.moveTo(path[0][0],path[0][1]);
for(let i=1;i<path.length;i++){ for(let i=1;i<path.length;i++){
let idotx = path[i][0]; let idotx = path[i][0];
...@@ -1761,7 +1799,9 @@ export default class GameView extends engine.Container { ...@@ -1761,7 +1799,9 @@ export default class GameView extends engine.Container {
this.inguide = true; this.inguide = true;
this.guideCont.visible = true; this.guideCont.visible = true;
this.guideCont.alpha = 0; this.guideCont.alpha = 0;
this.shoueffect.visible = true;
this.shoueffect.play(1);
let ableidx = ["0_3","1_3"]; let ableidx = ["0_3","1_3"];
for(let key in this.lattices){ for(let key in this.lattices){
let isinable = ableidx.indexOf(key); let isinable = ableidx.indexOf(key);
...@@ -1795,4 +1835,28 @@ export default class GameView extends engine.Container { ...@@ -1795,4 +1835,28 @@ export default class GameView extends engine.Container {
this.useBoom = use; this.useBoom = use;
} }
} }
//获取一个消除特效
getOneEffect(){
let oneffect;
if(this.diseffectArr.length>0){
oneffect = this.diseffectArr.shift();
}else{
oneffect = createSvga("消除动效");
oneffect.addEventListener(engine.Event.ENTER_FRAME,this.playDisEffectComplete,this);
oneffect.mouseEnabled = false;
oneffect.mouseChildren = false;
}
return oneffect;
}
//消除动效播放完毕
playDisEffectComplete(e){
let target = e.target;
let curframe = target.currentFrame;
let totalframe = target.totalFrames;
if(curframe>=totalframe){
target.stop(1);
this.anicontainer.removeChild(target);
this.diseffectArr.push(target);
}
}
} }
import { getTextureByName } from "./utils";
export default class boomAni extends engine.Container{
constructor(){
super();
this.once(engine.Event.ADDED_TO_STAGE,this.setup,this);
}
boomimg:engine.Image;
hboomimg:engine.Image;
vboomimg:engine.Image;
setup(){
this.boomimg = new engine.Image(getTextureByName("炸弹中心"));
this.boomimg.anchorX = 95;
this.boomimg.anchorY = 108;
this.boomimg.x = -32;
this.boomimg.y = -47;
let boomtex:engine.Texture = getTextureByName("爆炸闪光");
let boomwid = boomtex.width;
let boomhei = boomtex.height;
this.hboomimg = new engine.Image();
this.vboomimg = new engine.Image();
this.hboomimg.texture = boomtex;
this.vboomimg.texture = boomtex;
this.hboomimg.width = boomwid;
this.hboomimg.height = boomhei;
this.hboomimg.anchorX = boomwid/2;
this.hboomimg.anchorY = boomhei/2;
this.hboomimg.y = -boomhei/2+65;
this.hboomimg.x = -20;
this.vboomimg.width = boomwid;
this.vboomimg.height = boomhei;
this.vboomimg.anchorX = boomwid/2;
this.vboomimg.anchorY = boomhei/2;
this.vboomimg.rotation = 90;
this.vboomimg.y = -boomhei/2+65;
this.vboomimg.x = -20;
this.hboomimg.scaleY = 0.1;
this.vboomimg.scaleY = 0.1;
this.addChild(this.boomimg);
this.addChild(this.hboomimg);
this.addChild(this.vboomimg);
this.mouseEnabled = false;
this.mouseChildren = false;
this.alpha = 0;
// this.playBoomAni();
}
playBoomAni(){
this.alpha = 1;
this.boomimg.scaleX = 0;
this.boomimg.scaleY = 0;
engine.Tween.get(this.boomimg)
.to({
scaleX:1.2,
scaleY:1.2
},200,engine.Ease.quadIn);
this.hboomimg.scaleY = 0.1;
this.hboomimg.alpha = 1;
this.vboomimg.scaleY = 0.1;
this.vboomimg.alpha = 1;
engine.Tween.get(this.hboomimg)
.to({
scaleY:1,
alpha:0.8
},150,engine.Ease.quadIn)
.to({
alpha:0
},50,engine.Ease.quadIn);
engine.Tween.get(this.vboomimg)
.to({
scaleY:1,
alpha:0.8
},150,engine.Ease.quadIn)
.to({
alpha:0
},50,engine.Ease.quadIn)
.call(()=>{
this.alpha = 0;
})
}
}
\ No newline at end of file
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