Commit 1a3689a4 authored by liujiaxin's avatar liujiaxin

feat: backdoor

parent a064c581
...@@ -456,7 +456,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -456,7 +456,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let isDebug = false; let isDebug = false;
if (this.BackDoorNode) { if (this.BackDoorNode) {
const bd = this.BackDoorNode.getComponent('BackDoor'); const bd = this.BackDoorNode.getComponent('BackDoor');
if (bd && bd.isDebug) { if (bd && bd.isDebug()) {
isDebug = true; isDebug = true;
} }
} }
......
...@@ -20,15 +20,23 @@ export default class NewClass extends cc.Component { ...@@ -20,15 +20,23 @@ export default class NewClass extends cc.Component {
touchCounter = 0; touchCounter = 0;
countTimer = null; countTimer = null;
isDebug = false; hat = null;
// isDebug = false;
// touchTimeline = []; // touchTimeline = [];
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
// onLoad () {} // onLoad () {}
isDebug() {
return this.hat && this.hat.active;
}
start () { start () {
console.log(111)
this.hat = this.node.getChildByName('hat');
if (!this.hat) {
return;
}
this.node.on(cc.Node.EventType.TOUCH_START, () => { this.node.on(cc.Node.EventType.TOUCH_START, () => {
// console.log(Date.now()); // console.log(Date.now());
// this.touchTimeline.push(Date.now()); // this.touchTimeline.push(Date.now());
...@@ -43,12 +51,10 @@ export default class NewClass extends cc.Component { ...@@ -43,12 +51,10 @@ export default class NewClass extends cc.Component {
if (this.touchCounter == this.need) { if (this.touchCounter == this.need) {
clearTimeout(this.countTimer); clearTimeout(this.countTimer);
this.countTimer = null; this.countTimer = null;
if (this.isDebug) { if (this.hat.active) {
this.node.color = new cc.Color(255, 255, 255,255); this.hat.active = false
this.isDebug = false;
} else { } else {
this.node.color = new cc.Color(3, 246, 18,255); this.hat.active = true
this.isDebug = true;
} }
} }
......
{
"ver": "2.3.5",
"uuid": "6f2b5147-e49c-4458-8010-acb18043b6ba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 94,
"height": 59,
"platformSettings": {},
"subMetas": {
"hat": {
"ver": "1.0.4",
"uuid": "8695e6d3-64a6-457c-962c-252616530caf",
"rawTextureUuid": "6f2b5147-e49c-4458-8010-acb18043b6ba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 94,
"height": 59,
"rawWidth": 94,
"rawHeight": 59,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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