12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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) {},
- });
|