Commit d7a5a9b0 authored by Chen Jiping's avatar Chen Jiping
parents 166e3291 fb0c9675
...@@ -3,7 +3,7 @@ import { Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListene ...@@ -3,7 +3,7 @@ import { Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListene
import { import {
Label, Label,
MyAnimation, MyAnimation,
MySprite, shake, ShapeRect, tweenChange, MySprite, removeItemFromArr, shake, ShapeRect, tweenChange,
} from './Unit'; } from './Unit';
import { res, resAudio } from './resources'; import { res, resAudio } from './resources';
...@@ -93,6 +93,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -93,6 +93,9 @@ export class PlayComponent implements OnInit, OnDestroy {
timeId = null; timeId = null;
startBtn;
startLayer;
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(event) { onResize(event) {
this.winResizeEventStream.next(); this.winResizeEventStream.next();
...@@ -634,9 +637,28 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -634,9 +637,28 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initBg(); this.initBg();
this.showNext();
this.initMagnifier(); this.addStartLayer();
}
addStartLayer() {
const startLayer = new ShapeRect();
startLayer.setSize(this.canvasWidth, this.canvasHeight);
startLayer.alpha = 0.5;
startLayer.fillColor = "#000000";
startLayer.x = 0;
startLayer.y = 0;
this.startLayer = startLayer;
const startBtn = new MySprite();
startBtn.init(this.images.get('start_btn'));
startBtn.setScaleXY(this.mapScale);
startBtn.x = this.canvasWidth / 2;
startBtn.y = this.canvasHeight / 2;
startLayer.addChild(startBtn);
this.startBtn = startBtn;
} }
...@@ -973,6 +995,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -973,6 +995,12 @@ export class PlayComponent implements OnInit, OnDestroy {
mapDown(event) { mapDown(event) {
if(this.startBtn && this.checkClickTarget(this.startBtn)){
console.log(' in startbtn')
this.startBtnClick();
return;
}
if (!this.canTouch) { if (!this.canTouch) {
return; return;
} }
...@@ -1053,6 +1081,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1053,6 +1081,15 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
startBtnClick() {
// removeItemFromArr(this.renderArr, this.startLayer);
this.startLayer = null;
this.startBtn = null;
this.initMagnifier();
this.showNext();
}
update() { update() {
...@@ -1074,6 +1111,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1074,6 +1111,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this.updateArr(this.textLabelArr); this.updateArr(this.textLabelArr);
this.updateArr(this.endRenderArr); this.updateArr(this.endRenderArr);
if (this.startLayer) {
this.startLayer.update();
}
} }
......
...@@ -34,6 +34,9 @@ const res = [ ...@@ -34,6 +34,9 @@ const res = [
['bg_wrong', "assets/play/bg_wrong.png"], ['bg_wrong', "assets/play/bg_wrong.png"],
['bg_zi', "assets/play/bg_zi.png"], ['bg_zi', "assets/play/bg_zi.png"],
['icon_tiao', "assets/play/icon_tiao.png"], ['icon_tiao', "assets/play/icon_tiao.png"],
['start_btn', "assets/play/start_btn.png"],
]; ];
......
This diff is collapsed.
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