|
|
@@ -17,8 +17,8 @@ export default class Guide extends cc.Component {
|
|
|
node_bg: cc.Node = null;
|
|
|
@property({ type: cc.Node, displayName: "对话框" })
|
|
|
node_dialog: cc.Node = null;
|
|
|
- @property({ type: cc.Sprite, displayName: "手指" })
|
|
|
- node_finger: cc.Sprite = null;
|
|
|
+ @property({ type: cc.Node, displayName: "手指" })
|
|
|
+ node_finger: cc.Node = null;
|
|
|
@property({ type: cc.Sprite, displayName: "头像" })
|
|
|
node_head: cc.Sprite = null;
|
|
|
@property({ type: cc.Sprite, displayName: "形象" })
|
|
|
@@ -87,6 +87,14 @@ export default class Guide extends cc.Component {
|
|
|
this.node_display.height = this.targetNode.height;
|
|
|
let pos = mk.game.getWorldPos(this.targetNode);
|
|
|
this.node_display.setPosition(pos);
|
|
|
+
|
|
|
+ //穿透点击目标节点时增加一个事件触发下一步,触发后移除
|
|
|
+ this.node_click.width = this.node_click.height = 0;
|
|
|
+ let eventHandler = new cc.Component.EventHandler();
|
|
|
+ eventHandler.target = this.node;
|
|
|
+ eventHandler.component = "Guide";
|
|
|
+ eventHandler.handler = "clickNodeClick";
|
|
|
+ this.targetNode.getComponent(cc.Button).clickEvents.push(eventHandler);
|
|
|
}
|
|
|
|
|
|
//对话框位置
|
|
|
@@ -95,7 +103,7 @@ export default class Guide extends cc.Component {
|
|
|
let arr = this.crtGuide.dialog_pos.split(":");
|
|
|
let wedgit = this.node_dialog.getComponent(cc.Widget);
|
|
|
for (let i = 0; i < this.widgets.length; i++) {
|
|
|
- wedgit[this.widgets[i]] = arr[i] == "" ? null : arr[i];
|
|
|
+ wedgit[this.widgets[i]] = arr[i] == "" ? null : parseInt(arr[i]);
|
|
|
}
|
|
|
}
|
|
|
else {//显示区域偏移
|
|
|
@@ -109,13 +117,13 @@ export default class Guide extends cc.Component {
|
|
|
this.rich_dialog.horizontalAlign = a == '0' ? cc.macro.TextAlignment.LEFT : (a == '1' ? cc.macro.TextAlignment.CENTER : cc.macro.TextAlignment.RIGHT);
|
|
|
|
|
|
if (this.crtGuide.finger == "") {
|
|
|
- this.node_finger.node.active = false;
|
|
|
+ this.node_finger.active = false;
|
|
|
}
|
|
|
else {
|
|
|
- this.node_finger.node.active = true;
|
|
|
+ this.node_finger.active = true;
|
|
|
let arr = this.crtGuide.finger.split(":");
|
|
|
- this.node_finger.node.x = this.node_display.x + parseInt(arr[0]);
|
|
|
- this.node_finger.node.y = this.node_display.y + parseInt(arr[1]);
|
|
|
+ this.node_finger.x = this.node_display.x + parseInt(arr[0]);
|
|
|
+ this.node_finger.y = this.node_display.y + parseInt(arr[1]);
|
|
|
}
|
|
|
|
|
|
if (this.crtGuide.tr_form == 1) {
|
|
|
@@ -130,29 +138,37 @@ export default class Guide extends cc.Component {
|
|
|
this.node_bg.x = -this.node_display.x;
|
|
|
this.node_bg.y = -this.node_display.y;
|
|
|
|
|
|
- this.rich_dialog.string = `<color=#000000>${this.crtGuide.dialog}</color>`;
|
|
|
+ this.rich_dialog.string = this.crtGuide.dialog;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async clickNodeClick() {
|
|
|
console.log("clickNodeClick");
|
|
|
- if (this.targetNode) {
|
|
|
- this.targetNode.getComponent(cc.Button).clickEvents[0].emit([]);
|
|
|
+ if(this.targetNode){
|
|
|
+ this.targetNode.getComponent(cc.Button).clickEvents.pop();
|
|
|
}
|
|
|
if (this.event_name) {
|
|
|
//event_guide_1_2 (1_2为新手引导的id)
|
|
|
mk.event.emit(this.event_name);
|
|
|
}
|
|
|
if (this.crtGuide.lag_next > 0) {
|
|
|
+ this.wait();
|
|
|
await mk.time.WaitForSeconds(this.crtGuide.lag_next);
|
|
|
}
|
|
|
this.nextStep();
|
|
|
}
|
|
|
|
|
|
+ /** 等待状态 透明不可点击 */
|
|
|
+ private wait() {
|
|
|
+ this.node_display.width = this.node.width;
|
|
|
+ this.node_display.height = this.node.height;
|
|
|
+ this.node_click.width = 0
|
|
|
+ this.node_click.height = 0;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private close() {
|
|
|
mk.guide.close();
|
|
|
this.node.destroy();
|
|
|
}
|
|
|
-
|
|
|
}
|