CurrentCompanyMax.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. var cityList = require('../data/city');
  2. const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
  3. const CityApi = require('../net/CityMapApi');
  4. cc.Class({
  5. extends: cc.Component,
  6. properties: {
  7. shining: cc.Node,
  8. nextButton: cc.Node,
  9. nextText: cc.RichText,
  10. },
  11. onLoad() {
  12. this.shining.setScale(0);
  13. let self = this;
  14. let finish = cc.callFunc(() => {
  15. self.shining.runAction(cc.rotateBy(0.8, 100, 100).repeatForever());
  16. }, this);
  17. let scale = cc.sequence(cc.spawn(cc.scaleTo(0.4, 1, 1).easing(cc.easeBackIn()), cc.rotateBy(0.4, 100, 100)), finish);
  18. this.shining.runAction(scale);
  19. let nextCityId = Global.cityId + 1;
  20. if (nextCityId <= cityList.length) {
  21. this.nextText.string = '<outline color=#1d8610><b>开办新的分公司</b></outline>\n<color=#1d8610><b>下一个城市</b></color>';
  22. } else {
  23. this.nextText.string = '<outline color=#1d8610><b>恭喜你完成了所有公司的开发</b>\n</outline><color=#1d8610><b>敬请期待</b></color>';
  24. }
  25. },
  26. start() {
  27. },
  28. close() {
  29. },
  30. nextCity() {
  31. let nextCityId = Global.cityId + 1;
  32. if (nextCityId <= cityList.length) {
  33. Global.cityId = nextCityId;
  34. CityApi.openNewCity(
  35. (response) => {
  36. GameEvent.fire(GameNotificationKey.ShowCityMap, this, true);
  37. },
  38. (code, msg) => {
  39. console.log(msg);
  40. });
  41. }
  42. this.node.destroy();
  43. }
  44. // update (dt) {},
  45. });