MessageViewImpl.ts
1.6 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
import { MessageEntryItemProps, MessageViewProps, MessageViewType } from "../type/MessageView";
import { ResUtils } from "simba-cc-resutils";
import { MessageEntryItemImpl } from "./MessageEntryItem";
import { ListViewImpl } from "../../baseview/impl/ListViewImpl";
import { RegView } from "../../PresenterCCViewFactory";
import { GameModelManager } from "../../../model/GameModelManager";
import { DummyNode } from "../../../../common/CCDummyObjects";
const { ccclass, property } = cc._decorator;
@ccclass
@RegView(MessageViewType, "prefab/ui/MessageView")
export class MessageViewImpl extends ListViewImpl<MessageEntryItemProps, MessageViewProps> {
@property(cc.Node)
plotStopTipBtnNode: cc.Node = DummyNode;
async createListItemView() {
let node = await ResUtils.createWithPrefab("prefab/ui/message/MessageEntryItem");
return node.getComponent(MessageEntryItemImpl);
}
onLoad() {
super.onLoad();
this.bindProp("isShowPlotStopTipBtn", (value) => {
this.plotStopTipBtnNode.active = value;
});
}
getItemNode = (k: string): cc.Node | undefined => {
let ret: cc.Node | undefined = undefined;
let v = this._itemViews[k];
if (v) {
ret = v.node;
ret.getComponent(cc.Widget).updateAlignment();
}
return ret;
}
onRefreshListEnd() {
this.scrollView.node.getComponent(cc.Widget).updateAlignment();
this.contentLayout.updateLayout();
GameModelManager.CheckMsgGuide.emit();
}
onPlotStopTipBtnCallback() {
this._props.PlotStopTipBtnCallback();
}
}