CCWechatScreenShotMgr.js
16 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
128
129
130
131
132
133
134
135
136
137
(function() {
var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
var __module = nodeEnv ? module : {exports:{}};
var __filename = 'preview-scripts/assets/script/common/CCWechatScreenShotMgr.js';
var __require = nodeEnv ? function (request) {
return cc.require(request);
} : function (request) {
return __quick_compile_project__.require(request, __filename);
};
function __define (exports, require, module) {
if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, '30a8a4KflZMb4d4TT1dV25C', 'CCWechatScreenShotMgr');
// script/common/CCWechatScreenShotMgr.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let CCWechatScreenShotMgr = /** @class */ (() => {
class CCWechatScreenShotMgr {
static getInstance() {
return CCWechatScreenShotMgr._instance;
}
/**
*
* @param worldPos 节点的世界坐标
* @param width 节点的宽度
* @param height 节点的高度
*/
doShot(worldPos, width, height, successCallback = () => { }, successCheckCallback = () => false, shareFailCallback = () => { }, failCallback = () => { }, completeCallback = () => { }) {
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
if (!wx.showShareImageMenu) {
console.log("截图失败");
shareFailCallback();
return;
}
const ccCanvas = cc.find("Canvas");
const xscale = (worldPos.x - width / 2) / ccCanvas.width;
const yscale = 1 - (worldPos.y + height / 2) / ccCanvas.height;
let x = canvas.width * xscale;
let y = canvas.height * yscale;
const w = width / ccCanvas.width * canvas.width;
const h = height / ccCanvas.height * canvas.height;
let data = {
x: x,
y: y,
width: w,
height: h,
destWidth: w,
destHeight: h,
fileType: 'png',
quality: 1,
success: (res) => {
if (successCheckCallback() === false) {
console.log("截图界面被关闭");
return;
}
console.log("截图成功");
console.log("res: ", res);
console.log("res.tempFilePath: ", res.tempFilePath);
wx.showShareImageMenu({
path: res.tempFilePath
});
// //分享卡片
// wx.shareAppMessage({
// imageUrl: res.tempFilePath
// })
successCallback();
},
fail: (e) => {
console.log("截图失败");
console.log(e);
failCallback();
},
complete: () => {
console.log("截图完成");
completeCallback();
}
};
let _tempFilePath = canvas.toTempFilePath(data);
cc.log(`Capture file success!${_tempFilePath}`);
}
}
shotFullScreen(successCallback = () => { }, successCheckCallback = () => false, shareFailCallback = () => { }, failCallback = () => { }, completeCallback = () => { }) {
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
//canvas 是微信的,报错不用管
//单纯的分享一张图
if (!wx.showShareImageMenu) {
console.log("截图失败");
shareFailCallback();
return;
}
canvas.toTempFilePath({
success: (res) => {
if (successCheckCallback() === false) {
console.log("截图界面被关闭");
return;
}
console.log("截图成功");
wx.showShareImageMenu({
path: res.tempFilePath
});
// //分享卡片
// wx.shareAppMessage({
// imageUrl: res.tempFilePath
// })
successCallback();
},
fail: (e) => {
console.log("截图失败");
console.log(e);
failCallback();
},
complete: () => {
console.log("截图完成");
completeCallback();
}
});
}
}
}
CCWechatScreenShotMgr._instance = new CCWechatScreenShotMgr();
return CCWechatScreenShotMgr;
})();
exports.default = CCWechatScreenShotMgr;
cc._RF.pop();
}
if (nodeEnv) {
__define(__module.exports, __require, __module);
}
else {
__quick_compile_project__.registerModuleFunc(__filename, function () {
__define(__module.exports, __require, __module);
});
}
})();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFzc2V0cy9zY3JpcHQvY29tbW9uL0NDV2VjaGF0U2NyZWVuU2hvdE1nci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Oz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5jdGlvbiA9ICgpID0+IHt9KSB7XG4gICAgICAgIGlmIChjYy5zeXMucGxhdGZvcm0gPT09IGNjLnN5cy5XRUNIQVRfR0FNRSkge1xuICAgICAgICAgICAgaWYgKCF3eC5zaG93U2hhcmVJbWFnZU1lbnUpIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIuaIquWbvuWksei0pVwiKTtcbiAgICAgICAgICAgICAgICBzaGFyZUZhaWxDYWxsYmFjaygpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IGNjQ2FudmFzID0gY2MuZmluZChcIkNhbnZhc1wiKTtcbiAgICAgICAgICAgIGNvbnN0IHhzY2FsZSA9ICh3b3JsZFBvcy54IC0gd2lkdGggLyAyKSAvIGNjQ2FudmFzLndpZHRoO1xuICAgICAgICAgICAgY29uc3QgeXNjYWxlID0gMSAtICh3b3JsZFBvcy55ICsgaGVpZ2h0IC8gMikgLyBjY0NhbnZhcy5oZWlnaHQ7XG4gICAgICAgICAgICBsZXQgeCA9IGNhbnZhcy53aWR0aCAqIHhzY2FsZTtcbiAgICAgICAgICAgIGxldCB5ID0gY2FudmFzLmhlaWdodCAqIHlzY2FsZTtcbiAgICAgICAgICAgIGNvbnN0IHcgPSB3aWR0aCAvIGNjQ2FudmFzLndpZHRoICogY2FudmFzLndpZHRoO1xuICAgICAgICAgICAgY29uc3QgaCA9IGhlaWdodCAvIGNjQ2FudmFzLmhlaWdodCAqIGNhbnZhcy5oZWlnaHQ7XG4gICAgICAgICAgICBsZXQgZGF0YSA9IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHksXG4gICAgICAgICAgICAgICAgd2lkdGg6IHcsXG4gICAgICAgICAgICAgICAgaGVpZ2h0OiBoLFxuICAgICAgICAgICAgICAgIGRlc3RXaWR0aDogdyxcbiAgICAgICAgICAgICAgICBkZXN0SGVpZ2h0OiBoLFxuICAgICAgICAgICAgICAgIGZpbGVUeXBlOiAncG5nJyxcbiAgICAgICAgICAgICAgICBxdWFsaXR5OiAxLFxuICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IChyZXMpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHN1Y2Nlc3NDaGVja0NhbGxiYWNrKCkgPT09IGZhbHNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIuaIquWbvueVjOmdouiiq+WFs+mXrVwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIuaIquWbvuaIkOWKn1wiKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJyZXM6IFwiLCByZXMpO1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcInJlcy50ZW1wRmlsZVBhdGg6IFwiLCByZXMudGVtcEZpbGVQYXRoKTtcbiAgICAgICAgICAgICAgICAgICAgd3guc2hvd1NoYXJlSW1hZ2VNZW51KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IHJlcy50ZW1wRmlsZVBhdGhcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgIC8v5YiG5Lqr5Y2h54mHXG4gICAgICAgICAgICAgICAgICAgIC8vICAgICB3eC5zaGFyZUFwcE1lc3NhZ2Uoe1xuICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAgIGltYWdlVXJsOiByZXMudGVtcEZpbGVQYXRoXG4gICAgICAgICAgICAgICAgICAgIC8vICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3NDYWxsYmFjaygpO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZmFpbDogKGUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCLmiKrlm77lpLHotKVcIik7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGUpO1xuICAgICAgICAgICAgICAgICAgICBmYWlsQ2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGNvbXBsZXRlOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwi5oiq5Zu+5a6M5oiQXCIpO1xuICAgICAgICAgICAgICAgICAgICBjb21wbGV0ZUNhbGxiYWNrKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGV0IF90ZW1wRmlsZVBhdGggPSBjYW52YXMudG9UZW1wRmlsZVBhdGgoZGF0YSk7XG4gICAgICAgICAgICBjYy5sb2coYENhcHR1cmUgZmlsZSBzdWNjZXNzISR7X3RlbXBGaWxlUGF0aH1gKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNob3RGdWxsU2NyZWVuIChcbiAgICAgICAgc3VjY2Vzc0NhbGxiYWNrOiBGdW5jdGlvbiA9ICgpID0+IHt9LFxuICAgICAgICBzdWNjZXNzQ2hlY2tDYWxsYmFjazogKCkgPT4gYm9vbGVhbiA9ICgpID0+IGZhbHNlICxcbiAgICAgICAgc2hhcmVGYWlsQ2FsbGJhY2s6IEZ1bmN0aW9uID0gKCkgPT4ge30sXG4gICAgICAgIGZhaWxDYWxsYmFjazogRnVuY3Rpb24gPSAoKSA9PiB7fSxcbiAgICAgICAgY29tcGxldGVDYWxsYmFjazogRnVuY3Rpb24gPSAoKSA9PiB7fSkge1xuXG4gICAgICAgIGlmIChjYy5zeXMucGxhdGZvcm0gPT09IGNjLnN5cy5XRUNIQVRfR0FNRSkge1xuICAgICAgICAgICAgLy9jYW52YXMg5piv5b6u5L+h55qE77yM5oql6ZSZ5LiN55So566hXG4gICAgICAgICAgICAvL+WNlee6r+eahOWIhuS6q+S4gOW8oOWbvlxuICAgICAgICAgICAgaWYgKCF3eC5zaG93U2hhcmVJbWFnZU1lbnUpIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIuaIquWbvuWksei0pVwiKTtcbiAgICAgICAgICAgICAgICBzaGFyZUZhaWxDYWxsYmFjaygpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhbnZhcy50b1RlbXBGaWxlUGF0aCh7XG4gICAgICAgICAgICAgICAgc3VjY2VzczogKHJlcykgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc3VjY2Vzc0NoZWNrQ2FsbGJhY2soKSA9PT0gZmFsc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwi5oiq5Zu+55WM6Z2i6KKr5YWz6ZetXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwi5oiq5Zu+5oiQ5YqfXCIpO1xuICAgICAgICAgICAgICAgICAgICB3eC5zaG93U2hhcmVJbWFnZU1lbnUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogcmVzLnRlbXBGaWxlUGF0aFxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAvLyAgICAgLy/liIbkuqvljaHniYdcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgIHd4LnNoYXJlQXBwTWVzc2FnZSh7XG4gICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgaW1hZ2VVcmw6IHJlcy50ZW1wRmlsZVBhdGhcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgfSlcbiAgICAgICAgICAgICAgICAgICAgc3VjY2Vzc0NhbGxiYWNrKCk7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBmYWlsOiAoZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIuaIquWbvuWksei0pVwiKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZSk7XG4gICAgICAgICAgICAgICAgICAgIGZhaWxDYWxsYmFjaygpO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgY29tcGxldGU6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCLmiKrlm77lrozmiJBcIik7XG4gICAgICAgICAgICAgICAgICAgIGNvbXBsZXRlQ2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgfVxufVxuIl19