update
This commit is contained in:
@@ -6,6 +6,7 @@ import { WebSDK } from "./webSDK";
|
||||
import { KSSDK } from "./ksSDK";
|
||||
import AudioManager from "../Manager/AudioManager";
|
||||
import GlobalValue, { VideoRoleType } from "../Common/GlobalValue";
|
||||
import { luffaSDK } from "./luffaSDK";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -94,7 +95,7 @@ export class SDKManager { //extends Component
|
||||
this.sdk = new KSSDK() //快手
|
||||
}else if (sys.platform === sys.Platform.WECHAT_GAME && typeof window["wx"] !== 'undefined') {
|
||||
this.sdk_channel = E_SDK_Channel.WX
|
||||
this.sdk = new WXSDK() //微信
|
||||
this.sdk = new luffaSDK() //微信
|
||||
} else if (sys.platform === sys.Platform.BYTEDANCE_MINI_GAME && typeof window["tt"] !== 'undefined') {
|
||||
this.sdk_channel = E_SDK_Channel.BD
|
||||
this.sdk = new ByteDanceSDK() //抖音(头条)
|
||||
|
||||
@@ -0,0 +1,964 @@
|
||||
import { randomRange, view } from "cc";
|
||||
import GlobalValue, { VideoRoleType } from "../Common/GlobalValue";
|
||||
import SubManager from "../../Sub/SubManager";
|
||||
import { I_SDK_UserInfo_Callback, SDKManager } from "./SDKManager";
|
||||
import Utils from "../Common/Utils";
|
||||
import uma from "../../../utils/uma.wx.min.js";
|
||||
import { InnerMsgCode } from "../Config/InnerMsgCode";
|
||||
|
||||
//广告ID
|
||||
const wx_banner_ad_unit_id = "test";
|
||||
const wx_splash_ad_unit_id = "test";
|
||||
const wx_video_ad_unit_id = "adunit-a79e037dfaac7bae";
|
||||
|
||||
export class luffaSDK {
|
||||
static g_InGameScene = null; //游戏场景值
|
||||
|
||||
private wx_video: any = null;
|
||||
private wx_splash: any = null;
|
||||
private wx_banner: any = null;
|
||||
private wx_video_callback: Function = null;
|
||||
private wx_video_tag: number = null;
|
||||
private wx_gameClub: any = null; //游戏圈按钮
|
||||
|
||||
private ShareSTime: any;
|
||||
private ShareCb: any; //分享回调
|
||||
private shareTxt = [
|
||||
"分享失败",
|
||||
"请分享到一个群",
|
||||
"请分享给一位好友",
|
||||
"分享过于频繁",
|
||||
];
|
||||
|
||||
//初始化
|
||||
init(cb: Function = null) {
|
||||
// 保持屏幕常亮
|
||||
window["wx"].setKeepScreenOn({ keepScreenOn: true });
|
||||
luffaSDK.g_InGameScene = window["wx"].getLaunchOptionsSync().scene;
|
||||
console.log("init luffa - 进入游戏的场景值", luffaSDK.g_InGameScene);
|
||||
|
||||
//this.init_video(); //初始化视频广告
|
||||
//this.init_splash(); //初始化插屏广告
|
||||
//this.init_banner(); //初始化Banner广告 横幅广告
|
||||
this.qiangzhiUpdata(); //检测更新
|
||||
cb && cb();
|
||||
}
|
||||
|
||||
/**获取用户授权状态
|
||||
* @param autoKey string 授权类型 userInfo=用户信息,对应接口wx.getUserInfo
|
||||
*/
|
||||
checkAutoSetting(autoKey: string, cb: Function = null) {
|
||||
window["wx"].getSetting({
|
||||
success(res: any) {
|
||||
console.log("微信 - 检测权限状态 succ:", JSON.stringify(res));
|
||||
if (autoKey == "userInfo" && res.authSetting["scope.userInfo"]) {
|
||||
cb && cb(true);
|
||||
} else {
|
||||
cb && cb(false);
|
||||
}
|
||||
},
|
||||
fail(res: any) {
|
||||
console.log("微信 - 检测权限状态 fail:", JSON.stringify(res));
|
||||
cb && cb(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人信息
|
||||
*/
|
||||
getUserInfo(cb: I_SDK_UserInfo_Callback = null) {
|
||||
console.log("微信 - 正在获取用户信息...");
|
||||
var self = this;
|
||||
window["wx"].getUserInfo({
|
||||
success: (res) => {
|
||||
console.log("微信 - 获取用户信息成功:", res);
|
||||
cb &&
|
||||
cb({
|
||||
avatarUrl: res.userInfo.avatarUrl,
|
||||
nickName: res.userInfo.nickName,
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log("微信 - 获取用户信息失败:", err);
|
||||
self.openUserAuthorize(cb);
|
||||
},
|
||||
});
|
||||
}
|
||||
//申请用户信息授权
|
||||
openUserAuthorize(cb: any) {
|
||||
var self = this;
|
||||
window["wx"].getSetting({
|
||||
scope: "scope.userInfo",
|
||||
success(res: any) {
|
||||
console.log("微信 authorize succ:", JSON.stringify(res));
|
||||
|
||||
if (res.authSetting["scope.userInfo"]) {
|
||||
self.getUserInfo(cb);
|
||||
} else {
|
||||
let systemInfo = window["wx"].getSystemInfoSync();
|
||||
let button = window["wx"].createUserInfoButton({
|
||||
type: "text",
|
||||
text: "",
|
||||
// @ts-ignore
|
||||
style: {
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: systemInfo.screenWidth,
|
||||
height: systemInfo.screenHeight,
|
||||
backgroundColor: "#00000000", //最后两位为透明度
|
||||
textAlign: "center",
|
||||
},
|
||||
});
|
||||
console.log("微信 点击开始游戏授权用户信息");
|
||||
button.onTap((res) => {
|
||||
button.destroy();
|
||||
// if (res.userInfo) {
|
||||
// console.log(res.userInfo)
|
||||
// //此时可进行登录操作
|
||||
// cb && cb(res.userInfo)
|
||||
// }
|
||||
console.log("微信 点击Tap", res);
|
||||
self.getUserInfo(cb);
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.log("微信 - authorize fail", err);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
//region 微信登录
|
||||
login(cb: Function = null) {
|
||||
window["wx"].login({
|
||||
success: (res) => {
|
||||
if (res.code) {
|
||||
console.log("微信 - 登录成功", res.code);
|
||||
cb && cb({ platform: 1, code: res.code });
|
||||
} else {
|
||||
console.log("微信 - 登录失败", res.errMsg);
|
||||
cb && cb({ platform: 1, code: null });
|
||||
}
|
||||
},
|
||||
fail(res: any) {
|
||||
console.log(`微信 login 调用失败`);
|
||||
console.log(res.anonymousCode);
|
||||
cb && cb({ platform: 1, code: null });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
//初始化视频广告
|
||||
private init_video() {
|
||||
if ((wx_video_ad_unit_id as any) == "test") {
|
||||
console.log("微信 激励广告id未配置,跳过此类型初始化");
|
||||
return;
|
||||
}
|
||||
|
||||
this.wx_video = window["wx"].createRewardedVideoAd({
|
||||
adUnitId: wx_video_ad_unit_id,
|
||||
disableFallbackSharePage: true, // 是否禁用分享页,默认为false
|
||||
});
|
||||
this.wx_video.onLoad(() => {
|
||||
console.log("onLoad event emit");
|
||||
});
|
||||
this.wx_video.onError((err) => {
|
||||
console.log("onError event emit", err);
|
||||
});
|
||||
this.wx_video.onClose((res) => {
|
||||
console.log("onClose event emit", res);
|
||||
// 用户点击了【关闭广告】按钮
|
||||
// 小于 2.1.0 的基础库版本,res 是一个 undefined
|
||||
if ((res && res.isEnded) || res === undefined) {
|
||||
// 正常播放结束,可以下发游戏奖励
|
||||
if (this.wx_video_callback) {
|
||||
this.wx_video_callback(this.wx_video_tag);
|
||||
}
|
||||
} else {
|
||||
// 播放中途退出,不下发游戏奖励
|
||||
//wx_video_callback(-1);
|
||||
}
|
||||
SDKManager.video_ad_back();
|
||||
});
|
||||
}
|
||||
|
||||
//初始化插屏广告
|
||||
private init_splash() {
|
||||
if ((wx_splash_ad_unit_id as any) == "test") {
|
||||
console.log("微信 插屏广告id未配置,跳过此类型初始化");
|
||||
return;
|
||||
}
|
||||
// 创建插屏广告实例,提前初始化
|
||||
if (window["wx"].createInterstitialAd) {
|
||||
this.wx_splash = window["wx"].createInterstitialAd({
|
||||
adUnitId: wx_splash_ad_unit_id,
|
||||
});
|
||||
this.wx_splash.onLoad(() => {
|
||||
console.log("splash onLoad event emit");
|
||||
});
|
||||
this.wx_splash.onError((err) => {
|
||||
console.log("splash onError event emit", err);
|
||||
});
|
||||
this.wx_splash.onClose((res) => {
|
||||
console.log("splash onClose event emit", res);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//初始化Banner
|
||||
private init_banner() {
|
||||
if ((wx_banner_ad_unit_id as any) == "test") {
|
||||
console.log("微信 横幅广告id未配置,跳过此类型初始化");
|
||||
return;
|
||||
}
|
||||
let winSize = window["wx"].getSystemInfoSync();
|
||||
let bannerHeight = 80;
|
||||
let bannerWidth = 300;
|
||||
this.wx_banner = window["wx"].createBannerAd({
|
||||
adUnitId: wx_banner_ad_unit_id,
|
||||
adIntervals: 30,
|
||||
style: {
|
||||
left: (winSize.windowWidth - bannerWidth) / 2,
|
||||
top: winSize.windowHeight - bannerHeight,
|
||||
width: bannerWidth,
|
||||
},
|
||||
});
|
||||
//微信缩放后得到banner的真实高度,从新设置banner的top 属性
|
||||
this.wx_banner.onResize((res) => {
|
||||
this.wx_banner.style.top =
|
||||
winSize.windowHeight - this.wx_banner.style.realHeight;
|
||||
});
|
||||
|
||||
this.wx_banner.onError((res) => {});
|
||||
}
|
||||
|
||||
//region 广告
|
||||
//显示视频广告
|
||||
show_video(callback: Function, tag: number) {
|
||||
if ((wx_video_ad_unit_id as any) == "test") {
|
||||
console.log("未接入广告ID,视频广告请求直接返回");
|
||||
callback && callback();
|
||||
SDKManager.video_ad_back();
|
||||
return;
|
||||
}
|
||||
if (this.wx_video) {
|
||||
this.wx_video_callback = callback;
|
||||
this.wx_video_tag = tag;
|
||||
this.wx_video.load().then(() => {
|
||||
this.wx_video.show().catch((err) => {
|
||||
this.wx_video.load().then(() => this.wx_video.show());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//显示插屏
|
||||
show_splash() {
|
||||
// 在适合的场景显示插屏广告
|
||||
// if (this.wx_splash) {
|
||||
// this.wx_splash.show().catch((err) => {
|
||||
// this.wx_splash.load().then(()=>{
|
||||
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
if (this.wx_splash) {
|
||||
this.wx_splash
|
||||
.load()
|
||||
.then(() => {
|
||||
this.wx_splash.show();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//显示Banner
|
||||
show_banner() {
|
||||
if (this.wx_banner) {
|
||||
this.wx_banner.show(); //banner 默认隐藏(hide) 要打开
|
||||
}
|
||||
}
|
||||
|
||||
//隐藏Banner
|
||||
hide_banner() {
|
||||
if (this.wx_banner) {
|
||||
this.wx_banner.hide(); //banner 默认隐藏(hide) 要打开
|
||||
}
|
||||
}
|
||||
|
||||
//region 分享
|
||||
/**分享图片*/
|
||||
private SharePicAry = [
|
||||
{
|
||||
id: "7wUnG0FFQry/nCdxI9kKYQ==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/W9Az4zfwkAvic2MPaoBEdYEMVht0VwJv6eQF2myMU8IIFbQAZ92Fg73Qp9MUdPMj8/0",
|
||||
},
|
||||
{
|
||||
id: "NCa1cR9YSWinaozMovG6kQ==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/uRnpa1JW3rTyYxQHVUI2OaUmHZStMSWfoXPpx7AgceIN2EuqE2DRicDNjcBTA7arK/0",
|
||||
},
|
||||
{
|
||||
id: "adU43/q3Te+86ThFH+8R+g==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/fVu8XV4rOQv0iaLzIr4m67DZAOgN1NDe7jSCDoT2ibHuqRkacaeHCdCopIgLzrlBibR/0",
|
||||
},
|
||||
{
|
||||
id: "k93MB1OQQzGuHDv6LhlJ4g==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/rrYFeia8mywog7QfGagj9Uiad5Sicu3qNhV6IQcgVkZbUjibaWe70SUsvp9vNESBpje7/0",
|
||||
},
|
||||
{
|
||||
id: "/ry07TA6SXea+AoABH1D+w==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/f0cXVicm8xoT33Txqf2o2CRyreAicOiaHh8JFlbxHaDibYWZoBulHTF9v1s3EaUWfaMk/0",
|
||||
},
|
||||
{
|
||||
id: "hYrwZorvQaOP3XbbC77PZw==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/HEsiaI4wLnb2SVCthB5pZeBULvWsk71EdlK1WUXic23cPuzeWribbjibjlebOPyNy1wL/0",
|
||||
},
|
||||
{
|
||||
id: "nzn7R/iLQoerxHhYbEM6AQ==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/fxaAdTaO5GvRicwozj7sfUiat1ef3XLgjicLLZpeJYWtjyBjIhfh7TP2aZzOItwlpff/0",
|
||||
},
|
||||
{
|
||||
id: "RvJk1ZZzR1iwqKvI39Rt8w==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/WibiboKxDQsGxnVMhxebwvouMGnn5MKJibF18lS1iaibo1yrWnoTJgPAIgVX3dZEkV0Ta/0",
|
||||
},
|
||||
{
|
||||
id: "6OgcDWd5SI2R2SmnOxs3Gw==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/bpd6RQyPEB7xsoqyzribiaGnibELo6xARRPSLsgtickwcMHtSv920nweBbxIG7OiaJXFo/0",
|
||||
},
|
||||
{
|
||||
id: "6qb2SmFBRgi3pv+pUIbulA==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/LXCSUXdVagducqPcChicS5yQWqna7oduKCnzwlG11a7W1Lx6Rwv4Y1tBsMVWqP4Fs/0",
|
||||
},
|
||||
{
|
||||
id: "rdrtaMpJTd6CtMI3dJikHg==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/Zzc9s1q36erWTkUxLDjqOus62PTTysBW4PGUaDO5Pr67kT3g9W3HlMakBSiaicxGdH/0",
|
||||
},
|
||||
{
|
||||
id: "sflrnBurRxC2dow0iuQNEg==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/YiacDpfxzCGbXUHmtMmcfr8gIF7DicDib6q0pJaiaWXbTWOBGkCbpeuMic1SMgr91v43K/0",
|
||||
},
|
||||
{
|
||||
id: "GkB88GpmR6KvjrV3yMxeWA==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/f4fzfIKfgFIBFWxjsFibMUHKQA72JutALOXbuM3vaS0W9ZSUjC2rysb5Tic23lQb95/0",
|
||||
},
|
||||
{
|
||||
id: "UxAhraIxTayr/3Mdhi0Uzg==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/qDv24VqH6NBBP0IXNJ2EbSScIic6WsX0KcLJSNs1ThibYJx6QnDnKIT59CcIQSnZvD/0",
|
||||
},
|
||||
{
|
||||
id: "ISSkaxiBRhyn3yZh2AS0eQ==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/22HxqYDEUu1yelwdMR30ntjn6rzaYf8QJgrOkFlteicoqbacSptHiaNgK7cygteg99/0",
|
||||
},
|
||||
{
|
||||
id: "m0GQ8b4YTU2u1So1Wr9Rjg==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/D8nvAYkIticAEYwTBb3uC83TVferTkpqU5Akj8XGwPCYfNZibTeunZVd5ticqHxvgHC/0",
|
||||
},
|
||||
{
|
||||
id: "F6j57H82QyyiD1i0MaS+0g==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/FtniagLR3ueTRx3ibhy98G6pGdC69A38n9jUrVFHEhL9gqceaUnaTpmQHkiaPU1JE4h/0",
|
||||
},
|
||||
{
|
||||
id: "dqd9Gfx2QGKilvChFwoc7Q==",
|
||||
url: "https://mmocgame.qpic.cn/wechatgame/yauvGchcicTl0zx4dYqfhAxl40k7ZbVM59VbPjDPcouesWbPrpsFQzNvfsSUYwUkb/0",
|
||||
},
|
||||
];
|
||||
|
||||
//分享文本
|
||||
private ShareTextAry = [
|
||||
"话术策略大挑战:十句话让 AI 二次元少女心动!",
|
||||
"心动话术挑战,60 位 AI 女友候选等你 Pick!",
|
||||
"二次元话术相亲模拟!60 位 AI 对象等你攻略!",
|
||||
"全 AI 聊天互动!收集二次元少女的心动信号!",
|
||||
"首款 AI 话术策略游戏,攻略个性 AI 二次元女友!",
|
||||
"锻炼你的话术策略,挑战 AI 女友最速结婚路线!",
|
||||
"直男 or 情话海王?60 位 AI 女友检测话术段位!",
|
||||
"高能话术挑战 60 位 AI 少女,解锁专属甜蜜结局!",
|
||||
];
|
||||
|
||||
//分享信息
|
||||
shareInfo() {
|
||||
let rand1 = Utils.getRandomInt(0, this.SharePicAry.length - 1);
|
||||
let picmap = this.SharePicAry[rand1];
|
||||
let rand2 = Utils.getRandomInt(0, this.ShareTextAry.length - 1);
|
||||
let text = this.ShareTextAry[rand2];
|
||||
console.log("分享:", rand1, rand2);
|
||||
return {
|
||||
title: text,
|
||||
query: "ShareCode=" + "user_default", //ModelPlayer.I.getPlayerId(),
|
||||
imageUrl: picmap.url,
|
||||
imageUrlId: picmap.id,
|
||||
};
|
||||
}
|
||||
//主动拉起分享
|
||||
show_share(rewardCB?: Function) {
|
||||
console.log("主动拉起分享");
|
||||
let info: any = this.shareInfo();
|
||||
info.succ = rewardCB;
|
||||
info.fail = null;
|
||||
this.ShareCb = info;
|
||||
window["wx"].shareAppMessage(info);
|
||||
}
|
||||
|
||||
//获取设备分辨率
|
||||
getWindowSize() {
|
||||
let windowinfo = window["wx"].getWindowInfo();
|
||||
return { width: windowinfo.screenWidth, height: windowinfo.screenHeight };
|
||||
}
|
||||
|
||||
//显示游戏圈
|
||||
show_gameClub(leftRatio, topRatio, widthRatio, heightRatio) {
|
||||
console.log("显示游戏圈");
|
||||
if (this.wx_gameClub) {
|
||||
this.wx_gameClub.show();
|
||||
} else {
|
||||
let windowinfo = window["wx"].getWindowInfo();
|
||||
let x = windowinfo.screenWidth * leftRatio;
|
||||
let y = windowinfo.screenHeight * topRatio;
|
||||
let w = windowinfo.screenWidth * widthRatio; //按钮宽高
|
||||
let h = windowinfo.screenHeight * heightRatio;
|
||||
|
||||
console.log(
|
||||
"游戏圈按钮配置:",
|
||||
windowinfo,
|
||||
leftRatio,
|
||||
topRatio,
|
||||
widthRatio,
|
||||
heightRatio,
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h
|
||||
);
|
||||
this.wx_gameClub = window["wx"].createGameClubButton({
|
||||
type: "string",
|
||||
text: "",
|
||||
// type: 'image',
|
||||
icon: "green",
|
||||
style: {
|
||||
left: x, //这个坐标对应UI上的按钮时,按钮要勾选适配
|
||||
top: y,
|
||||
width: w,
|
||||
height: h,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
//隐藏游戏圈
|
||||
hide_gameClub() {
|
||||
console.log("隐藏游戏圈");
|
||||
if (this.wx_gameClub) {
|
||||
this.wx_gameClub.hide();
|
||||
}
|
||||
}
|
||||
|
||||
//region base64音频播放
|
||||
//检查是否支持base64音频播放
|
||||
checkSupportBase64Audio() {
|
||||
return true;
|
||||
}
|
||||
//播放base64音频
|
||||
private _innerAudioContext: any = null;
|
||||
private _iacIdx = 0; //音频播放索引
|
||||
playBase64Audio(base64, loop) {
|
||||
if (!this.checkSupportBase64Audio()) {
|
||||
console.log("微信平台不支持base64音频播放");
|
||||
return;
|
||||
}
|
||||
|
||||
let substring = base64;
|
||||
let qianzhui = "data:audio/x-wav;base64,";
|
||||
if (base64.startsWith(qianzhui)) {
|
||||
substring = base64.substring(qianzhui.length, base64.length);
|
||||
}
|
||||
|
||||
let self = this;
|
||||
const fs = window["wx"].getFileSystemManager();
|
||||
//1.删除上一个音频
|
||||
const lastPath =
|
||||
window["wx"].env.USER_DATA_PATH + `/ordernew${self._iacIdx}.mp3`;
|
||||
console.log("微信 正在删除上一个音频 ->", lastPath);
|
||||
fs.removeSavedFile({
|
||||
filePath: lastPath,
|
||||
success(res) {
|
||||
console.log("微信 删除上一个音频成功", res);
|
||||
},
|
||||
fail(err) {
|
||||
console.log("微信 删除上一个音频失败", err);
|
||||
},
|
||||
complete(res) {
|
||||
console.log("微信 删除上一个音频完成", res);
|
||||
|
||||
//2.保存当前音频
|
||||
//这里需要每次保存时换一下名字的原因是:innerAudioContext设置路径时如果路径相同,会认为还是同一个音频,不会重新加载,所以需要每次保存时换一下名字
|
||||
self._iacIdx++;
|
||||
const audioPath =
|
||||
window["wx"].env.USER_DATA_PATH + `/ordernew${self._iacIdx}.mp3`;
|
||||
console.log("微信 正在保存本次音频 ->", audioPath);
|
||||
fs.writeFile({
|
||||
filePath: audioPath,
|
||||
data: substring,
|
||||
encoding: "base64",
|
||||
success(res) {
|
||||
if (self._innerAudioContext == null) {
|
||||
self._innerAudioContext = window["wx"].createInnerAudioContext();
|
||||
// 添加播放结束的回调
|
||||
self._innerAudioContext.onEnded(() => {
|
||||
console.log("微信 AI语音播放结束");
|
||||
self._innerAudioContext.stop(); // 使用 stop 方法停止音频并重置播放状态
|
||||
self._innerAudioContext.destroy(); // 销毁音频实例
|
||||
self._innerAudioContext = null;
|
||||
});
|
||||
}
|
||||
console.log("微信 播放base64音频", audioPath);
|
||||
self._innerAudioContext.src = audioPath;
|
||||
self._innerAudioContext.play(); // 开始播放音频
|
||||
},
|
||||
fail(err) {
|
||||
console.log("微信 保存本次音频失败", err);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
//region版本更新检测
|
||||
//微信开发者工具上可以通过「编译模式」下的「下次编译模拟更新」开关来调试
|
||||
qiangzhiUpdata() {
|
||||
const updateManager = window["wx"].getUpdateManager();
|
||||
|
||||
//监听向微信后台请求检查更新结果事件。微信在小程序每次启动(包括热启动)时自动检查更新,不需由开发者主动触发。
|
||||
updateManager.onCheckForUpdate((res) => {
|
||||
// 请求完新版本信息的回调
|
||||
console.log("微信 检查是否有新版本:", res.hasUpdate);
|
||||
});
|
||||
|
||||
//监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
|
||||
updateManager.onUpdateReady(function () {
|
||||
window["wx"].showModal({
|
||||
title: "更新提示",
|
||||
content: "新版本已经准备好,是否重启应用?",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
//监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)时回调
|
||||
updateManager.onUpdateFailed(function (err) {
|
||||
console.log("微信 新版本下载失败", err);
|
||||
});
|
||||
}
|
||||
|
||||
//客服功能是否支持
|
||||
kefuSupport() {
|
||||
if (window["wx"].openCustomerServiceConversation) {
|
||||
return true;
|
||||
}
|
||||
console.log("微信 不支持联系客服");
|
||||
return false;
|
||||
}
|
||||
//进入联系客服
|
||||
openKefu() {
|
||||
let wx = window["wx"];
|
||||
if (wx) {
|
||||
if (!wx.openCustomerServiceConversation) {
|
||||
return;
|
||||
}
|
||||
wx.openCustomerServiceConversation({
|
||||
success: (res) => {
|
||||
const { path, query } = res;
|
||||
console.log("微信 进入客服成功", path, query);
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log("微信 进入客服失败", res);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//region 播放背景视频
|
||||
private _bgVideo: any = null; //正式播放的视频组件
|
||||
private _bgShow: boolean = false;
|
||||
private curPlayType: VideoRoleType = VideoRoleType.None; //当前播放的视频的类型
|
||||
playBgAudio(
|
||||
remoteUrl: string,
|
||||
vtype: VideoRoleType,
|
||||
loop: boolean = false,
|
||||
extra: any = {}
|
||||
) {
|
||||
if (this._bgVideo && this._bgShow) {
|
||||
this.playBgAudioNext(remoteUrl, vtype, loop, extra);
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
console.log("微信 播放背景视频组件1", remoteUrl);
|
||||
this.curPlayType = vtype;
|
||||
if (!this._bgVideo) {
|
||||
this._bgVideo = this.createVideoHandle();
|
||||
// this._bgVideo.onPlay(() => {
|
||||
// console.log("微信 背景视频播放开始");
|
||||
// })
|
||||
this._bgVideo.onTimeUpdate((_tinfo: any) => {
|
||||
// console.log("微信 背景视频播放进度", self._bgShow, _tinfo);
|
||||
if (!self._bgShow) {
|
||||
if (_tinfo && _tinfo.position > 0.01) {
|
||||
console.log("微信 背景视频1进入视野");
|
||||
self.videoMoveIn(self._bgVideo);
|
||||
self._bgShow = true;
|
||||
self.removeBgAudioNext();
|
||||
Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
this._bgVideo.onEnded(() => {
|
||||
if (self.doPlayEmoReadyAudio()) {
|
||||
self.setBgAudioPause(self._bgVideo);
|
||||
}
|
||||
Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, {});
|
||||
});
|
||||
}
|
||||
this._bgVideo.src = remoteUrl; //视频的地址
|
||||
this._bgVideo.loop = loop; //循环播放
|
||||
this._bgVideo.play();
|
||||
}
|
||||
removeBgAudio() {
|
||||
this._bgShow = false;
|
||||
if (this._bgVideo) {
|
||||
this._bgVideo.stop();
|
||||
this.videoMoveOut(this._bgVideo);
|
||||
}
|
||||
}
|
||||
//播放下一个视频,先加载,播放后再转到正式组件上
|
||||
private _bgTempVideo: any = null; //临时视频组件,等加载完成
|
||||
private _bgTempShow: boolean = false;
|
||||
playBgAudioNext(
|
||||
remoteUrl: string,
|
||||
vtype: VideoRoleType,
|
||||
loop: boolean = false,
|
||||
extra: any = {}
|
||||
) {
|
||||
this.removeBgAudioNext();
|
||||
console.log("微信 创建背景视频组件2--->", remoteUrl);
|
||||
this.curPlayType = vtype;
|
||||
let self = this;
|
||||
if (!this._bgTempVideo) {
|
||||
this._bgTempVideo = this.createVideoHandle();
|
||||
// this._bgTempVideo.onPlay(() => {
|
||||
// console.log("微信 临时背景视频播放开始");
|
||||
// })
|
||||
this._bgTempVideo.onTimeUpdate((_tinfo: any) => {
|
||||
// console.log("微信 临时背景视频播放进度", self._bgTempShow, _tinfo);
|
||||
if (!self._bgTempShow) {
|
||||
if (_tinfo && _tinfo.position > 0.01) {
|
||||
console.log("微信 背景视频2进入视野");
|
||||
self._bgTempShow = true;
|
||||
self.videoMoveIn(self._bgTempVideo);
|
||||
self.removeBgAudio();
|
||||
Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
this._bgTempVideo.onEnded(() => {
|
||||
if (self.doPlayEmoReadyAudio()) {
|
||||
self.setBgAudioPause(self._bgTempVideo);
|
||||
}
|
||||
Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, {});
|
||||
});
|
||||
}
|
||||
this._bgTempVideo.src = remoteUrl; //视频的地址
|
||||
this._bgTempVideo.loop = loop; //循环播放
|
||||
this._bgTempVideo.play();
|
||||
}
|
||||
removeBgAudioNext() {
|
||||
this._bgTempShow = false;
|
||||
if (this._bgTempVideo) {
|
||||
this._bgTempVideo.stop();
|
||||
this.videoMoveOut(this._bgTempVideo);
|
||||
}
|
||||
}
|
||||
|
||||
//region 播放emo视频
|
||||
private _emoVideo: any = null; //正式播放的视频组件
|
||||
private _emoShow: boolean = false;
|
||||
addEmoAudio(
|
||||
remoteUrl: string,
|
||||
vtype: VideoRoleType,
|
||||
loop: boolean = false,
|
||||
extra: any = {}
|
||||
) {
|
||||
if (this._emoVideo && this._emoShow) {
|
||||
this.playEmoAudioNext(remoteUrl, vtype, loop, extra);
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
console.log("微信 播放emo视频1", remoteUrl);
|
||||
this.curPlayType = vtype;
|
||||
if (!this._emoVideo) {
|
||||
this._emoVideo = this.createVideoHandle();
|
||||
// this._emoVideo.onPlay(() => {
|
||||
// console.log("微信 背景视频播放开始");
|
||||
// })
|
||||
this._emoVideo.onTimeUpdate((_tinfo: any) => {
|
||||
// console.log("微信 背景视频播放进度", self._emoShow, _tinfo);
|
||||
if (!self._emoShow) {
|
||||
if (_tinfo && _tinfo.position > 0.01) {
|
||||
console.log("微信 emo视频1准备好了");
|
||||
self._emoShow = true;
|
||||
self.removeEmoAudioNext();
|
||||
self.setEmoReadyAudio(self._emoVideo);
|
||||
if (self.curPlayType == VideoRoleType.emo) {
|
||||
self.doPlayEmoReadyAudio();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this._emoVideo.onEnded(() => {
|
||||
self.doEmoFinish();
|
||||
});
|
||||
}
|
||||
this._emoVideo.src = remoteUrl; //视频的地址
|
||||
this._emoVideo.loop = loop; //循环播放
|
||||
this._emoVideo.play();
|
||||
}
|
||||
removeEmoAudio() {
|
||||
this._emoShow = false;
|
||||
if (this._emoVideo) {
|
||||
this._emoVideo.stop();
|
||||
this.videoMoveOut(this._emoVideo);
|
||||
}
|
||||
}
|
||||
//播放下一个视频,先加载,播放后再转到正式组件上
|
||||
private _emoTempVideo: any = null; //临时视频组件,等加载完成
|
||||
private _emoTempShow: boolean = false;
|
||||
playEmoAudioNext(
|
||||
remoteUrl: string,
|
||||
vtype: VideoRoleType,
|
||||
loop: boolean = false,
|
||||
extra: any = {}
|
||||
) {
|
||||
this.removeEmoAudioNext();
|
||||
console.log("微信 播放emo视频2--->", remoteUrl);
|
||||
this.curPlayType = vtype;
|
||||
let self = this;
|
||||
if (!this._emoTempVideo) {
|
||||
this._emoTempVideo = this.createVideoHandle();
|
||||
// this._emoTempVideo.onPlay(() => {
|
||||
// console.log("微信 临时背景视频播放开始");
|
||||
// })
|
||||
this._emoTempVideo.onTimeUpdate((_tinfo: any) => {
|
||||
// console.log("微信 临时背景视频播放进度", self._emoTempShow, _tinfo);
|
||||
if (!self._emoTempShow) {
|
||||
if (_tinfo && _tinfo.position > 0.01) {
|
||||
console.log("微信 emo视频2已准备好");
|
||||
self._emoTempShow = true;
|
||||
self.removeEmoAudio();
|
||||
self.setEmoReadyAudio(self._emoTempVideo);
|
||||
if (self.curPlayType == VideoRoleType.emo) {
|
||||
self.doPlayEmoReadyAudio();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this._emoTempVideo.onEnded(() => {
|
||||
self.doEmoFinish();
|
||||
});
|
||||
}
|
||||
this._emoTempVideo.src = remoteUrl; //视频的地址
|
||||
this._emoTempVideo.loop = loop; //循环播放
|
||||
this._emoTempVideo.play();
|
||||
}
|
||||
removeEmoAudioNext() {
|
||||
this._emoTempShow = false;
|
||||
if (this._emoTempVideo) {
|
||||
this._emoTempVideo.stop();
|
||||
this.videoMoveOut(this._emoTempVideo);
|
||||
}
|
||||
}
|
||||
|
||||
//视频移入屏幕
|
||||
private videoMoveIn(video: any) {
|
||||
let adainfo = this.getVideoAdaInfo();
|
||||
video.x = adainfo.x;
|
||||
video.y = adainfo.y;
|
||||
}
|
||||
//视频移出屏幕
|
||||
private videoMoveOut(video: any) {
|
||||
video.x = 10000;
|
||||
video.y = 10000;
|
||||
}
|
||||
/**创建一个视频播放器 */
|
||||
private createVideoHandle() {
|
||||
let size = this.getWindowSize();
|
||||
let adainfo = this.getVideoAdaInfo();
|
||||
let bgVideo = window["wx"].createVideo({
|
||||
// src: remoteUrl, //视频的地址
|
||||
x: size.width, //先在屏幕外创建,等加载完成后再移动到屏幕上
|
||||
y: size.height,
|
||||
width: this.videoWidth * adainfo.scale, //视频的宽度
|
||||
height: this.videoHeight * adainfo.scale, //视频的高度
|
||||
autoplay: true, //自动播放
|
||||
// loop: loop, //循环播放
|
||||
controls: false, //是否显示控件
|
||||
showProgress: false, //显示进度条
|
||||
showProgressInControlMode: false, //在控制模式下显示进度条
|
||||
enableProgressGesture: false, //是否启用进度手势
|
||||
showCenterPlayBtn: false, //是否显示中间的播放按钮
|
||||
underGameView: true, //视频是否显示在游戏画布之下。需要设置Camera的Clear Color为透明色
|
||||
// backgroundColor: "#00000000", //视频背景颜色
|
||||
objectFit: "fill", //视频的填充模式
|
||||
});
|
||||
return bgVideo;
|
||||
}
|
||||
//获取视频适配信息
|
||||
private videoWidth = 720;
|
||||
private videoHeight = 1280;
|
||||
private videoAdaInfo = null;
|
||||
private getVideoAdaInfo() {
|
||||
if (this.videoAdaInfo) return this.videoAdaInfo;
|
||||
this.videoAdaInfo = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
};
|
||||
let size = this.getWindowSize();
|
||||
let ratiow = size.width / this.videoWidth; //屏幕和视频的宽高比,谁大用谁
|
||||
let ratioh = size.height / this.videoHeight;
|
||||
if (ratiow > ratioh) {
|
||||
this.videoAdaInfo.scale = ratiow;
|
||||
this.videoAdaInfo.x = 0;
|
||||
this.videoAdaInfo.y = -(this.videoHeight * ratiow - size.height) / 2;
|
||||
} else {
|
||||
this.videoAdaInfo.scale = ratioh;
|
||||
this.videoAdaInfo.x = -(this.videoWidth * ratioh - size.width) / 2;
|
||||
this.videoAdaInfo.y = 0;
|
||||
}
|
||||
console.log("微信 视频适配信息", this.videoAdaInfo, size);
|
||||
return this.videoAdaInfo;
|
||||
}
|
||||
|
||||
//设置暂停播放的主视频
|
||||
private vpWait: any = null;
|
||||
setBgAudioPause(wait: any) {
|
||||
console.log("微信 主视频暂停播放");
|
||||
this.vpWait = wait;
|
||||
this.vpWait.pause();
|
||||
}
|
||||
replayBgAudioPause() {
|
||||
console.log("微信 主视频继续播放");
|
||||
if (this.vpWait) {
|
||||
this.vpWait.play();
|
||||
}
|
||||
}
|
||||
|
||||
//设置准备好要播放的表情视频
|
||||
private emoReady: any = null;
|
||||
setEmoReadyAudio(au: any) {
|
||||
console.log("微信 设置emo ready视频");
|
||||
if (this.emoReady) {
|
||||
this.emoReady.stop();
|
||||
this.videoMoveOut(this.emoReady);
|
||||
}
|
||||
this.emoReady = au;
|
||||
this.emoReady.pause();
|
||||
}
|
||||
//移除准备好要播放的表情视频
|
||||
removeEmoReadyAudio() {
|
||||
console.log("微信 移除emo ready视频");
|
||||
if (this.emoReady) {
|
||||
this.emoReady.stop();
|
||||
this.videoMoveOut(this.emoReady);
|
||||
}
|
||||
this.emoReady = null;
|
||||
}
|
||||
//播放准备好要播放的表情视频
|
||||
doPlayEmoReadyAudio(): boolean {
|
||||
if (this.emoReady) {
|
||||
console.log("微信 播放emo ready视频");
|
||||
this.emoReady.play();
|
||||
this.videoMoveIn(this.emoReady);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//表情视频播放结束
|
||||
doEmoFinish() {
|
||||
console.log("微信emo ready视频播放结束");
|
||||
this.removeEmoReadyAudio();
|
||||
this.replayBgAudioPause();
|
||||
}
|
||||
|
||||
//region 微信同声传译
|
||||
// private rrmgr: any = null;
|
||||
// startRecordRecognition() {
|
||||
// console.log("微信 同声传译111")
|
||||
// if (!this.rrmgr) {
|
||||
// const plugin = requirePlugin("WechatSI");
|
||||
// this.rrmgr = plugin.getRecordRecognitionManager();
|
||||
// console.log("微信 同声传译222")
|
||||
|
||||
// // 监听识别结果
|
||||
// this.rrmgr.onRecognize = (res) => {
|
||||
// console.log("微信 同声传译识别结果:", res.result);
|
||||
// };
|
||||
|
||||
// // 监听录音结束
|
||||
// this.rrmgr.onStop = (res) => {
|
||||
// console.log("微信 同声传译录音结束", res);
|
||||
// };
|
||||
// }
|
||||
// this.rrmgr.start({ lang: "zh_CN" });
|
||||
// console.log("微信 同声传译333")
|
||||
// }
|
||||
// stopRecordRecognition() {
|
||||
// if (this.rrmgr) {
|
||||
// this.rrmgr.stop();
|
||||
// console.log("微信 同声传译444")
|
||||
// }
|
||||
// }
|
||||
|
||||
//region 复制到剪贴板
|
||||
/**复制文本到剪贴板 */
|
||||
copyToClipboard(text: string, cb?: Function) {
|
||||
console.log("微信 复制到剪贴板:", text);
|
||||
window["wx"].setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
console.log("微信 复制成功");
|
||||
cb && cb(true);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log("微信 复制失败:", err);
|
||||
cb && cb(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
//region 友盟+
|
||||
//初始化友盟+
|
||||
umaInit() {
|
||||
// window["wx"].uma.init({
|
||||
// appKey: "67c969b99a16fe6dcd5bfec5",
|
||||
// useOpenid: true, // default true
|
||||
// autoGetOpenid: true,
|
||||
// debug: true,
|
||||
// uploadUserInfo: true, // 上传用户信息,上传后可以看到有用户头像和昵称的分享信息
|
||||
// });
|
||||
// console.log("微信 uma 初始化");
|
||||
}
|
||||
//友盟统计是否开启
|
||||
umaSwt() {
|
||||
return true;
|
||||
}
|
||||
//友盟事件统计
|
||||
umaEvent(eventName: string, value: any = {}) {
|
||||
window["wx"].uma.trackEvent(eventName, value);
|
||||
console.log("微信 uma 统计:", eventName, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"0c025735-16d4-4eb8-adc9-5fdfccf35794","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -25,6 +25,7 @@ import LanguageUtils from "../../../Main/Common/LanguageUtils";
|
||||
import { ViewManager } from "../../../Main/Manager/ViewManager";
|
||||
import { TipsPanel } from "./TipsPanel";
|
||||
import ResManager from "../../../Main/Manager/ResManager";
|
||||
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("GirlListPopupPanel")
|
||||
@@ -36,6 +37,7 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
|
||||
private girlName: Label;
|
||||
private girlTag: Label;
|
||||
private balanceCount: Label;
|
||||
|
||||
base: GirlListItem;
|
||||
img: Sprite;
|
||||
@@ -56,6 +58,7 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
|
||||
this.girlName = this._nodeTab.Name.getComponent(Label);
|
||||
this.girlTag = this._nodeTab.Tag.getComponent(Label);
|
||||
this.balanceCount = this._nodeTab.balanceCount.getComponent(Label);
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
// 价格
|
||||
this.priceLabel = this._nodeTab.Price.getComponent(Label);
|
||||
@@ -72,11 +75,11 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
);
|
||||
|
||||
const path = girlData.getGrilAvatar(this.category.toString(), this.girlId);
|
||||
|
||||
this.refreshCoinNum();
|
||||
//console.log(path);
|
||||
// 加载远程资源
|
||||
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
|
||||
let newPath = envData.cdn + "/" + "Girls/" + path + ".png";
|
||||
let newPath = envData.cdn + "/" + "Girls/" + path + ".png";
|
||||
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
|
||||
this.scaleToFillItem();
|
||||
});
|
||||
@@ -84,10 +87,15 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
registerListener() {
|
||||
GButton.BandClick(this._nodeTab.BuyBtn, this.buyCharacter, this);
|
||||
GButton.BandClick(this._nodeTab.CloseBtn, this.Close, this);
|
||||
|
||||
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
|
||||
}
|
||||
Close() {
|
||||
this.close();
|
||||
}
|
||||
onDestroy(): void {
|
||||
Utils.removeInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
|
||||
}
|
||||
async buyCharacter() {
|
||||
// 购买id为girlId的女生
|
||||
console.log(this.girlId);
|
||||
@@ -116,6 +124,15 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
// TipsPanel.show("Insufficient balance, need to purchase");
|
||||
}
|
||||
|
||||
// 刷新余额
|
||||
private refreshCoinNum() {
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
const balance = walletData.getOriginalBalance();
|
||||
this.balanceCount.string = balance.toString();
|
||||
}
|
||||
onBalanceChange = () => {
|
||||
this.refreshCoinNum();
|
||||
};
|
||||
scaleToFillItem() {
|
||||
if (!this.img || !this.img.spriteFrame) return;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
private resId: number;
|
||||
private type: proto.cs.EnmResType;
|
||||
private base: DetailImageItem | ImagePopup;
|
||||
private balanceCount: Label;
|
||||
|
||||
private desc: Label;
|
||||
|
||||
@@ -56,6 +57,8 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
|
||||
this.img = this._nodeTab.img.getComponent(Sprite);
|
||||
let descText = LanguageUtils.getText("popupgirldetailpanel.content");
|
||||
this.balanceCount = this._nodeTab.balanceCount.getComponent(Label);
|
||||
this.refreshCoinNum();
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
// 价格
|
||||
@@ -95,7 +98,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
// 加载远程资源
|
||||
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
|
||||
const path = url + "_thumbnail_blur";
|
||||
let newPath = envData.cdn + "/" + "Girls/" + path + ".jpg";
|
||||
let newPath = envData.cdn + "/" + "Girls/" + path + ".jpg";
|
||||
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
|
||||
this.scaleToFillItem();
|
||||
});
|
||||
@@ -147,7 +150,12 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
TipsPanel.show("Insufficient balance, need to purchase");
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新余额
|
||||
private refreshCoinNum() {
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
const balance = walletData.getOriginalBalance();
|
||||
this.balanceCount.string = balance.toString();
|
||||
}
|
||||
scaleToFillItem() {
|
||||
if (!this.img || !this.img.spriteFrame) return;
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@ export class PurchasePanel extends li_BaseView {
|
||||
}
|
||||
|
||||
createOrRefreshWeb3PayPanel(param: any) {
|
||||
if (param.payType == proto.cs.EnmPayType.EPT_Cash_INR) return;
|
||||
let data = {
|
||||
orderId: param.orderId,
|
||||
payType: param.payType,
|
||||
|
||||
@@ -10,6 +10,7 @@ import { PurchasePanel } from "./PurchasePanel";
|
||||
import { QRCodeGenerator } from "db://assets/utils/qrcodeGenerator";
|
||||
import { TipsPanel } from "./TipsPanel";
|
||||
import { SDKManager } from "../../../Main/Channel/SDKManager";
|
||||
import LanguageUtils from "../../../Main/Common/LanguageUtils";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -108,8 +109,11 @@ export class Web3PopPanel extends li_BaseView {
|
||||
const walletUrl = OrderData.getWalletById(this.orderId);
|
||||
|
||||
const expireTime = OrderData.getExpireById(this.orderId);
|
||||
const retCode = OrderData.getRetCodeById(this.orderId);
|
||||
|
||||
// const retCode = OrderData.getRetCodeById(this.orderId);
|
||||
// if (retCode != 0) {
|
||||
// TipsPanel.show(LanguageUtils.getText("error_code_"+retCode));
|
||||
// return;
|
||||
// }
|
||||
this.expireTimeText.string = expireTime.toString();
|
||||
this.amount.string = amount;
|
||||
this.address.string = walletUrl;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -661,8 +661,8 @@
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0.8,
|
||||
"y": 0.8,
|
||||
"x": 0.82,
|
||||
"y": 0.82,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
@@ -1403,8 +1403,6 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "84tq+XsAhMD7Pf5ZzCDcs4",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5394,7 +5394,7 @@
|
||||
"b": 245,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "ascascasc",
|
||||
"_string": "ascascasca",
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 0,
|
||||
"_actualFontSize": 37,
|
||||
@@ -5932,7 +5932,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 13.932999999999993,
|
||||
"x": 5.254000000000019,
|
||||
"y": 336.22800000000007,
|
||||
"z": 0
|
||||
},
|
||||
@@ -6230,8 +6230,8 @@
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"g": 135,
|
||||
"b": 247,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "label",
|
||||
@@ -6343,7 +6343,7 @@
|
||||
"b": 247,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "expireTime:",
|
||||
"_string": "Expire Time:",
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 36,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "42906726-76e0-4225-9dbf-13c622bfc834",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "42906726-76e0-4225-9dbf-13c622bfc834@6c48a",
|
||||
"displayName": "矩形 3 拷贝 4",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "42906726-76e0-4225-9dbf-13c622bfc834",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "42906726-76e0-4225-9dbf-13c622bfc834@f9941",
|
||||
"displayName": "矩形 3 拷贝 4",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 1029,
|
||||
"height": 114,
|
||||
"rawWidth": 1029,
|
||||
"rawHeight": 114,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-514.5,
|
||||
-57,
|
||||
0,
|
||||
514.5,
|
||||
-57,
|
||||
0,
|
||||
-514.5,
|
||||
57,
|
||||
0,
|
||||
514.5,
|
||||
57,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
114,
|
||||
1029,
|
||||
114,
|
||||
0,
|
||||
0,
|
||||
1029,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-514.5,
|
||||
-57,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
514.5,
|
||||
57,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "42906726-76e0-4225-9dbf-13c622bfc834@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "42906726-76e0-4225-9dbf-13c622bfc834@6c48a"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user