123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- var t = require;
- var e = module;
- var i = exports;
- var s,
- e =
- (this && this.__decorate) ||
- function (t, e, i, s) {
- var o,
- a = arguments.length,
- n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
- else
- for (var r = t.length - 1; 0 <= r; r--)
- (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
- return 3 < a && n && Object.defineProperty(e, i, n), n;
- };
- Object.defineProperty(i, "__esModule", {value: !0}), (i.CharactorState = i.aniMap = void 0);
- const o = t("MoveComponent"),
- {property: a, ccclass: n} = cc._decorator;
- (i.aniMap = {
- [o.Dir.Bottom]: "Z_",
- [o.Dir.BottomRight]: "Z_",
- [o.Dir.BottomLeft]: "Z_",
- [o.Dir.Right]: "L_",
- [o.Dir.TopRight]: "L_",
- [o.Dir.Top]: "B_",
- [o.Dir.TopLeft]: "L_",
- [o.Dir.Left]: "L_"
- }),
- ((t = s = i.CharactorState || (i.CharactorState = {}))[(t.stand = 0)] = "stand"),
- (t[(t.run = 1)] = "run"),
- (t[(t.send_food = 2)] = "send_food"),
- (t[(t.sitdown = 3)] = "sitdown"),
- (t[(t.cooking = 4)] = "cooking");
- t = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.sp = null),
- (this.aniPre = null),
- (this.skinName = ""),
- (this.moveSpeed = 150),
- (this.roleLangBubble = null),
- (this._direction = 0),
- (this._state = 0),
- (this.curAniName = "");
- }
- start() {
- (this.direction = 0), (this.state = s.stand);
- }
- test() {}
- changeSlot(t, e, i) {
- let s = this.sp.skeletonData.getRuntimeData(),
- o = s.findSkin(t),
- a = s.findSlotIndex(e),
- n = o.getAttachment(a, i),
- r = this.sp.findSlot(e);
- r && r.setAttachment(n);
- }
- get direction() {
- return this._direction;
- }
- set direction(t) {
- (this._direction = t),
- (this.aniPre = i.aniMap[t]),
- (this.sp.node.scaleX = 4 < t ? -1 : 1),
- (this.state = this._state);
- }
- get state() {
- return this._state;
- }
- playAni(t) {
- this.sp.setAnimation(0, this.aniPre + t, !0), (this.sp.timeScale = 1);
- }
- set state(t) {
- this._state = t;
- let e = "";
- switch (this._state) {
- case s.stand:
- (e = this.aniPre + "idle"), (this.sp.timeScale = 1);
- break;
- case s.run:
- (e = this.aniPre + "walk"), (this.sp.timeScale = this.moveSpeed / 150);
- break;
- case s.sitdown:
- (e = this.aniPre + "idle"), (this.sp.timeScale = 1);
- break;
- case s.send_food:
- (e = this.aniPre + "walk2"), (this.sp.timeScale = this.moveSpeed / 150);
- break;
- case s.cooking:
- (e = this.aniPre + "cook"), (this.sp.timeScale = 1);
- }
- this.curAniName !== e && (this.sp.setAnimation(0, e, !0), (this.curAniName = e));
- }
- };
- e([a(sp.Skeleton)], t.prototype, "sp", void 0), (t = e([n], t)), (i.default = t);
|