90a1ceb6-7ba9-4496-99d0-b42e2fb4b0d0.js
2.79 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
"use strict";
cc._RF.push(module, '90a1c62e6lElpnQtC4vtLDQ', 'ImagePreviewViewImpl');
// script/game/ui/view/impl/message/ImagePreviewViewImpl.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.ImagePreviewViewImpl = void 0;
const CCViewBase_1 = require("../../../../../common/classbase/CCViewBase");
const ImagePreviewView_1 = require("../../type/ImagePreviewView");
const CCDummyObjects_1 = require("../../../../../common/CCDummyObjects");
const ResUtils_1 = require("../../../../../common/utils/ResUtils");
const PresenterCCViewFactory_1 = require("../../../PresenterCCViewFactory");
const { ccclass, property } = cc._decorator;
let ImagePreviewViewImpl = /** @class */ (() => {
let ImagePreviewViewImpl = class ImagePreviewViewImpl extends CCViewBase_1.CCPureView {
constructor() {
super(...arguments);
//#region editor bindgins
this.imageSprite = CCDummyObjects_1.DummySprite;
this.closeAction = () => {
this.imageSprite.spriteFrame = this.defaultImage;
delete this._props;
this.close();
};
}
onLoad() {
super.onLoad();
this.defaultImage = this.imageSprite.spriteFrame;
this.bindProp("image", async (value) => {
if (!value)
return;
let sp = await ResUtils_1.ResUtils.loadRes(value, cc.SpriteFrame);
if (this.node.parent && this._props.image === value) {
this.imageSprite.spriteFrame = sp;
}
});
}
onEnable() {
this.node.on(cc.Node.EventType.TOUCH_END, this.closeAction, this);
}
onDisable() {
this.node.off(cc.Node.EventType.TOUCH_END, this.closeAction, this);
}
};
__decorate([
property(cc.Sprite)
], ImagePreviewViewImpl.prototype, "imageSprite", void 0);
ImagePreviewViewImpl = __decorate([
ccclass,
PresenterCCViewFactory_1.RegView(ImagePreviewView_1.ImagePreviewViewType, "prefab/ui/message/ImagePreviewView")
], ImagePreviewViewImpl);
return ImagePreviewViewImpl;
})();
exports.ImagePreviewViewImpl = ImagePreviewViewImpl;
cc._RF.pop();