Commit f0511083 authored by zjz1994's avatar zjz1994

人才保险暂存

parent 9d869388
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -352,11 +352,11 @@
MapData.anispeed = 1000;
MapData.levelData = [
[
[1, 2, 5, 3, 4],
[3, 1, 2, 4, 5],
[2, 5, 3, 4, 1],
[5, 4, 1, 2, 3],
[4, 1, 3, 5, 2],
[2, 3, 4, 5, 4],
[4, 5, 3, 2, 4],
[2, 5, 3, 5, 1],
[3, 4, 4, 5, 3],
[1, 5, 2, 1, 4],
],
[
[5, 2, 1, 2, 1],
......@@ -398,7 +398,7 @@
_this.lattices = {};
_this.eliminateArr = [];
_this.selectArr = [];
_this.conty = 140;
_this.conty = 0;
_this.homex = 562;
_this.homey = -20;
_this.ination = false;
......@@ -411,6 +411,7 @@
_this.inrecord = false;
_this.requestGameOver = false;
_this.elitype = 1;
_this.inguide = false;
_this._seq = 1;
_this.sptime = Date.now();
_this.useBoom = false;
......@@ -444,6 +445,7 @@
configurable: true
});
GameView.prototype.setup = function () {
console.log("setup----game");
MapData.initPoolEle();
this.selectimg = new engine.Image(getTextureByName("选中框"));
this.selectimg.mouseEnabled = false;
......@@ -515,25 +517,13 @@
this.lastframeTime = Date.now();
this.lastatime = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME, this.onUpdate, this);
var zhadanbtn = new engine.Label();
zhadanbtn.text = "炸弹";
zhadanbtn.size = 56;
zhadanbtn.width = 200;
zhadanbtn.height = 100;
this.addChild(zhadanbtn);
zhadanbtn.y = 900;
zhadanbtn.fillColor = "red";
zhadanbtn.addEventListener(engine.MouseEvent.CLICK, this.zhadanFunc, this);
var timebtn = new engine.Label();
timebtn.text = "加时";
timebtn.size = 56;
timebtn.width = 200;
timebtn.height = 100;
this.addChild(timebtn);
timebtn.y = 900;
timebtn.x = 500;
timebtn.fillColor = "red";
timebtn.addEventListener(engine.MouseEvent.CLICK, this.addTimeFunc, this);
this.guideCont = new engine.Container();
this.addChild(this.guideCont);
this.guideDraw = new engine.Shape();
this.guideCont.addChild(this.guideDraw);
this.guideCont.visible = false;
this.guideCont.mouseEnabled = false;
this.setGuidePath();
};
GameView.prototype.zhadanFunc = function () {
this.useBoom = true;
......@@ -646,7 +636,7 @@
return [4, fallpro];
case 1:
_a.sent();
testdata = MapData.levelData[this.level];
testdata = MapData.levelData[this.level - 1];
this.levelData = testdata;
this.fall("newlevel");
return [2];
......@@ -655,6 +645,7 @@
});
};
GameView.prototype.start = function () {
console.log("game-start");
this.gamestat = 1;
this.requestGameOver = false;
this.selectArr = new Array();
......@@ -669,7 +660,7 @@
};
GameView.prototype.onUpdate = function () {
var ntime = Date.now();
if (this.gamestat == 1 && this.ingame) {
if (this.gamestat == 1 && this.ingame && !this.inguide) {
var passtime = ntime - this.lastframeTime;
if (ntime - this.lastatime >= 5000 && !this.ination && this.canation && this.selectArr.length == 0) {
this.attionEliShow();
......@@ -697,7 +688,7 @@
else {
this.lattices = {};
}
var testdata = MapData.levelData[this.level];
var testdata = MapData.levelData[this.level - 1];
this.levelData = testdata;
for (var r = 0; r < testdata.length; r++) {
var rdata = testdata[r];
......@@ -897,6 +888,18 @@
engine.Tween.removeTweens(snode1);
engine.Tween.removeTweens(snode2);
if (this.eliminateArr.length > 0) {
if (this.inguide) {
this.inguide = false;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha: 0
}, 200)
.call(function () {
_this.guideCont.visible = false;
engine.globalEvent.dispatchEvent('game-guidecomplete', {});
});
}
this.inEliminate = true;
engine.Tween.get(snode1).to({
x: snode2x,
......@@ -1194,6 +1197,9 @@
ele.touch = v;
}
}
engine.globalEvent.dispatchEvent('game-touch', {
cantouch: v
});
if (v) {
this.lastatime = Date.now();
this.ination = false;
......@@ -1826,6 +1832,39 @@
}
this.eliminate();
};
GameView.prototype.setGuidePath = function () {
var path = [
[364, 7],
[364, 479],
[484, 479],
[484, 7],
];
this.guideDraw.clear();
this.guideDraw.beginFill(0x000000, 0.7);
this.guideDraw.moveTo(0, 0);
this.guideDraw.lineTo(609, 0);
this.guideDraw.lineTo(609, 607);
this.guideDraw.lineTo(0, 607);
this.guideDraw.lineTo(0, 0);
this.guideDraw.moveTo(path[0][0], path[0][1]);
for (var i = 1; i < path.length; i++) {
var idotx = path[i][0];
var idoty = path[i][1];
this.guideDraw.lineTo(idotx, idoty);
}
this.guideDraw.lineTo(path[0][0], path[0][1]);
this.guideDraw.endFill();
};
GameView.prototype.setGuideShow = function () {
this.inguide = true;
this.guideCont.visible = true;
this.guideCont.alpha = 0;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha: 1
}, 200);
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
......@@ -1842,6 +1881,7 @@
engine.globalEvent.addEventListener('game-pause', _this.pause, _this);
engine.globalEvent.addEventListener('game-resume', _this.resume, _this);
engine.globalEvent.addEventListener('game-recordcomp', _this.recordcomp, _this);
engine.globalEvent.addEventListener('game-newuserguide', _this.newUserGuide, _this);
return _this;
}
GameWrapper.prototype.init = function (event) {
......@@ -1868,6 +1908,9 @@
GameWrapper.prototype.recordcomp = function () {
this._gameView.recordcomp();
};
GameWrapper.prototype.newUserGuide = function () {
this._gameView.setGuideShow();
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "消消乐",
"name": "人保财险消消乐",
"desc": "消消乐模块",
"props": {
"threeEscore":{
......@@ -66,18 +66,6 @@
"url": "//yun.duiba.com.cn/aurora/assets/438ca6e721eab32728aceaca5df0095e1387f340.png",
"uuid": "jiantou",
"ext": ".png"
},
{
"name": "房子动画",
"url": "//yun.duiba.com.cn/aurora/assets/10d6c3c657e4f26eee2e6f1edca36ec468d57353.svga",
"uuid": "homeani",
"ext": ".svga"
},
{
"name": "夜晚房子",
"url": "//yun.duiba.com.cn/aurora/assets/aa9261273423b4b9343b4526b7e5f71a6a35a345.svga",
"uuid": "homenight",
"ext": ".svga"
}
],
"events": {
......@@ -105,6 +93,9 @@
},
"game-recordcomp": {
"alias": "记录完毕"
},
"game-newuserguide":{
"alias": "新手引导"
}
},
"out": {
......@@ -135,6 +126,18 @@
"sptime":"操纵开始时间",
"eptime":"操作结束时间"
}
},
"game-touch": {
"alias": "按钮点击",
"data": {
"cantouch":""
}
},
"game-guidecomplete": {
"alias": "游戏引导完毕",
"data": {
}
}
}
}
......
......@@ -7,9 +7,6 @@ import { playSound, createSvga,getTextureByName } from "./utils";
import ObjectPool = engine.ObjectPool;
import MapData, { GameEvent, ElementType } from "./MapData";
import Element from "./ele/Element";
import CountDownGroup from "../../../recycling/src/game/views/CountDownGroup";
export default class GameView extends engine.Container {
constructor() {
......@@ -38,7 +35,7 @@ export default class GameView extends engine.Container {
// homeimgday;
// homeimgnight;
conty = 140;
conty = 0;
homex = 562;
homey = -20;
......@@ -77,6 +74,13 @@ export default class GameView extends engine.Container {
requestGameOver = false;
elitype = 1;//1原地消失,2飞到目标位置
//新增新手引导
guideCont:engine.Container;
guideDraw:engine.Shape;
inguide:boolean = false;
set gamestat(stat){//1游戏中,2,游戏外
this._gamestat = stat;
if(stat==2){
......@@ -101,6 +105,7 @@ export default class GameView extends engine.Container {
setup() {
console.log("setup----game");
MapData.initPoolEle();
this.selectimg = new engine.Image(getTextureByName("选中框"));
this.selectimg.mouseEnabled = false;
......@@ -214,6 +219,17 @@ export default class GameView extends engine.Container {
this.lastatime = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME,this.onUpdate,this);
//新手引导遮罩
this.guideCont = new engine.Container();
this.addChild(this.guideCont);
this.guideDraw = new engine.Shape();
this.guideCont.addChild(this.guideDraw);
this.guideCont.visible = false;
this.guideCont.mouseEnabled = false;
this.setGuidePath();
// this.setGuideShow();
// //测试
// let testbtn = new engine.Label();
// testbtn.text = "reset";
......@@ -227,27 +243,29 @@ export default class GameView extends engine.Container {
//炸弹道具
let zhadanbtn = new engine.Label();
zhadanbtn.text = "炸弹";
zhadanbtn.size = 56;
zhadanbtn.width = 200;
zhadanbtn.height = 100;
this.addChild(zhadanbtn);
zhadanbtn.y = 900;
zhadanbtn.fillColor = "red";
zhadanbtn.addEventListener(engine.MouseEvent.CLICK,this.zhadanFunc,this);
//加时间道具
let timebtn = new engine.Label();
timebtn.text = "加时";
timebtn.size = 56;
timebtn.width = 200;
timebtn.height = 100;
this.addChild(timebtn);
timebtn.y = 900;
timebtn.x = 500;
timebtn.fillColor = "red";
timebtn.addEventListener(engine.MouseEvent.CLICK,this.addTimeFunc,this);
// let zhadanbtn = new engine.Label();
// zhadanbtn.text = "炸弹";
// zhadanbtn.size = 56;
// zhadanbtn.width = 200;
// zhadanbtn.height = 100;
// this.addChild(zhadanbtn);
// zhadanbtn.y = 900;
// zhadanbtn.fillColor = "red";
// zhadanbtn.addEventListener(engine.MouseEvent.CLICK,this.zhadanFunc,this);
// //加时间道具
// let timebtn = new engine.Label();
// timebtn.text = "加时";
// timebtn.size = 56;
// timebtn.width = 200;
// timebtn.height = 100;
// this.addChild(timebtn);
// timebtn.y = 900;
// timebtn.x = 500;
// timebtn.fillColor = "red";
// timebtn.addEventListener(engine.MouseEvent.CLICK,this.addTimeFunc,this);
}
//炸弹
zhadanFunc(){
......@@ -363,11 +381,12 @@ export default class GameView extends engine.Container {
})
await fallpro;
let testdata = MapData.levelData[this.level];
let testdata = MapData.levelData[this.level-1];
this.levelData = testdata;
this.fall("newlevel");
}
start(){
console.log("game-start");
this.gamestat = 1;
this.requestGameOver = false;
this.selectArr = new Array();
......@@ -384,7 +403,7 @@ export default class GameView extends engine.Container {
}
onUpdate(){
let ntime = Date.now();
if(this.gamestat==1&&this.ingame){
if(this.gamestat==1&&this.ingame&&!this.inguide){
let passtime = ntime - this.lastframeTime;
if(ntime-this.lastatime>=5000&&!this.ination&&this.canation&&this.selectArr.length==0){
this.attionEliShow();
......@@ -425,7 +444,7 @@ export default class GameView extends engine.Container {
this.lattices = {};
}
let testdata = MapData.levelData[this.level];
let testdata = MapData.levelData[this.level-1];
this.levelData = testdata;
......@@ -665,6 +684,19 @@ export default class GameView extends engine.Container {
engine.Tween.removeTweens(snode2);
if(this.eliminateArr.length>0){
if(this.inguide){
this.inguide = false;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha:0
},200)
.call(()=>{
this.guideCont.visible = false;
//引导完毕
engine.globalEvent.dispatchEvent('game-guidecomplete',{});
})
}
this.inEliminate = true;
engine.Tween.get(snode1).to({
x:snode2x,
......@@ -969,6 +1001,9 @@ export default class GameView extends engine.Container {
ele.touch = v;
}
}
engine.globalEvent.dispatchEvent('game-touch',{
cantouch:v
});
if(v){
this.lastatime = Date.now();
......@@ -1692,4 +1727,45 @@ export default class GameView extends engine.Container {
// console.log("使用炸弹消除的元素",this.eliminateArr);
this.eliminate();
}
//指定新手引导
setGuidePath(){
let showidx = ["3_0","3_1","3_2","3_3"];
let ableidx = ["3_0","3_1"];
//非自动,手动算出path
let path = [
[364,7],
[364,479],
[484,479],
[484,7],
]
//画遮罩
//底框609,607
this.guideDraw.clear();
this.guideDraw.beginFill(0x000000,0.7);
this.guideDraw.moveTo(0,0);
this.guideDraw.lineTo(609,0);
this.guideDraw.lineTo(609,607);
this.guideDraw.lineTo(0,607);
this.guideDraw.lineTo(0,0);
this.guideDraw.moveTo(path[0][0],path[0][1]);
for(let i=1;i<path.length;i++){
let idotx = path[i][0];
let idoty = path[i][1];
this.guideDraw.lineTo(idotx,idoty);
}
this.guideDraw.lineTo(path[0][0],path[0][1]);
this.guideDraw.endFill();
}
setGuideShow(){
this.inguide = true;
this.guideCont.visible = true;
this.guideCont.alpha = 0;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha:1
},200)
}
}
......@@ -20,6 +20,7 @@ export class GameWrapper extends engine.Container {
engine.globalEvent.addEventListener('game-pause',this.pause,this);
engine.globalEvent.addEventListener('game-resume',this.resume,this);
engine.globalEvent.addEventListener('game-recordcomp',this.recordcomp,this);
engine.globalEvent.addEventListener('game-newuserguide',this.newUserGuide,this);
}
init(event:engine.Event){
......@@ -48,4 +49,7 @@ export class GameWrapper extends engine.Container {
recordcomp(){
this._gameView.recordcomp();
}
newUserGuide(){
this._gameView.setGuideShow();
}
}
......@@ -38,11 +38,11 @@ export default class MapData{
static levelData:Array<Array<Array<number>>> = [
[
[1,2,5,3,4],
[3,1,2,4,5],
[2,5,3,4,1],
[5,4,1,2,3],
[4,1,3,5,2],
[2,3,4,5,4],
[4,5,3,2,4],
[2,5,3,5,1],
[3,4,4,5,3],
[1,5,2,1,4],
],
[
[5,2,1,2,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