| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- cc.Class({
- extends: cc.Component,
- properties: {
- /**
- * 收入显示
- */
- amount: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- bittenTipLabel: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- bittenTipNode: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- },
- setInfo(context) {
- let { amount } = context;
- this.amount.string = "总共收获" + Number(amount).toFixed(3) + "个果实";
- if (isBitten) {
- this.bittenTipNode.active = true;
- //如果有snb 扣snb 和体力,没有snb 则扣 两份体力
- this.bittenTipLabel.string = "被狗咬";
- }
- },
- /**
- * 当前偷取结果
- * @param {偷取结算对象} context
- */
- setSingleStealInfo(context) {
- let { stealSum, wasTheDogBitten, hasReduceSnb, deductSnb, deductStrength } = context;
- this.amount.string = "总共收获" + Number(stealSum).toFixed(3) + "个果实";
- if (wasTheDogBitten) {
- this.bittenTipNode.active = true;
- if (hasReduceSnb) {
- //如果有snb 扣snb 和体力,没有snb 则扣 两份体力
- this.bittenTipLabel.string = "被狗咬,扣除SNB:" + deductSnb + "和体力:" + deductStrength;
- //更新日志数据
- cc.find("GameNode/ManageDapp").getComponent("ManageDapp").onUpdateSnbList();
- } else {
- this.bittenTipLabel.string = "被狗咬,扣除体力:" + deductStrength;
- }
- }
- },
- onClose() {
- this.node.destroy();
- },
- });
|