123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- cc.Class({
- extends: cc.Component,
- properties: {
- bgFrames: [cc.SpriteFrame],
- noticeNode: cc.Node
- },
- onLoad () {
-
- },
- init (quest, isMain) {
- this.quest = quest;
- this.isMain = isMain;
- if (this.isMain) {
- GameEvent.on('quest_main_notice', this, (isCancel) => {
- if (isCancel) {
- this.noticeNode.active = false;
- } else {
- this.noticeNode.active = true;
- }
- });
- } else {
- GameEvent.on('quest_daily_notice', this, (isCancel) => {
- if (isCancel) {
- this.noticeNode.active = false;
- } else {
- this.noticeNode.active = true;
- }
- });
- }
- },
-
- show () {
- this.getComponent(cc.Button).interactable = false;
- this.getComponent('cc.Sprite').spriteFrame = this.bgFrames[1]
- },
- hide () {
- this.getComponent(cc.Button).interactable = true;
- this.getComponent('cc.Sprite').spriteFrame = this.bgFrames[0]
- },
- onDestroy() {
- GameEvent.off('quest_main_notice', this);
- GameEvent.off('quest_daily_notice', this);
- }
- // update (dt) {},
- });
|