var cityList = require('../data/city'); const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey; const CityApi = require('../net/CityMapApi'); cc.Class({ extends: cc.Component, properties: { shining: cc.Node, nextButton: cc.Node, nextText: cc.RichText, }, onLoad() { this.shining.setScale(0); let self = this; let finish = cc.callFunc(() => { self.shining.runAction(cc.rotateBy(0.8, 100, 100).repeatForever()); }, this); let scale = cc.sequence(cc.spawn(cc.scaleTo(0.4, 1, 1).easing(cc.easeBackIn()), cc.rotateBy(0.4, 100, 100)), finish); this.shining.runAction(scale); let nextCityId = Global.devCityId + 1; if (nextCityId <= cityList.length) { this.nextText.string = '开办新的分公司\n下一个城市'; } else { this.nextText.string = '到达财富的顶端\n敬请期待'; } GameEvent.on('next_city_click', this, () => { let nextCityId = Global.devCityId + 1; if (nextCityId <= cityList.length) { CityApi.openNewCity( (response) => { Global.devCityId = nextCityId; GameEvent.fire(GameNotificationKey.ShowCityMap, this, true); }, (code, msg) => { console.log(msg); }); } this.node.destroy(); }); }, start() { }, close() { }, nextCity: _.debounce(() => { GameEvent.fire('next_city_click'); }, 1000, true), // update (dt) {}, onDestroy() { GameEvent.off('next_city_click', this); } });