6bc4c8b1-0f3e-4663-84cd-3d5670f40a40.js
5.09 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"use strict";
cc._RF.push(module, '6bc4cixDz5GY4TNPVZw9ApA', 'DatingEventViewPresenter');
// script/game/ui/presenter/DatingEventViewPresenter.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.DatingEventSubpresenter = void 0;
const PresenterBase_1 = require("../../../common/classbase/PresenterBase");
const DatingEventView_1 = require("../view/type/DatingEventView");
const PresenterCCViewFactory_1 = require("../PresenterCCViewFactory");
const DatingEventSubview_1 = require("../view/type/DatingEventSubview");
const GameModelManager_1 = require("../../model/GameModelManager");
const DatingEventSceneModel_1 = require("../../model/DatingEventSceneModel");
const UIManager_1 = require("../../../common/gameplay/managers/UIManager");
const DatingScenePresenter_1 = require("./DatingScenePresenter");
let DatingEventViewPresenter = /** @class */ (() => {
let DatingEventViewPresenter = class DatingEventViewPresenter extends PresenterBase_1.Presenter {
onOpen() {
super.onOpen(undefined);
this.checkRedDot();
}
onEnterForeground() {
super.onEnterForeground();
this.checkRedDot();
}
onShow() {
super.onShow();
this.checkRedDot();
}
checkRedDot() {
let mainRedDot = false;
for (let model of GameModelManager_1.GameModelManager.getMainDatingEventScenesModel()) {
if (model.status === DatingEventSceneModel_1.DatingEventStatus.New || model.status === DatingEventSceneModel_1.DatingEventStatus.InProgress) {
mainRedDot = true;
}
}
this.view.setProps({ mainEventRedDot: mainRedDot, extraEventRedDot: false });
}
};
DatingEventViewPresenter.uuid = "DatingEventViewPresenter";
DatingEventViewPresenter = __decorate([
PresenterCCViewFactory_1.RegPresenter(DatingEventView_1.DatingEventViewType)
], DatingEventViewPresenter);
return DatingEventViewPresenter;
})();
exports.default = DatingEventViewPresenter;
let DatingEventSubpresenter = /** @class */ (() => {
let DatingEventSubpresenter = class DatingEventSubpresenter extends PresenterBase_1.Subpresenter {
constructor() {
super(...arguments);
// private _items: DatingEventItemProps[];
this._lineStyle = 0;
this._modelMap = {};
}
sceneModelToViewModel(item) {
this._modelMap[item.id] = item;
return {
key: item.id + "",
title: item.config.name,
date: item.config.date,
time: item.config.time,
status: item.status,
coverImage: "textures/dating_event/cover/" + item.config.background,
lineStyle: this._lineStyle
};
}
refreshItems() {
// if (!this._items) {
if (this.view.name.indexOf("MainEvent") < 0)
this._lineStyle = 1;
let items = [];
if (this.view.name.indexOf("MainEvent") === 0) {
items = GameModelManager_1.GameModelManager.getMainDatingEventScenesModel().map(v => this.sceneModelToViewModel(v));
if (items.length) {
items[items.length - 1].lineStyle = "none";
}
}
this.view.setProps({
items,
onItemClick: (key) => {
console.log("start dating event", key);
UIManager_1.UIManager.pushPresenter(DatingScenePresenter_1.DatingScenePresenter, this._modelMap[key], true);
}
});
// } else {
// this.view.updateProps({ items: [...this._items] });
// }
}
onOwnerShow() {
if (!this.view.isHidden) {
this.refreshItems();
}
}
onOwnerEnterForeground() {
if (!this.view.isHidden) {
this.refreshItems();
}
}
onOpen() {
super.onOpen();
if (!this.view.isHidden) {
this.refreshItems();
}
}
onShow() {
this.refreshItems();
}
onHide() {
}
};
DatingEventSubpresenter = __decorate([
PresenterCCViewFactory_1.RegSubpresenter(DatingEventSubview_1.DatingEventSubviewType)
], DatingEventSubpresenter);
return DatingEventSubpresenter;
})();
exports.DatingEventSubpresenter = DatingEventSubpresenter;
cc._RF.pop();