BricsItem.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-04-18 15:09:04
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-19 15:20:09
  6. * @Description: 金砖道具
  7. */
  8. import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
  9. import VMParent from 'db://oops-framework/libs/model-view/VMParent';
  10. import { smc } from '../common/SingletonModuleComp';
  11. const { ccclass, property } = _decorator;
  12. @ccclass('BricsItem')
  13. export class BricsItem extends VMParent {
  14. @property(Node)
  15. private brickNode: Node = null!;
  16. //完成Node
  17. @property(Node)
  18. private completeNode: Node = null!;
  19. @property(Label)
  20. private levelLabel: Label = null!;
  21. @property([SpriteFrame])
  22. private iconList: SpriteFrame[] = [];
  23. //
  24. @property(Sprite)
  25. private iconSprite: Sprite = null!;
  26. @property(Node)
  27. private iconNode: Node = null!;
  28. @property(Node)
  29. private icon2Node: Node = null!;
  30. @property(Node)
  31. private circleNode: Node = null!;
  32. data: any = {
  33. level: 0,
  34. eventType: "",
  35. withdraw: false,
  36. position: 0, //位置
  37. isFirstNotWithdraw: false, //是否第一个没提现
  38. isAllWithdrawBeforeSecondLast: false, //是否所有提现点都提现
  39. }
  40. start() {
  41. }
  42. //更新数据
  43. updateData(data: any) {
  44. this.data = data;
  45. this.levelLabel.string = `${this.data.level}`;
  46. this.iconNode.active = false;
  47. this.icon2Node.active = false;
  48. this.brickNode.active = !this.data.withdraw;
  49. this.completeNode.active = this.data.withdraw;
  50. if (this.data.eventType === "SIGN_POINT") {
  51. this.iconSprite.spriteFrame = this.iconList[0];
  52. //
  53. this.iconNode.active = true;
  54. } else {
  55. this.iconSprite.spriteFrame = this.iconList[1];
  56. }
  57. //是否提现了
  58. if (!this.data.withdraw) {
  59. //
  60. if (this.data.isFirstNotWithdraw) {
  61. //展示状态其他不展示
  62. this.iconNode.active = true;
  63. } else if (this.data.isAllWithdrawBeforeSecondLast) {
  64. //展示特殊状态
  65. this.icon2Node.active = true;
  66. }
  67. }
  68. //显示光圈
  69. if (this.data.level === smc.account.AccountModel.curLevel) {
  70. this.circleNode.active = true;
  71. } else {
  72. this.circleNode.active = false;
  73. }
  74. }
  75. }