DynamicLoadingBg.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Learn cc.Class:
  2. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. upLeft: {
  14. default: null,
  15. type: cc.Node,
  16. serializable: true,
  17. },
  18. upRight: {
  19. default: null,
  20. type: cc.Node,
  21. serializable: true,
  22. },
  23. downLeft: {
  24. default: null,
  25. type: cc.Node,
  26. serializable: true,
  27. },
  28. downRight: {
  29. default: null,
  30. type: cc.Node,
  31. serializable: true,
  32. },
  33. villageUpLeft: {
  34. default: null,
  35. tip: "村长图片",
  36. type: cc.SpriteFrame,
  37. serializable: true,
  38. },
  39. villageUpRight: {
  40. default: null,
  41. tip: "村长图片",
  42. type: cc.SpriteFrame,
  43. serializable: true,
  44. },
  45. villageDownLeft: {
  46. default: null,
  47. tip: "村长图片",
  48. type: cc.SpriteFrame,
  49. serializable: true,
  50. },
  51. villageDownRight: {
  52. default: null,
  53. tip: "村长图片",
  54. type: cc.SpriteFrame,
  55. serializable: true,
  56. },
  57. mayorUpLeft: {
  58. default: null,
  59. tip: "镇长图片",
  60. type: cc.SpriteFrame,
  61. serializable: true,
  62. },
  63. mayorUpRight: {
  64. default: null,
  65. tip: "镇长图片",
  66. type: cc.SpriteFrame,
  67. serializable: true,
  68. },
  69. mayorDownLeft: {
  70. default: null,
  71. tip: "镇长图片",
  72. type: cc.SpriteFrame,
  73. serializable: true,
  74. },
  75. mayorDownRight: {
  76. default: null,
  77. tip: "镇长图片",
  78. type: cc.SpriteFrame,
  79. serializable: true,
  80. },
  81. },
  82. /**
  83. * 设置面板信息
  84. */
  85. setInfo(context) {
  86. let { type } = context;
  87. if (type == "village") {
  88. this.upLeft.getComponent(cc.Sprite).spriteFrame = this.villageUpLeft;
  89. this.upRight.getComponent(cc.Sprite).spriteFrame = this.villageUpRight;
  90. this.downLeft.getComponent(cc.Sprite).spriteFrame = this.villageDownLeft;
  91. this.downRight.getComponent(cc.Sprite).spriteFrame = this.villageDownRight;
  92. }else if(type == "mayor"){
  93. this.upLeft.getComponent(cc.Sprite).spriteFrame = this.mayorUpLeft;
  94. this.upRight.getComponent(cc.Sprite).spriteFrame = this.mayorUpRight;
  95. this.downLeft.getComponent(cc.Sprite).spriteFrame = this.mayorDownLeft;
  96. this.downRight.getComponent(cc.Sprite).spriteFrame = this.mayorDownRight;
  97. }
  98. },
  99. });