47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
properties: {
|
|
label_hintText: {
|
|
default: null,
|
|
type: cc.Label,
|
|
displayName: "提示文本"
|
|
}
|
|
},
|
|
onLoad: function () {},
|
|
start: function () {},
|
|
init: function () {},
|
|
onShowHintText: function (e, o) {
|
|
this.funCall = o || null;
|
|
this.label_hintText.string = e;
|
|
this.node.active = true;
|
|
cc.global.Source.onPlayBtnEffect("buttonClick");
|
|
},
|
|
typingAni: function (e, o, t) {
|
|
if (this.work) {
|
|
this.work = true;
|
|
this.unschedule(this.func, this);
|
|
} else {
|
|
this.work = true;
|
|
}
|
|
var i = "";
|
|
var n = o.split("");
|
|
var a = n.length;
|
|
var c = 0;
|
|
this.func = function () {
|
|
i += n[c];
|
|
e.string = i;
|
|
if (++c == a) {
|
|
this.unschedule(this.func, this);
|
|
t && t();
|
|
this.work = false;
|
|
}
|
|
cc.global.Source.onPlayGameEffect("typewriting");
|
|
}.bind(this);
|
|
this.schedule(this.func, .08, cc.macro.REPEAT_FOREVER, 0);
|
|
},
|
|
onCloseUI: function () {
|
|
this.funCall && this.funCall();
|
|
this.node.active = false;
|
|
cc.global.Source.onPlayBtnEffect("buttonClick");
|
|
}
|
|
}); |