tongqian_jiesuan.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import { _decorator, Component, Node, Label } from 'cc';
  2. import { GameMng } from '../GameMng';
  3. import { Tools } from '../Tools';
  4. import { settlementData } from '../UserData/settlementData';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('tongqian_jiesuan')
  7. export class tongqian_jiesuan extends Component {
  8. @property(Node) lab_get_tongbi:Node = null;
  9. @property(Node)
  10. rival_tongqian_lab: Node = null; //对手铜钱数
  11. @property(Node)
  12. self_tongqian_lab: Node = null; //自己铜钱数
  13. start() {
  14. }
  15. show(settlement:settlementData){
  16. this.node.active = true;
  17. this.rival_tongqian_lab.parent.active = true;
  18. let fh = settlement.result===1?"+":"-"
  19. this.rival_tongqian_lab.getComponent(Label).string = Tools.getTongBiNumber(GameMng._userData.room.rival.tong_bi)
  20. this.self_tongqian_lab.getComponent(Label).string = Tools.getTongBiNumber(GameMng._userData.bag.tong_bi)
  21. this.lab_get_tongbi.getComponent(Label).string = fh+Math.abs(settlement.get_tong_bi)+""
  22. }
  23. update(deltaTime: number) {
  24. }
  25. }