07873864f2752ebebcdaae9cbb27e5477e565642.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. System.register(["cc"], function (_export, _context) {
  2. "use strict";
  3. var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, Label, RigidBody, _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3, _crd, ccclass, property, Cube_State, Cube_Infor;
  4. function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  5. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  6. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  7. return {
  8. setters: [function (_cc) {
  9. _cclegacy = _cc.cclegacy;
  10. __checkObsolete__ = _cc.__checkObsolete__;
  11. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  12. _decorator = _cc._decorator;
  13. Component = _cc.Component;
  14. Label = _cc.Label;
  15. RigidBody = _cc.RigidBody;
  16. }],
  17. execute: function () {
  18. _crd = true;
  19. _cclegacy._RF.push({}, "0fe67dkVupFZYUR3uRu1sAy", "Cube_Infor", undefined);
  20. __checkObsolete__(['_decorator', 'Component', 'Label', 'Node', 'RigidBody']);
  21. ({
  22. ccclass,
  23. property
  24. } = _decorator);
  25. _export("Cube_State", Cube_State = /*#__PURE__*/function (Cube_State) {
  26. Cube_State[Cube_State["live"] = 0] = "live";
  27. Cube_State[Cube_State["wait"] = 1] = "wait";
  28. Cube_State[Cube_State["dead"] = 2] = "dead";
  29. return Cube_State;
  30. }({}));
  31. _export("Cube_Infor", Cube_Infor = (_dec = ccclass('Cube_Infor'), _dec2 = property(Label), _dec3 = property(Label), _dec4 = property(RigidBody), _dec(_class = (_class2 = class Cube_Infor extends Component {
  32. constructor() {
  33. super(...arguments);
  34. _initializerDefineProperty(this, "txt", _descriptor, this);
  35. _initializerDefineProperty(this, "txt2", _descriptor2, this);
  36. _initializerDefineProperty(this, "rigidbody", _descriptor3, this);
  37. this.text = void 0;
  38. this.state = Cube_State.live;
  39. // 添加缓存状态来避免重复切换
  40. this.isUp = false;
  41. }
  42. start() {}
  43. update(deltaTime) {
  44. // 获取方块当前的旋转角度(以欧拉角形式)
  45. var rotationX = this.node.eulerAngles.x;
  46. if (rotationX >= -160 && rotationX < -30) {
  47. this.ShowFront(); // 显示正面字
  48. } else if (rotationX > 30 && rotationX <= 160) {
  49. this.ShowBack(); // 显示反面字
  50. } else {
  51. this.ShowBothSides();
  52. }
  53. }
  54. ShowFront() {
  55. this.txt.node.active = true;
  56. this.txt2.node.active = false;
  57. }
  58. ShowBack() {
  59. this.txt.node.active = false;
  60. this.txt2.node.active = true;
  61. }
  62. ShowBothSides() {
  63. this.txt.node.active = true;
  64. this.txt2.node.active = true;
  65. }
  66. set Text(value) {
  67. this.txt.string = value;
  68. this.txt2.string = value;
  69. }
  70. get Text() {
  71. return this.txt.string;
  72. }
  73. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "txt", [_dec2], {
  74. configurable: true,
  75. enumerable: true,
  76. writable: true,
  77. initializer: null
  78. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "txt2", [_dec3], {
  79. configurable: true,
  80. enumerable: true,
  81. writable: true,
  82. initializer: null
  83. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "rigidbody", [_dec4], {
  84. configurable: true,
  85. enumerable: true,
  86. writable: true,
  87. initializer: null
  88. })), _class2)) || _class));
  89. _cclegacy._RF.pop();
  90. _crd = false;
  91. }
  92. };
  93. });
  94. //# sourceMappingURL=07873864f2752ebebcdaae9cbb27e5477e565642.js.map