Commit b4c486c9 authored by zhangjinzhou's avatar zhangjinzhou

调整引导

parent 2a28a290
......@@ -35,6 +35,8 @@ var GameStage = /** @class */ (function (_super) {
function GameStage() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.step = 1;
_this.canclick = true;
_this.guideconfig = {};
return _this;
}
GameStage.prototype.onLaunched = function () {
......@@ -56,6 +58,7 @@ var GameStage = /** @class */ (function (_super) {
this.addChild(this.touchrect);
this.skipbtn = new Sprite();
this.addChild(this.skipbtn);
this.guideconfig = this.props['guideconfig'];
this.skipbtn.addEventListener(MouseEvent.CLICK, this.skipGuide, this);
this.touchrect.addEventListener(MouseEvent.CLICK, this.toNextLevel, this);
this.setGuideShow();
......@@ -66,6 +69,15 @@ var GameStage = /** @class */ (function (_super) {
* @param payload
*/
GameStage.prototype.onEvent = function (type, payload) {
switch (type) {
case "setStepData":
var step = payload.step;
var stepdata = payload.stepdata;
break;
default:
console.error("为定义监听类型===》", payload);
break;
}
};
/**
* 销毁回调
......@@ -74,7 +86,15 @@ var GameStage = /** @class */ (function (_super) {
};
//skipLevel
GameStage.prototype.skipGuide = function () {
var stepdata = this.props['guideconfig'][this.step];
var _this = this;
if (!this.canclick) {
return;
}
this.canclick = false;
setTimeout(function () {
_this.canclick = true;
}, 1000);
var stepdata = this.guideconfig[this.step];
var skipbtn = stepdata.skipbtn;
var lastlevel;
if (skipbtn) {
......@@ -85,13 +105,20 @@ var GameStage = /** @class */ (function (_super) {
};
//toNextLevel
GameStage.prototype.toNextLevel = function () {
var _this = this;
if (!this.canclick) {
return;
}
this.canclick = false;
setTimeout(function () {
_this.canclick = true;
}, 1000);
this.step++;
this.setGuideShow();
};
//步数渲染
GameStage.prototype.setGuideShow = function () {
console.log("配置===》", this.props);
var stepdata = this.props['guideconfig'][this.step];
var stepdata = this.guideconfig[this.step];
if (!stepdata) {
console.error("引导完毕====》");
this.dispatchOutEvent("guidecomplete", null);
......
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