dd21d7c7-1962-4dc5-a7f7-11c4893c4ce1.js
5.29 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
125
126
127
"use strict";
cc._RF.push(module, 'dd21dfHGWJNxaf3EcSJPEzh', 'GiftListSubviewImpl');
// script/game/ui/view/impl/message/GiftListSubviewImpl.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.GiftListSubviewImpl = void 0;
const PresenterCCViewFactory_1 = require("../../../PresenterCCViewFactory");
const GiftListSubview_1 = require("../../type/GiftListSubview");
const ListSubviewImpl_1 = require("../../../baseview/impl/ListSubviewImpl");
const GiftListItemImpl_1 = require("./GiftListItemImpl");
const simba_cc_resutils_1 = require("simba-cc-resutils");
const CCDummyObjects_1 = require("../../../../../common/CCDummyObjects");
const { ccclass, property } = cc._decorator;
let GiftListSubviewImpl = /** @class */ (() => {
let GiftListSubviewImpl = class GiftListSubviewImpl extends ListSubviewImpl_1.ListSubviewImpl {
constructor() {
super(...arguments);
//#region editor bindings
this.giftButton = CCDummyObjects_1.DummyButton;
this._touchMoved = false;
}
onSendGiftClick() {
this._props.onSendGift();
}
async createListItemView() {
let node = await simba_cc_resutils_1.ResUtils.createWithPrefab("prefab/ui/message/GiftListItem");
return node.getComponent(GiftListItemImpl_1.GiftListItemImpl);
}
onLoad() {
this.giftButton.interactable = false;
}
onPropChange(key) {
super.onPropChange(key);
let hasSelect = false;
if (key === "items") {
for (let item of this._props.items) {
if (item.select) {
hasSelect = true;
break;
}
}
}
this.giftButton.interactable = hasSelect;
}
onEnable() {
this._registerNodeEvent();
}
onDisable() {
this._unregisterNodeEvent();
}
_registerNodeEvent() {
this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this);
this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
// this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this);
// (this.node as any)._touchListener.swallowTouches = false;
}
_unregisterNodeEvent() {
this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this);
this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this);
this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this);
// this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this);
}
_onTouchBegan(event) {
// this._startPos = event.touch.getLocation().clone();
// this._touchMoved = false;
}
_onTouchMove(event) {
// if (this._touchMoved) return;
// let pos = event.touch.getLocation().clone();
// let diffX = this._startPos.x - pos.x;
// let diffY = this._startPos.y - pos.y;
// if (diffX * diffX + diffY * diffY > 25) {
// this._touchMoved = true;
// }
}
_onTouchEnded(event) {
// if (!this._touchMoved) {
this.hide();
// event.stopPropagation();
// }
}
getPannelHeight() {
return this.node.children[0].height;
}
hide() {
this.node.children[1].active = true;
let node = this.node.children[0];
node.stopAllActions();
node.runAction(cc.sequence(cc.moveBy(0.3, 0, -node.height), cc.callFunc(() => {
super.hide();
})));
}
show() {
super.show();
this.node.opacity = 0;
this.node.children[1].active = true;
this.scheduleOnce(() => {
this.node.opacity = 255;
let node = this.node.children[0];
node.stopAllActions();
node.y = -this.node.height / 2 - node.height;
node.runAction(cc.sequence(cc.moveBy(0.3, 0, node.height), cc.callFunc(() => {
this.node.children[1].active = false;
})));
});
}
};
__decorate([
property(cc.Button)
], GiftListSubviewImpl.prototype, "giftButton", void 0);
GiftListSubviewImpl = __decorate([
ccclass,
PresenterCCViewFactory_1.RegSubview(GiftListSubview_1.GiftListSubviewType)
], GiftListSubviewImpl);
return GiftListSubviewImpl;
})();
exports.GiftListSubviewImpl = GiftListSubviewImpl;
cc._RF.pop();