123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- const AlertManager = require('../utils/AlertManager');
- cc.Class({
- extends: cc.Component,
- properties: {
- showNode: cc.Node,
- blackMaskNode: cc.Node
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- let self = this;
- this.handleShowMore = _.throttle(() => {
- if (self.showNode.active) {
- self.showNode.active = false;
- self.blackMaskNode.active = false;
- } else {
- self.showNode.active = true;
- self.blackMaskNode.active = true;
- }
- }, 500, true);
- this.handleShowSetting = _.debounce((event) => {
- AlertManager.showGameSetting();
- self.showOrHideMore();
- }, 1000, true)
- GameEvent.on('show_home_more', this, () => {
- this.node.active = true;
- });
- GameEvent.on('hide_home_more', this, () => {
- this.node.active = false;
- });
- },
- onDestroy() {
- GameEvent.off('show_home_more',this);
- GameEvent.off('hide_home_more',this);
- },
- start () {
- },
- showOrHideMore() {
- this.handleShowMore();
- },
- showSetting() {
- this.handleShowSetting();
- }
- // update (dt) {},
- });
|