PlantInfo.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. //种子作物的名字
  5. plantName: {
  6. default: null,
  7. type: cc.Label
  8. },
  9. //单价
  10. price: {
  11. default: null,
  12. type: cc.Label,
  13. serializable: true,
  14. },
  15. //成熟期
  16. maturity: {
  17. default: null,
  18. type: cc.Label,
  19. serializable: true,
  20. },
  21. //种植时间
  22. plantStart: {
  23. default: null,
  24. type: cc.Label,
  25. serializable: true,
  26. },
  27. //收获数量
  28. harvestQuantity: {
  29. default: null,
  30. type: cc.Label,
  31. serializable: true,
  32. },
  33. //介绍
  34. describe: {
  35. default: null,
  36. type: cc.Label,
  37. serializable: true,
  38. },
  39. },
  40. // LIFE-CYCLE CALLBACKS:
  41. // onLoad () {},
  42. // start() {
  43. // },
  44. setInfo(name, price, maturity, plantStart, harvestQuantity, describe) {
  45. this.plantName.string = name;
  46. this.price.string = price;
  47. this.maturity.string = maturity;
  48. this.plantStart.string = plantStart;
  49. this.harvestQuantity.string = harvestQuantity;
  50. this.describe.string = describe;
  51. },
  52. onclose() {
  53. this.node.destroy();
  54. }
  55. });