BattleRoomCreateCell.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. imageRare: {
  5. default: null,
  6. type: cc.Sprite,
  7. serializable: true,
  8. },
  9. imageItem: {
  10. default: null,
  11. type: cc.Sprite,
  12. serializable: true,
  13. },
  14. imageSelect: {
  15. default: null,
  16. type: cc.Sprite,
  17. serializable: true,
  18. },
  19. textPrice: {
  20. default: null,
  21. type: cc.Label,
  22. serializable: true,
  23. },
  24. textType: {
  25. default: null,
  26. type: cc.Label,
  27. serializable: true,
  28. },
  29. textNum: {
  30. default: null,
  31. type: cc.Label,
  32. serializable: true,
  33. },
  34. },
  35. setIndex(index) {
  36. this.index = index;
  37. },
  38. getIndex(index) {
  39. return this.index;
  40. },
  41. setData(data) {
  42. this.data = data;
  43. },
  44. getData() {
  45. return this.data;
  46. },
  47. setCb(cb) {
  48. this.onClickCb = cb;
  49. },
  50. setScale(s) {
  51. this.node.scale = s;
  52. },
  53. setTypeName(name) {
  54. this.textType.string = name;
  55. },
  56. setTypeNameScale(s) {
  57. this.textType.node.scale = s;
  58. },
  59. setPrice(price) {
  60. this.textPrice.string = price;
  61. },
  62. setSelectNum(num) {
  63. this.imageSelect.node.active = num > 0;
  64. this.textNum.node.active = num > 0;
  65. if (num > 0) {
  66. this.textNum.string = "X" + num;
  67. }
  68. },
  69. onClickCell() {
  70. if (this.onClickCb) {
  71. this.onClickCb(this.index, this.data)
  72. }
  73. },
  74. });