const AlertManager = require('../utils/AlertManager'); const GameModule = require("../utils/GameModule"); cc.Class({ extends: cc.Component, properties: { showNode: cc.Node, blackMaskNode: cc.Node }, // LIFE-CYCLE CALLBACKS: onLoad () { let self = this; this.handleShowMore = _.throttle(() => { GameModule.audioMng.playClickButton(); 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.hideMore(); }, 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 () { }, hideMore() { this.showNode.active = false; this.blackMaskNode.active = false; }, showOrHideMore() { this.handleShowMore(); }, showSetting() { this.handleShowSetting(); } // update (dt) {}, });