123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- 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.DeskPosData = i.CarPosData = i.DeskData = void 0);
- const u = t("PassSectionData"),
- p = t("TipData"),
- f = t("GameConst"),
- g = t("GameUtils"),
- o = t("BaseService"),
- m = t("MapService"),
- {ccclass: a} = cc._decorator;
- (s = class extends o.default {
- constructor() {
- super(...arguments),
- (this.mapNode = null),
- (this.empPosList = null),
- (this.passSectionDatas = null),
- (this.cookDatas = null),
- (this.carCookDatas = null),
- (this.deskDatas = null),
- (this.carPosData = null),
- (this.stageType = null);
- }
- onLoad() {
- s.ins = this;
- }
- hasEmpPos() {
- return 0 < this.empPosList.length;
- }
- init() {
- (this.stageType = m.default.ins.curCfg.type), this.stageType !== f.StageType.CAR && this.unlockDesk2();
- }
- addCookData(t) {
- (this.stageType !== f.StageType.CAR || t.order.customer.isReadyReceive
- ? this.cookDatas
- : this.carCookDatas
- ).push(t);
- }
- carCookDataFinish(e) {
- for (let t = this.carCookDatas.length - 1; 0 <= t; t--)
- if (this.carCookDatas[t].order.customer === e) {
- const e = this.carCookDatas.splice(t, 1)[0];
- this.cookDatas.push(e);
- }
- }
- unlockDesk(t) {
- this.deskDatas[t].unlock(), this.empPosList.push(...this.deskDatas[t].customers);
- }
- unlockDesk2() {
- this.empPosList.push(this.deskDatas[0].customers.pop());
- }
- parse(t) {
- if (
- ((this.cookDatas = []),
- (this.empPosList = []),
- (this.carCookDatas = []),
- (this.passSectionDatas = []),
- m.default.ins.curCfg.type === f.StageType.CAR)
- ) {
- const o = t.getChildByName("DriveFront"),
- a = o.getChildByName("OrderTrans").position,
- n = o.getChildByName("valueUpTrans").position,
- r = (this.carPosData = new y()),
- u = (r.posData = new v());
- u.tipAndValueUp = new p.default(n);
- const f = o.getChildByName("Desk");
- f
- ? ((u.tipAndValueUp.deskNode = f), f.removeFromParent(!1), m.default.ins.layer.addChild(f))
- : (u.tipAndValueUp.deskNode = m.default.ins.uiLayer),
- (r.order = a),
- (r.receiveTrans = []);
- var e = o.getChildByName("ReceiveTrans"),
- i = e.x,
- s = e.y;
- for (const t of e.children) {
- const o = t.position;
- (o.x += i), (o.y += s), r.receiveTrans.push(o);
- }
- e = o.getChildByName("ReceiveStaffTrans").position;
- u.staff = {pos: e, direction: g.getDirection(e, r.receiveTrans[0])};
- e = o.getChildByName("StaffTrans").position;
- (r.staffTrans = {pos: e, direction: g.getDirection(e, a)}), o.destroy();
- } else {
- const o = t.getChildByName("Desk"),
- a = o.children.concat(),
- l = (this.deskDatas = []),
- h = a.length;
- for (let t = 0; t < h; t++) {
- const o = a[t],
- c = new _();
- 0 < t && o.removeFromParent(!1), (c.node = o), c.parse(o), (l[t] = c);
- }
- l[0].showNode(), o.destroy();
- }
- const o = t.getChildByName("PassSection");
- let a = o.getChildByName("Desk");
- a && a.removeFromParent(!1);
- for (const d of o.children) {
- const t = new u.default();
- if (((t.passSectionDesk = m.default.ins.uiLayer), t.parse(d), a))
- for (const o of a.children)
- if (o.getBoundingBox().contains(t.foodPos)) {
- t.passSectionDesk = o;
- break;
- }
- this.passSectionDatas.push(t);
- }
- if (a) {
- for (let t = a.children.length - 1; 0 <= t; t--) {
- const o = a.children[t];
- o.removeFromParent(!1), m.default.ins.layer.addChild(o);
- }
- a.destroy();
- }
- o.destroy();
- }
- }),
- (s = e([a], s));
- i.default = s;
- const d = cc.v2();
- class _ {
- constructor() {
- (this.customers = []), (this.isUnlock = !1), (this.node = null);
- }
- parse(e) {
- const i = e.x,
- s = e.y,
- t = e.getChildByName("Staff"),
- o = [];
- let a = i + t.x,
- n = s + t.y;
- for (const p of t.children) {
- const e = p.position;
- (e.x += a), (e.y += n), o.push({pos: e, direction: 0});
- }
- t.destroy();
- const r = e.getChildByName("TipAndValueUp"),
- l = e.children.filter(t => "Desk" === t.name),
- h = [];
- (a = i + r.x), (n = s + r.y);
- for (const g of r.children) {
- const e = g.position;
- (e.x += a), (e.y += n);
- const t = new p.default(e);
- (t.deskNode = m.default.ins.uiLayer), h.push(t);
- for (const o of l) {
- const a = o.getBoundingBox();
- (a.x += i), (a.y += s), a.contains(e) && (t.deskNode = o);
- }
- }
- r.destroy();
- const c = e.getChildByName("Customer");
- (a = i + c.x), (n = s + c.y);
- for (const p of c.children) {
- const e = p.position;
- (e.x += a), (e.y += n);
- const i = {pos: e, direction: 0},
- s = new v();
- (s.sit = i), this.customers.push(s);
- let t = 1e6;
- for (const o of h) {
- const e = i.pos.sub(o.pos, d).magSqr();
- t > e && ((s.tipAndValueUp = o), (t = e));
- }
- (i.direction = g.getDirection(i.pos, s.tipAndValueUp.pos)), (t = 1e6);
- for (const a of o) {
- const e = s.sit.pos.sub(a.pos, d).magSqr();
- t > e && ((t = e), (s.staff = a));
- }
- s.staff.direction = g.getDirection(s.staff.pos, s.tipAndValueUp.pos);
- }
- c.destroy(), this.node.removeFromParent(!1);
- }
- showNode() {
- const e = this.node,
- i = m.default.ins.layer,
- s = e.x,
- o = e.y;
- for (let t = e.children.length - 1; 0 <= t; t--) {
- const a = e.children[t];
- a.removeFromParent(!1), i.addChild(a), (a.x += s), (a.y += o);
- }
- e.destroy(), (this.node = null);
- }
- unlock() {
- (this.isUnlock = !0), this.showNode();
- }
- }
- i.DeskData = _;
- class y {
- constructor() {
- (this.receiveTrans = null), (this.order = null), (this.staffTrans = null), (this.posData = null);
- }
- }
- i.CarPosData = y;
- class v {
- constructor() {
- (this.sit = null), (this.staff = null), (this.tipAndValueUp = null);
- }
- }
- i.DeskPosData = v;
|