StealViewSuccess.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. /**
  5. * 收入显示
  6. */
  7. amount: {
  8. default: null,
  9. type: cc.Label,
  10. serializable: true,
  11. },
  12. bittenTipLabel: {
  13. default: null,
  14. type: cc.Label,
  15. serializable: true,
  16. },
  17. bittenTipNode: {
  18. default: null,
  19. type: cc.Node,
  20. serializable: true,
  21. },
  22. },
  23. setInfo(context) {
  24. let { amount } = context;
  25. this.amount.string = "总共收获" + Number(amount).toFixed(3) + "个果实";
  26. if (isBitten) {
  27. this.bittenTipNode.active = true;
  28. //如果有snb 扣snb 和体力,没有snb 则扣 两份体力
  29. this.bittenTipLabel.string = "被狗咬";
  30. }
  31. },
  32. /**
  33. * 当前偷取结果
  34. * @param {偷取结算对象} context
  35. */
  36. setSingleStealInfo(context) {
  37. let { stealSum, wasTheDogBitten, hasReduceSnb, deductSnb, deductStrength } = context;
  38. this.amount.string = "总共收获" + Number(stealSum).toFixed(3) + "个果实";
  39. if (wasTheDogBitten) {
  40. this.bittenTipNode.active = true;
  41. if (hasReduceSnb) {
  42. //如果有snb 扣snb 和体力,没有snb 则扣 两份体力
  43. this.bittenTipLabel.string = "被狗咬,扣除SNB:" + deductSnb + "和体力:" + deductStrength;
  44. //更新日志数据
  45. cc.find("GameNode/ManageDapp").getComponent("ManageDapp").onUpdateSnbList();
  46. } else {
  47. this.bittenTipLabel.string = "被狗咬,扣除体力:" + deductStrength;
  48. }
  49. }
  50. },
  51. onClose() {
  52. this.node.destroy();
  53. },
  54. });