Commit b4c486c9 authored by zhangjinzhou's avatar zhangjinzhou

调整引导

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