MmCardItem.ts 1005 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { _decorator, Button, Component, Node, Sprite, SpriteAtlas, tween } from 'cc';
  2. import { EventCustom } from '../../Common/Scripts/EventCustom';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('MmCardItem')
  5. export class MmCardItem extends Component {
  6. @property(Node)
  7. CardB: Node = null;
  8. @property(Node)
  9. CardO: Node = null;
  10. @property(Sprite)
  11. CardVSp: Sprite = null;
  12. @property(SpriteAtlas)
  13. CardImgs: SpriteAtlas = null;
  14. _openTime: number = 5;
  15. _isO: boolean = false;;
  16. _cardV: number;
  17. set CardV(a: number) {
  18. this._cardV = a;
  19. this.CardB.active = true;
  20. this.CardO.active = false;
  21. this.CardVSp.node.active = false;
  22. this.CardVSp.spriteFrame = this.CardImgs.getSpriteFrame(this._cardV + "");
  23. this._isO = false;
  24. }
  25. start() {
  26. }
  27. clicked() {
  28. let e = new EventCustom("CardClick", true, this.node);
  29. this.node.dispatchEvent(e);
  30. }
  31. update(deltaTime: number) {
  32. }
  33. }