BattleRoomSelectCell.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. imageBg: {
  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. buttonSub: {
  15. default: null,
  16. type: cc.Button,
  17. serializable: true,
  18. },
  19. imageSelect: {
  20. default: null,
  21. type: cc.Sprite,
  22. serializable: true,
  23. },
  24. },
  25. setIndex(index) {
  26. this.index = index;
  27. },
  28. getIndex(index) {
  29. return this.index;
  30. },
  31. setData(data) {
  32. this.data = data;
  33. },
  34. getData() {
  35. return this.data;
  36. },
  37. setCb(cb) {
  38. this.onClickCb = cb;
  39. },
  40. setSelect(b) {
  41. this.imageSelect.node.active = b;
  42. },
  43. setButtonSubShow(b) {
  44. this.buttonSub.node.active = b;
  45. },
  46. onClickCell() {
  47. if (this.onClickCb) {
  48. this.onClickCb(this.index, this.data)
  49. }
  50. },
  51. });