08a7a986a1e4ee52978bc7d520e8a5df16f6ec44.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. System.register(["__unresolved_0", "cc"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, error, AnimatorCondition, _crd, ParamType, LogicType;
  4. function _reportPossibleCrUseOfAnimatorController(extras) {
  5. _reporterNs.report("AnimatorController", "./AnimatorController", _context.meta, extras);
  6. }
  7. _export("default", void 0);
  8. return {
  9. setters: [function (_unresolved_) {
  10. _reporterNs = _unresolved_;
  11. }, function (_cc) {
  12. _cclegacy = _cc.cclegacy;
  13. __checkObsolete__ = _cc.__checkObsolete__;
  14. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  15. error = _cc.error;
  16. }],
  17. execute: function () {
  18. _crd = true;
  19. _cclegacy._RF.push({}, "8ade2h2C/ZA86thhI0NNuqu", "AnimatorCondition", undefined);
  20. __checkObsolete__(['error']);
  21. /** 参数类型 */
  22. _export("ParamType", ParamType = /*#__PURE__*/function (ParamType) {
  23. ParamType[ParamType["COMPLETE"] = 0] = "COMPLETE";
  24. ParamType[ParamType["BOOLEAN"] = 1] = "BOOLEAN";
  25. ParamType[ParamType["NUMBER"] = 2] = "NUMBER";
  26. ParamType[ParamType["TRIGGER"] = 3] = "TRIGGER";
  27. ParamType[ParamType["AUTO_TRIGGER"] = 4] = "AUTO_TRIGGER";
  28. return ParamType;
  29. }({}));
  30. /** 逻辑类型 */
  31. _export("LogicType", LogicType = /*#__PURE__*/function (LogicType) {
  32. LogicType[LogicType["EQUAL"] = 0] = "EQUAL";
  33. LogicType[LogicType["NOTEQUAL"] = 1] = "NOTEQUAL";
  34. LogicType[LogicType["GREATER"] = 2] = "GREATER";
  35. LogicType[LogicType["LESS"] = 3] = "LESS";
  36. LogicType[LogicType["GREATER_EQUAL"] = 4] = "GREATER_EQUAL";
  37. LogicType[LogicType["LESS_EQUAL"] = 5] = "LESS_EQUAL";
  38. return LogicType;
  39. }({}));
  40. /**
  41. * 单项条件
  42. */
  43. _export("default", AnimatorCondition = class AnimatorCondition {
  44. constructor(data, ac) {
  45. this._ac = void 0;
  46. /** 此条件对应的参数名 */
  47. this._param = "";
  48. /** 此条件对应的值 */
  49. this._value = 0;
  50. /** 此条件与值比较的逻辑 */
  51. this._logic = LogicType.EQUAL;
  52. this._ac = ac;
  53. this._param = data.param;
  54. this._value = data.value;
  55. this._logic = data.logic;
  56. }
  57. getParamName() {
  58. return this._param;
  59. }
  60. getParamType() {
  61. return this._ac.params.getParamType(this._param);
  62. }
  63. /** 判断此条件是否满足 */
  64. check() {
  65. var type = this.getParamType();
  66. if (type === ParamType.BOOLEAN) {
  67. return this._ac.params.getBool(this._param) === this._value;
  68. } else if (type === ParamType.NUMBER) {
  69. var value = this._ac.params.getNumber(this._param);
  70. switch (this._logic) {
  71. case LogicType.EQUAL:
  72. return value === this._value;
  73. case LogicType.NOTEQUAL:
  74. return value !== this._value;
  75. case LogicType.GREATER:
  76. return value > this._value;
  77. case LogicType.LESS:
  78. return value < this._value;
  79. case LogicType.GREATER_EQUAL:
  80. return value >= this._value;
  81. case LogicType.LESS_EQUAL:
  82. return value <= this._value;
  83. default:
  84. return false;
  85. }
  86. } else if (type === ParamType.AUTO_TRIGGER) {
  87. return this._ac.params.getAutoTrigger(this._param) !== 0;
  88. } else if (type === ParamType.TRIGGER) {
  89. return this._ac.params.getTrigger(this._param) !== 0;
  90. } else {
  91. error("[AnimatorCondition.check] \u9519\u8BEF\u7684type: " + type);
  92. return false;
  93. }
  94. }
  95. });
  96. _cclegacy._RF.pop();
  97. _crd = false;
  98. }
  99. };
  100. });
  101. //# sourceMappingURL=08a7a986a1e4ee52978bc7d520e8a5df16f6ec44.js.map