12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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 = '<outline color=#1d8610><b>开办新的分公司</b></outline>\n<color=#1d8610><b>下一个城市</b></color>';
- } else {
- this.nextText.string = '<outline color=#1d8610><b>恭喜你完成了所有公司的开发</b>\n</outline><color=#1d8610><b>敬请期待</b></color>';
- }
- GameEvent.on('next_city_click', this, () => {
- let nextCityId = Global.devCityId + 1;
- if (nextCityId <= cityList.length) {
- Global.devCityId = nextCityId;
- CityApi.openNewCity(
- (response) => {
- 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);
- }
- });
|