Main.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. gMode: cc.Node,
  5. /**政务大厅预制体 */
  6. preGovernment: cc.Prefab,
  7. /**实名认证预制体 */
  8. preCertification: cc.Prefab,
  9. /**人民医院预制体 */
  10. preHospital: cc.Prefab,
  11. /**教育大厅预制体 */
  12. preEducation: cc.Prefab,
  13. /**旅游大厅预制体 */
  14. preTravel: cc.Prefab,
  15. /**数字商城预制体 */
  16. preDigitalMall: cc.Prefab,
  17. /**每日签到预制体 */
  18. preSign: cc.Prefab,
  19. /**待开放预制体 */
  20. preToBeOpened: cc.Prefab,
  21. },
  22. onLoad() {
  23. this.gModeScp = this.gMode.getComponent('GameMode');
  24. },
  25. onTopUI() {
  26. if (!this.gModeScp.IsLogIn(this)) return;
  27. },
  28. /**政务大厅按钮点击 */
  29. onBtnGovernmentClick() {
  30. if (!this.gModeScp.IsLogIn(this)) return;
  31. let tPrefab = cc.instantiate(this.preGovernment);
  32. tPrefab.parent = this.node;
  33. tPrefab.setPosition(0, 0);
  34. },
  35. /**政务大厅-实名认证按钮点击 */
  36. onBtnCertificationClick() {
  37. if (!this.gModeScp.IsLogIn(this)) return;
  38. let tPrefab = cc.instantiate(this.preCertification);
  39. tPrefab.parent = this.node;
  40. tPrefab.setPosition(0, 0);
  41. },
  42. /**人民医院按钮点击 */
  43. onBtnHospitalClick() {
  44. if (!this.gModeScp.IsLogIn(this)) return;
  45. let tPrefab = cc.instantiate(this.preHospital);
  46. tPrefab.parent = this.node;
  47. tPrefab.setPosition(0, 0);
  48. },
  49. /**教育大厅按钮点击 */
  50. onBtnEducationClick() {
  51. if (!this.gModeScp.IsLogIn(this)) return;
  52. let tPrefab = cc.instantiate(this.preEducation);
  53. tPrefab.parent = this.node;
  54. tPrefab.setPosition(0, 0);
  55. },
  56. /**旅游大厅按钮点击 */
  57. onBtnTravelClick() {
  58. if (!this.gModeScp.IsLogIn(this)) return;
  59. let tPrefab = cc.instantiate(this.preTravel);
  60. tPrefab.parent = this.node;
  61. tPrefab.setPosition(0, 0);
  62. },
  63. /**数字商城按钮点击 */
  64. onBtnDigitalMallClick() {
  65. if (!this.gModeScp.IsLogIn(this)) return;
  66. let tPrefab = cc.instantiate(this.preDigitalMall);
  67. tPrefab.parent = this.node;
  68. tPrefab.setPosition(0, 0);
  69. },
  70. /**UI */
  71. onNotice() {
  72. if (!this.gModeScp.IsLogIn(this)) return;
  73. var self = this;
  74. cc.loader.loadRes("Prefabs/Notice/Notice", function (err, prefab) {
  75. let tPrefab = cc.instantiate(prefab);
  76. tPrefab.parent = self.node;
  77. tPrefab.setPosition(0, 0);
  78. });
  79. },
  80. //右上角按钮点击
  81. /**每日签到按钮点击 */
  82. onBtnSignClick() {
  83. // if (!this.gModeScp.IsLogIn(this)) return;
  84. let tPrefab = cc.instantiate(this.preSign);
  85. tPrefab.parent = this.node;
  86. tPrefab.setPosition(0, 0);
  87. },
  88. /**展示待开放 */
  89. showToBeOpened() {
  90. if (!this.gModeScp.IsLogIn(this)) return;
  91. let tPrefab = cc.instantiate(this.preToBeOpened);
  92. tPrefab.parent = this.node;
  93. tPrefab.setPosition(0, 0);
  94. },
  95. });