a189260d-2ae1-4d3c-84c0-e82878c15294.js
6.04 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
"use strict";
cc._RF.push(module, 'a1892YNKuFNPITA6Ch4wVKU', 'ShareSuitViewPresenter');
// script/game/ui/presenter/bedroom/ShareSuitViewPresenter.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 });
const simba_cc_resutils_1 = require("simba-cc-resutils");
const CCWechatScreenShotMgr_1 = require("../../../../common/CCWechatScreenShotMgr");
const PresenterBase_1 = require("../../../../common/classbase/PresenterBase");
const UIManager_1 = require("../../../../common/gameplay/managers/UIManager");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const ShareSuitView_1 = require("../../view/type/ShareSuitView");
let ShareSuitViewPresenter = /** @class */ (() => {
let ShareSuitViewPresenter = class ShareSuitViewPresenter extends PresenterBase_1.Presenter {
constructor() {
super();
this._onShow = false;
this.onCloseBtnClickCallback = () => {
this.view.close();
this._onShow = false;
};
}
onOpen(props) {
super.onOpen(props);
this._viewProps = props;
this._viewProps.bgSpritePath = props.bgSpritePath;
this._viewProps.rolePortraitSpritePath = props.rolePortraitSpritePath;
this._viewProps.onCloseBtnClickCallback = this.onCloseBtnClickCallback;
this.view.setProps(this._viewProps);
this.onShow();
}
onShow() {
super.onShow();
this.showShareSuitRolePortrait();
}
onClose() {
super.onClose();
}
onEnterBackground() {
super.onEnterBackground();
}
onEnterForeground() {
super.onEnterForeground();
}
async showShareSuitRolePortrait() {
this._onShow = true;
this.view.getShareSuitViewBgSprite().spriteFrame = await simba_cc_resutils_1.ResUtils.loadRes(this._viewProps.bgSpritePath, cc.SpriteFrame);
this.view.getShareSuitViewRolePortraitSprite().spriteFrame = await simba_cc_resutils_1.ResUtils.loadRes(this._viewProps.rolePortraitSpritePath, cc.SpriteFrame);
let shareNode = this.view.getShareNode();
let shareNodeWorldSpace = shareNode.convertToWorldSpaceAR(cc.v2(0, 0));
CCWechatScreenShotMgr_1.default.getInstance().doShot(shareNodeWorldSpace, shareNode.width, shareNode.height, () => {
// 延迟2s退出
cc.tween(this.view.getViewNode()).delay(2).call(() => {
this.onCloseBtnClickCallback();
this._viewProps.shareSuitViewCallback(true);
console.log('ShowShareSuitRolePortrait successCallback');
}).start();
}, () => {
console.log('ShowShareSuitRolePortrait successCheckCallback: ', this._onShow);
return this._onShow;
}, () => {
console.log('ShowShareSuitRolePortrait shareFailCallback');
this._viewProps.shareSuitViewCallback(false);
UIManager_1.UIManager.showSceneToast("自动截图失败,请升级微信哦~");
this.onCloseBtnClickCallback();
}, () => {
console.log('ShowShareSuitRolePortrait failCallback');
this._viewProps.shareSuitViewCallback(false);
UIManager_1.UIManager.showSceneToast("自动截图失败,请稍后重试哦~");
this.onCloseBtnClickCallback();
}, () => {
console.log('ShowShareSuitRolePortrait completeCallback');
});
// CCWechatScreenShotMgr.getInstance().shotFullScreen(
// () => { // successCallback
// // 延迟2s退出
// cc.tween(this.view.getViewNode()).delay(2).call(() => {
// this.onCloseBtnClickCallback();
// this._viewProps.shareSuitViewCallback(true);
// console.log('ShowShareSuitRolePortrait successCallback');
// }).start();
// },
// (): boolean => { // successCheckCallback
// console.log('ShowShareSuitRolePortrait successCheckCallback: ', this._onShow);
// return this._onShow;
// },
// () => { // shareFailCallback
// console.log('ShowShareSuitRolePortrait shareFailCallback');
// this._viewProps.shareSuitViewCallback(false);
// UIManager.showSceneToast("自动截图失败,请升级微信哦~");
// this.onCloseBtnClickCallback();
// },
// () => { // failCallback
// console.log('ShowShareSuitRolePortrait failCallback');
// this._viewProps.shareSuitViewCallback(false);
// UIManager.showSceneToast("自动截图失败,请稍后重试哦~");
// this.onCloseBtnClickCallback();
// },
// () => { // completeCallback
// console.log('ShowShareSuitRolePortrait completeCallback');
// }
// );
}
};
ShareSuitViewPresenter.uuid = "ShareSuitViewPresenter";
ShareSuitViewPresenter = __decorate([
PresenterCCViewFactory_1.RegPresenter(ShareSuitView_1.ShareSuitViewType)
], ShareSuitViewPresenter);
return ShareSuitViewPresenter;
})();
exports.default = ShareSuitViewPresenter;
cc._RF.pop();