f2d00e7e-a889-4fad-a98c-7248c79456b3.js
4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"use strict";
cc._RF.push(module, 'f2d005+qIlPramMckjHlFaz', 'PhoneCallViewPresenter');
// script/game/ui/presenter/PhoneCallViewPresenter.ts
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PhoneCallViewPresenter = void 0;
const PresenterBase_1 = require("../../../common/classbase/PresenterBase");
const PhoneCallView_1 = require("../view/type/PhoneCallView");
const PresenterCCViewFactory_1 = require("../PresenterCCViewFactory");
const GameModelManager_1 = require("../../model/GameModelManager");
const Enums_1 = require("../../Enums");
const ConfigManager_1 = require("../../../common/gameplay/managers/ConfigManager");
const Role_1 = require("../../../config/Role");
const PlotManager_1 = require("../../../avg/PlotManager");
const SentenceSelectorViewPresenter_1 = require("./SentenceSelectorViewPresenter");
const UIManager_1 = require("../../../common/gameplay/managers/UIManager");
let PhoneCallViewPresenter = /** @class */ (() => {
let PhoneCallViewPresenter = class PhoneCallViewPresenter extends PresenterBase_1.Presenter {
constructor() {
super(...arguments);
this._items = [];
this.onSetContent = (content) => {
let props = {
sentence: content,
backgroundpath: "",
clickcausehide: false,
onSelectIndexCallback: this.onSelectIndexCallback
};
UIManager_1.UIManager.pushPresenter(SentenceSelectorViewPresenter_1.default, props);
};
this.onSelectIndexCallback = (index) => {
this.view.select(index);
};
this.isSentenceSelectVisible = () => {
let preset = UIManager_1.UIManager.getTopPresenter();
if (preset instanceof SentenceSelectorViewPresenter_1.default) {
let selectorPresenter = preset;
return !selectorPresenter.view.isHidden;
}
return false;
};
}
async onOpen() {
super.onOpen(undefined);
this._items = [];
GameModelManager_1.GameModelManager.rollbackPhoneCallIfNeeded().then((plots) => {
let plot = plots[0];
if (plot.plotSceneType !== Enums_1.PlotSceneType.PhoneCall) {
console.error("Phone call plot data error.");
}
else {
let roleData = ConfigManager_1.ConfigManager.getConfig(Role_1.role, plot.plotSceneTypeId);
this._items = [{ key: plot.id + "", isSelf: plot.sentences[0].roleId === 2, sentence: plot.sentences[0] }];
this._viewProps =
{
name: roleData.name,
icon: GameModelManager_1.GameModelManager.getRoleData(plot.plotSceneTypeId).getHeadIcon(),
items: this._items,
onCompletePlot: (index) => PlotManager_1.PlotManager.completePlot(plot, index),
onSetContent: this.onSetContent,
isSentenceSelectVisible: this.isSentenceSelectVisible
};
this._view.setProps(this._viewProps);
this._disposable.add(PlotManager_1.PlotManager.PlotStartEvent.on((plots) => {
plot = plots[0];
if (plot.plotSceneType !== Enums_1.PlotSceneType.PhoneCall) {
this._view.close();
}
else {
this._items = [...this._items, { key: plot.id + "", isSelf: plot.sentences[0].roleId === 2, sentence: plot.sentences[0] }];
this._view.updateProps({ items: this._items });
}
}));
}
});
}
};
PhoneCallViewPresenter.uuid = "PhoneCallViewPresenter";
PhoneCallViewPresenter = __decorate([
PresenterCCViewFactory_1.RegPresenter(PhoneCallView_1.PhoneCallViewType)
], PhoneCallViewPresenter);
return PhoneCallViewPresenter;
})();
exports.PhoneCallViewPresenter = PhoneCallViewPresenter;
cc._RF.pop();