init
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
properties: {
|
||||
lq: cc.Node,
|
||||
lq_video: cc.Node,
|
||||
shareBtn: cc.Node,
|
||||
jinbiNode: cc.Label,
|
||||
jinbiSpin: cc.Node
|
||||
},
|
||||
initdata: function (e, o, t, i) {
|
||||
this.leveldata = e;
|
||||
this.levellist = o;
|
||||
this.levelid = t;
|
||||
this.game = i;
|
||||
if (this.levelid < this.levellist.length) {
|
||||
if (this.levelid + 1 > this.leveldata) {
|
||||
this.leveldata += 1;
|
||||
if (cc.global.levelDataScript) {
|
||||
console.log("存完数据后--" + this.leveldata), cc.global.levelDataScript.updateData(this.leveldata), this.CunChu = true;
|
||||
} else {
|
||||
console.log("没有找到cc.global.levelDataScript");
|
||||
}
|
||||
} else {
|
||||
console.log("存完数据后3--" + this.leveldata);
|
||||
this.CunChu = true;
|
||||
}
|
||||
} else {
|
||||
console.log("存完数据后2--" + this.leveldata);
|
||||
this.CunChu = true;
|
||||
}
|
||||
this.canclick = true;
|
||||
cc.PlatformTools.executeStopVideoRecorder();
|
||||
this.TongYongGuangGaoShowAsk();
|
||||
},
|
||||
start: function () {
|
||||
var e = this;
|
||||
setTimeout(function () {
|
||||
cc.global.Source.onPlayGameEffect("jiesuan");
|
||||
}, 500);
|
||||
setTimeout(function () {
|
||||
setTimeout(function () {
|
||||
e.node.getChildByName("tb_shengli").getComponent(dragonBones.ArmatureDisplay).playAnimation("shengli_daiji", -1);
|
||||
}, 1e3);
|
||||
e.node && (e.jinbiNode.string = "120");
|
||||
}, 100);
|
||||
},
|
||||
onBtnClickEvent: function (e) {
|
||||
var o = this;
|
||||
var t = this;
|
||||
cc.global.Source.onPlayBtnEffect("buttonClick");
|
||||
var i = e.target.name;
|
||||
console.log("name" + i);
|
||||
switch (i) {
|
||||
case "btn_sl_xyg":
|
||||
cc.PlatformTools.winVideo();
|
||||
console.log("this.levellist.length:" + t.levellist.length);
|
||||
if (t.levelid < t.levellist.length) {
|
||||
if (1 == t.canclick) {
|
||||
t.canclick = false, t.onJinBiPlay(function () {
|
||||
console.log("cc.playerData.coin " + cc.playerData.coin);
|
||||
if (cc.playerData.coin >= 100) {
|
||||
cc.playerData.coin -= 100;
|
||||
t.levelid++;
|
||||
cc.global.level = t.levelid;
|
||||
cc.global.savePlayerData();
|
||||
GlobData.ShowAsk("金币-100");
|
||||
}
|
||||
setTimeout(function () {
|
||||
cc.global.zhiyinNode && cc.global.zhiyinNode.showZhuanchang(function () {
|
||||
cc.director.loadScene("GameScense");
|
||||
});
|
||||
}, 800);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
t.onJinBiPlay(function () {
|
||||
console.log("进来么。。。");
|
||||
cc.global.zhiyinNode && cc.global.zhiyinNode.showZhuanchang(function () {
|
||||
cc.global.LoadPreFtabData("".concat(t.game, "/prefab/gameui/").concat(t.game, "_xuanguan"), function () {}.bind(o));
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "btn_hzjm":
|
||||
cc.global.zhiyinNode && cc.global.zhiyinNode.showZhuanchang(function () {
|
||||
cc.global.LoadPreFtabData("".concat(t.game, "/prefab/gameui/").concat(t.game, "_xuanguan"), function () {}.bind(o));
|
||||
});
|
||||
break;
|
||||
case "fenxiang":
|
||||
cc.PlatformTools.executeShareRecorderVideo(function () {}, function () {});
|
||||
break;
|
||||
case "btn_ptlq":
|
||||
t.canclick = true;
|
||||
GlobData.ShowAsk("金币+100");
|
||||
e.target.active = false;
|
||||
t.lq_video.active = false;
|
||||
cc.playerData.coin += 100;
|
||||
cc.global.savePlayerData();
|
||||
break;
|
||||
case "btn_sblq3":
|
||||
cc.PlatformTools.executeShowAwardVideo(function () {
|
||||
t.onJinBiPlay(function () {
|
||||
e.target.active = false;
|
||||
t.canclick = true;
|
||||
}, 240);
|
||||
});
|
||||
}
|
||||
},
|
||||
onJinBiPlay: function (e) {
|
||||
var o = arguments.length > 1 && undefined !== arguments[1] ? arguments[1] : 120;
|
||||
this.jinbiSpin.active = true;
|
||||
this.anim_com = this.jinbiSpin.getComponent(cc.Animation);
|
||||
this.anim_com.play("jinbibao");
|
||||
this.jinbiSpin.getComponent("jinbiSpin").onGameStart();
|
||||
this.jinbiSpin.getComponent("jinbiSpin").show(e, o);
|
||||
},
|
||||
TongYongGuangGaoShowAsk: function () {
|
||||
var e = this;
|
||||
if (window.tt) {
|
||||
this.shareBtn.active = true;
|
||||
window.tt && setTimeout(function () {
|
||||
cc.global.LoadPreFtabData("prefab/ui/ui_VideoShare", function () {}.bind(e));
|
||||
}, 500);
|
||||
}
|
||||
if (window.qg || GlobData.isUcMiNiGame || window.ks) {
|
||||
cc.PlatformTools.executeShowVivoChaPing();
|
||||
} else {
|
||||
window.swan && cc.PlatformTools.executeShowPushBox();
|
||||
cc.PlatformTools.executeShowBanner();
|
||||
GlobData.isChaPing++;
|
||||
if (GlobData.isChaPing == window.GameConfig.showChapingCishu) {
|
||||
cc.PlatformTools.executeShowVivoChaPing(), GlobData.isChaPing = 0;
|
||||
}
|
||||
}
|
||||
window.qq && cc.PlatformTools.sendToDesktop(null, true);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user