From de0c97fc05ce98d99e2d84dadacea9d22900fad1 Mon Sep 17 00:00:00 2001 From: xlj <543978819@qq.com> Date: Thu, 18 Sep 2025 23:33:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=A1=B5=E9=9D=A2=20qrcode?= =?UTF-8?q?=E7=94=9F=E6=88=90=EF=BC=8C=E5=89=AA=E8=B4=B4=E6=9D=BFsdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scripts/Main/Channel/SDKManager.ts | 11 + assets/Scripts/Main/Channel/bdSDK.ts | 19 +- assets/Scripts/Main/Channel/ksSDK.ts | 18 +- assets/Scripts/Main/Channel/webSDK.ts | 620 +++--- assets/Scripts/Main/Channel/wxSDK.ts | 1883 +++++++++-------- assets/Scripts/Sub/UI/PreloadUI.ts | 5 +- .../chat18x/ui/panels/PurchasePanel.ts | 29 +- .../Scripts/chat18x/ui/panels/Web3PopPanel.ts | 31 +- assets/Scripts/test.meta | 9 + assets/Scripts/test/QRCodeGeneratorTest.ts | 126 ++ .../Scripts/test/QRCodeGeneratorTest.ts.meta | 9 + assets/bundles/Chat18x/PurchasePanel.prefab | 1376 +++++++----- assets/bundles/Chat18x/Web3PopPanel.prefab | 665 +++++- .../ui/shop/coin/{2001.png => 1001.png} | Bin .../coin/{2001.png.meta => 1001.png.meta} | 4 +- .../ui/shop/coin/{2002.png => 1002.png} | Bin .../coin/{2002.png.meta => 1002.png.meta} | 4 +- .../ui/shop/coin/{2003.png => 1003.png} | Bin .../coin/{2003.png.meta => 1003.png.meta} | 4 +- .../ui/shop/coin/{2004.png => 1004.png} | Bin .../coin/{2004.png.meta => 1004.png.meta} | 4 +- .../ui/shop/coin/{2005.png => 1005.png} | Bin .../coin/{2005.png.meta => 1005.png.meta} | 4 +- .../ui/shop/coin/{2006.png => 1006.png} | Bin .../coin/{2006.png.meta => 1006.png.meta} | 4 +- assets/utils/qrcodeGenerator.ts | 208 ++ assets/utils/qrcodeGenerator.ts.meta | 9 + package-lock.json | 9 +- package.json | 3 +- 29 files changed, 3202 insertions(+), 1852 deletions(-) create mode 100644 assets/Scripts/test.meta create mode 100644 assets/Scripts/test/QRCodeGeneratorTest.ts create mode 100644 assets/Scripts/test/QRCodeGeneratorTest.ts.meta rename assets/resources/ui/shop/coin/{2001.png => 1001.png} (100%) rename assets/resources/ui/shop/coin/{2001.png.meta => 1001.png.meta} (97%) rename assets/resources/ui/shop/coin/{2002.png => 1002.png} (100%) rename assets/resources/ui/shop/coin/{2002.png.meta => 1002.png.meta} (97%) rename assets/resources/ui/shop/coin/{2003.png => 1003.png} (100%) rename assets/resources/ui/shop/coin/{2003.png.meta => 1003.png.meta} (97%) rename assets/resources/ui/shop/coin/{2004.png => 1004.png} (100%) rename assets/resources/ui/shop/coin/{2004.png.meta => 1004.png.meta} (97%) rename assets/resources/ui/shop/coin/{2005.png => 1005.png} (100%) rename assets/resources/ui/shop/coin/{2005.png.meta => 1005.png.meta} (97%) rename assets/resources/ui/shop/coin/{2006.png => 1006.png} (100%) rename assets/resources/ui/shop/coin/{2006.png.meta => 1006.png.meta} (97%) create mode 100644 assets/utils/qrcodeGenerator.ts create mode 100644 assets/utils/qrcodeGenerator.ts.meta diff --git a/assets/Scripts/Main/Channel/SDKManager.ts b/assets/Scripts/Main/Channel/SDKManager.ts index 2d078878..990a6ebc 100644 --- a/assets/Scripts/Main/Channel/SDKManager.ts +++ b/assets/Scripts/Main/Channel/SDKManager.ts @@ -314,6 +314,17 @@ export class SDKManager { //extends Component } + //region 复制到剪贴板 + /**复制文本到剪贴板 */ + static copyToClipboard(text: string, cb?: Function) { + if (this.sdk.copyToClipboard) { + this.sdk.copyToClipboard(text, cb); + } else { + Utils.Log("当前平台不支持复制功能"); + cb && cb(false); + } + } + //region 友盟+ static Uma_Event_TalkRound = "_um.talk.round"; //聊天轮次 static Uma_Event_LvUnlock = "_um.lv.unlock"; //解锁新关卡 diff --git a/assets/Scripts/Main/Channel/bdSDK.ts b/assets/Scripts/Main/Channel/bdSDK.ts index fde79e28..d0b1ff4f 100644 --- a/assets/Scripts/Main/Channel/bdSDK.ts +++ b/assets/Scripts/Main/Channel/bdSDK.ts @@ -569,7 +569,24 @@ export class ByteDanceSDK{ } - + + //region 复制到剪贴板 + /**复制文本到剪贴板 */ + copyToClipboard(text: string, cb?: Function) { + console.log("抖音 复制到剪贴板:", text); + window['tt'].setClipboardData({ + data: text, + success: () => { + console.log("抖音 复制成功"); + cb && cb(true); + }, + fail: (err) => { + console.log("抖音 复制失败:", err); + cb && cb(false); + } + }); + } + //region 友盟+ umaInit() { } diff --git a/assets/Scripts/Main/Channel/ksSDK.ts b/assets/Scripts/Main/Channel/ksSDK.ts index ad752ec1..85df3766 100644 --- a/assets/Scripts/Main/Channel/ksSDK.ts +++ b/assets/Scripts/Main/Channel/ksSDK.ts @@ -761,7 +761,23 @@ export class KSSDK{ this.replayBgAudioPause() } - + //region 复制到剪贴板 + /**复制文本到剪贴板 */ + copyToClipboard(text: string, cb?: Function) { + console.log("快手 复制到剪贴板:", text); + window['ks'].setClipboardData({ + data: text, + success: () => { + console.log("快手 复制成功"); + cb && cb(true); + }, + fail: (err) => { + console.log("快手 复制失败:", err); + cb && cb(false); + } + }); + } + //region 友盟+ umaInit() { } diff --git a/assets/Scripts/Main/Channel/webSDK.ts b/assets/Scripts/Main/Channel/webSDK.ts index cfa6213b..d1620f9d 100644 --- a/assets/Scripts/Main/Channel/webSDK.ts +++ b/assets/Scripts/Main/Channel/webSDK.ts @@ -7,290 +7,380 @@ import Utils from "../Common/Utils"; import { InnerMsgCode } from "../Config/InnerMsgCode"; import { VideoRoleType } from "../Common/GlobalValue"; -export class WebSDK{ +export class WebSDK { + //初始化 + init(cb: Function = null) { + console.log("init webSDK"); + cb && cb(); + } - //初始化 - init(cb: Function = null) { - console.log("init webSDK"); - cb && cb(); - } + //检查权限 + checkAutoSetting(autoKey: string, cb: Function = null) { + cb && cb(true); + } - //检查权限 - checkAutoSetting(autoKey:string, cb:Function = null) { - cb && cb(true); - } + //获取用户信息 + getUserInfo(cb: Function = null) { + let name = HttpUnit.GetNickName(); + cb && + cb({ + nickName: name, + avatarUrl: "https://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/webHead.png", + }); + } - //获取用户信息 - getUserInfo(cb:Function = null) { - let name = HttpUnit.GetNickName(); - cb && cb({ nickName:name, avatarUrl:"https://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/webHead.png" }); + //region 登录 + login(cb: Function = null) { + cb && cb({ platform: 2, code: null }); + } + + //显示视频广告 + show_video(callback: Function, tag: number) { + callback && callback({ code: 0, tag: tag }); + SDKManager.video_ad_back(); + } + + //显示插屏 + show_splash() {} + + //显示Banner + show_banner(...args) {} + + //隐藏Banner + hide_banner(...args) {} + + //主动拉起分享 + show_share(rewardCB?: Function) { + rewardCB && rewardCB(); + } + + //获取设备分辨率 + getWindowSize() { + return { width: screen.width, height: screen.height }; + } + + //显示游戏圈 + show_gameClub(leftRatio, topRatio, widthRatio, heightRatio) {} + //隐藏游戏圈 + hide_gameClub() {} + + //检查是否支持base64音频播放 + checkSupportBase64Audio() { + return true; + } + //播放base64音频 + private _audioInst: HTMLAudioElement = null; + playBase64Audio(base64: string, loop: boolean) { + let substring = base64; + let qianzhui = "data:audio/x-wav;base64,"; + if (base64.startsWith(qianzhui)) { + substring = base64.substring(qianzhui.length, base64.length); } - //region 登录 - login(cb: Function = null) { - cb && cb({ platform:2, code: null }); + // 解码 Base64 字符串为二进制数据 + const binaryData = atob(substring); + + // 创建一个包含二进制数据的 Uint8Array + const byteArray = new Uint8Array(binaryData.length); + for (let i = 0; i < binaryData.length; i++) { + byteArray[i] = binaryData.charCodeAt(i); } - //显示视频广告 - show_video(callback:Function, tag:number) { - callback && callback({ code: 0, tag: tag }); - SDKManager.video_ad_back(); + // 创建 Blob 对象,指定 MIME 类型为音频格式(例如 mp3) + const audioBlob = new Blob([byteArray], { type: "audio/mp3" }); + + // 创建音频 URL + const audioUrl = URL.createObjectURL(audioBlob); + + console.log("web 播放base64音频", audioUrl); + // 创建音频元素并播放 + if (this._audioInst == null) { + this._audioInst = new Audio(audioUrl); + } else { + this._audioInst.src = audioUrl; + } + this._audioInst.play(); + } + + //客服功能是否支持 + kefuSupport() { + console.log("web 不支持联系客服"); + return false; + } + //进入联系客服 + openKefu() { + console.log("web 进入联系客服"); + } + + //region 播放主背景视频 + private zhuVideo1: BgVideo | null = null; + private zhuExtra1: any = null; + playBgAudio( + remoteUrl: string, + vtype: VideoRoleType, + loop: boolean = false, + extra: any = {} + ) { + let bgvideo = SceneBgVideoLayer.handle; + if (!bgvideo) { + return; } - //显示插屏 - show_splash() { - - + this.initBgAudio(); + if (this.zhuVideo1 && this.zhuVideo1.isPlaying) { + this.playBgAudioNext(remoteUrl, vtype, loop, extra); + return; } - //显示Banner - show_banner(...args) { - + if (!this.zhuVideo1) { + this.zhuVideo1 = bgvideo.getVideoClone(); + } + this.zhuExtra1 = extra; + this.zhuVideo1.vtype = vtype; + this.zhuVideo1.cbReady = this.audioReady.bind(this); + this.zhuVideo1.cbEnd = this.audioEnded.bind(this); + this.zhuVideo1.playVideo(remoteUrl, loop, false); + } + initBgAudio() { + let bgvideo = SceneBgVideoLayer.handle; + if (!bgvideo) { + return; } - //隐藏Banner - hide_banner(...args) { + console.log("web 初始化主背景视频"); + if (!this.zhuVideo1) { + this.zhuVideo1 = bgvideo.getVideoClone(); + this.zhuVideo1.remoteUrl = + "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4"; + } + if (!this.zhuVideo2) { + this.zhuVideo2 = bgvideo.getVideoClone(); + this.zhuVideo2.remoteUrl = + "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4"; + } + if (!this.emoVideo1) { + this.emoVideo1 = bgvideo.getVideoClone(); + this.emoVideo1.remoteUrl = + "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4"; + } + if (!this.emoVideo2) { + this.emoVideo2 = bgvideo.getVideoClone(); + this.emoVideo2.remoteUrl = + "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4"; + } + } + audioReady() { + this.removeBgAudioNext(); + this.zhuVideo1.moveIn(); + Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, { + compo: this.zhuVideo1, + extra: this.zhuExtra1, + }); + } + audioEnded() { + Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, { + compo: this.zhuVideo1, + extra: this.zhuExtra1, + }); + } + removeBgAudio() { + if (this.zhuVideo1 && this.zhuVideo1.isPlaying) { + this.zhuVideo1.recycleVideo(); + } + } + //主背景临时视频 + private zhuVideo2: BgVideo | null = null; + private zhuExtra2: any = null; + playBgAudioNext( + remoteUrl: string, + vtype: VideoRoleType, + loop: boolean = false, + extra: any = {} + ) { + let bgvideo = SceneBgVideoLayer.handle; + if (!bgvideo) { + return; + } + this.removeBgAudioNext(); + if (!this.zhuVideo2) { + this.zhuVideo2 = bgvideo.getVideoClone(); + } + this.zhuExtra2 = extra; + this.zhuVideo2.vtype = vtype; + this.zhuVideo2.cbReady = this.audioNextReady.bind(this); + this.zhuVideo2.cbEnd = this.audioNextEnded.bind(this); + this.zhuVideo2.playVideo(remoteUrl, loop, false); + } + audioNextReady() { + this.removeBgAudio(); + this.zhuVideo2.moveIn(); + Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, { + compo: this.zhuVideo2, + extra: this.zhuExtra2, + }); + } + audioNextEnded() { + Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, { + compo: this.zhuVideo2, + extra: this.zhuExtra2, + }); + } + removeBgAudioNext() { + if (this.zhuVideo2 && this.zhuVideo2.isPlaying) { + this.zhuVideo2.recycleVideo(); + } + } - } - - //主动拉起分享 - show_share(rewardCB?:Function) { - rewardCB && rewardCB(); - } - - //获取设备分辨率 - getWindowSize() { - return {width:screen.width, height: screen.height}; - } - - //显示游戏圈 - show_gameClub(leftRatio, topRatio, widthRatio, heightRatio) { - - } - //隐藏游戏圈 - hide_gameClub() { - - } - - //检查是否支持base64音频播放 - checkSupportBase64Audio() { - return true; - } - //播放base64音频 - private _audioInst:HTMLAudioElement = null; - playBase64Audio(base64:string, loop:boolean) { - let substring = base64; - let qianzhui = "data:audio/x-wav;base64," - if(base64.startsWith(qianzhui)) { - substring = base64.substring(qianzhui.length, base64.length) - } - - // 解码 Base64 字符串为二进制数据 - const binaryData = atob(substring); - - // 创建一个包含二进制数据的 Uint8Array - const byteArray = new Uint8Array(binaryData.length); - for (let i = 0; i < binaryData.length; i++) { - byteArray[i] = binaryData.charCodeAt(i); - } - - // 创建 Blob 对象,指定 MIME 类型为音频格式(例如 mp3) - const audioBlob = new Blob([byteArray], { type: 'audio/mp3' }); - - // 创建音频 URL - const audioUrl = URL.createObjectURL(audioBlob); - - console.log("web 播放base64音频", audioUrl) - // 创建音频元素并播放 - if (this._audioInst == null) { - this._audioInst = new Audio(audioUrl); - } else { - this._audioInst.src = audioUrl; - } - this._audioInst.play(); - - } - - //客服功能是否支持 - kefuSupport() { - console.log("web 不支持联系客服") - return false; - } - //进入联系客服 - openKefu() { - console.log("web 进入联系客服") - } - - - //region 播放主背景视频 - private zhuVideo1: BgVideo | null = null; - private zhuExtra1: any = null; - playBgAudio(remoteUrl:string, vtype:VideoRoleType, loop:boolean = false, extra:any = {}) { - let bgvideo = SceneBgVideoLayer.handle - if (!bgvideo) { - return - } - - this.initBgAudio() - if (this.zhuVideo1 && this.zhuVideo1.isPlaying) { - this.playBgAudioNext(remoteUrl, vtype, loop, extra); - return - } - - if (!this.zhuVideo1) { - this.zhuVideo1 = bgvideo.getVideoClone(); - } - this.zhuExtra1 = extra; - this.zhuVideo1.vtype = vtype; - this.zhuVideo1.cbReady = this.audioReady.bind(this); - this.zhuVideo1.cbEnd = this.audioEnded.bind(this); - this.zhuVideo1.playVideo(remoteUrl, loop, false); - } - initBgAudio() { - let bgvideo = SceneBgVideoLayer.handle - if (!bgvideo) { - return - } - - console.log("web 初始化主背景视频") - if (!this.zhuVideo1) { - this.zhuVideo1 = bgvideo.getVideoClone(); - this.zhuVideo1.remoteUrl = "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4" - } - if (!this.zhuVideo2) { - this.zhuVideo2 = bgvideo.getVideoClone(); - this.zhuVideo2.remoteUrl = "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4" - } - if (!this.emoVideo1) { - this.emoVideo1 = bgvideo.getVideoClone(); - this.emoVideo1.remoteUrl = "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4" - } - if (!this.emoVideo2) { - this.emoVideo2 = bgvideo.getVideoClone(); - this.emoVideo2.remoteUrl = "http://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/bginited.mp4" - } - } - audioReady() { - this.removeBgAudioNext(); - this.zhuVideo1.moveIn(); - Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, {compo: this.zhuVideo1, extra: this.zhuExtra1}); - } - audioEnded() { - Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, {compo: this.zhuVideo1, extra: this.zhuExtra1}); - } - removeBgAudio() { - if (this.zhuVideo1 && this.zhuVideo1.isPlaying) { - this.zhuVideo1.recycleVideo(); - } - } - //主背景临时视频 - private zhuVideo2: BgVideo | null = null; - private zhuExtra2: any = null; - playBgAudioNext(remoteUrl:string, vtype:VideoRoleType, loop:boolean = false, extra:any = {}) { - let bgvideo = SceneBgVideoLayer.handle - if (!bgvideo) { - return - } - this.removeBgAudioNext(); - if (!this.zhuVideo2) { - this.zhuVideo2 = bgvideo.getVideoClone(); - } - this.zhuExtra2 = extra; - this.zhuVideo2.vtype = vtype; - this.zhuVideo2.cbReady = this.audioNextReady.bind(this); - this.zhuVideo2.cbEnd = this.audioNextEnded.bind(this); - this.zhuVideo2.playVideo(remoteUrl, loop, false); - } - audioNextReady() { - this.removeBgAudio(); - this.zhuVideo2.moveIn(); - Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, {compo: this.zhuVideo2, extra: this.zhuExtra2}); - } - audioNextEnded() { - Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, {compo: this.zhuVideo2, extra: this.zhuExtra2}); - } - removeBgAudioNext() { - if (this.zhuVideo2 && this.zhuVideo2.isPlaying) { - this.zhuVideo2.recycleVideo(); - } + //region 播放emo视频 + private emoVideo1: BgVideo | null = null; + private emoExtra1: any = {}; + addEmoAudio( + remoteUrl: string, + vtype: VideoRoleType, + loop: boolean = false, + extra: any = {} + ) { + let bgvideo = SceneBgVideoLayer.handle; + if (!bgvideo) { + return; } - //region 播放emo视频 - private emoVideo1: BgVideo | null = null; - private emoExtra1: any = {} - addEmoAudio(remoteUrl:string, vtype:VideoRoleType, loop:boolean = false, extra:any = {}) { - let bgvideo = SceneBgVideoLayer.handle - if (!bgvideo) { - return - } - - if (this.emoVideo1 && this.emoVideo1.isPlaying) { - this.playEmoAudioNext(remoteUrl, vtype, loop, extra); - return - // this.emoVideo1.recycleVideo(); - } - - if (!this.emoVideo1 || !isValid(this.emoVideo1.node)) { - this.emoVideo1 = bgvideo.getVideoClone(); - } - this.emoExtra1 = extra; - this.emoVideo1.vtype = vtype; - this.emoVideo1.cbReady = this.emoReady.bind(this); - this.emoVideo1.cbEnd = this.emoEnded.bind(this); - this.emoVideo1.playVideo(remoteUrl, loop, false); - } - emoReady() { - this.removeEmoNextAudio(); - Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, {compo: this.emoVideo1, extra: this.emoExtra1}); - } - emoEnded() { - Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, {compo: this.emoVideo1, extra: this.emoExtra1}); - } - removeEmoAudio() { - if (this.emoVideo1 && this.emoVideo1.isPlaying) { - this.emoVideo1.recycleVideo(); - } - } - // 播放emo临时视频 - private emoVideo2: BgVideo | null = null; - private emoExtra2: any = {} - playEmoAudioNext(remoteUrl:string, vtype:VideoRoleType, loop:boolean = false, extra:any = {}) { - let bgvideo = SceneBgVideoLayer.handle - if (!bgvideo) { - return - } - this.removeEmoNextAudio(); - if (!this.emoVideo2) { - this.emoVideo2 = bgvideo.getVideoClone(); - } - this.emoExtra2 = extra; - this.emoVideo2.vtype = vtype; - this.emoVideo2.cbReady = this.emoNextReady.bind(this); - this.emoVideo2.cbEnd = this.emoNextEnded.bind(this); - this.emoVideo2.playVideo(remoteUrl, loop, false); - } - emoNextReady() { - this.removeEmoAudio(); - Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, {compo: this.emoVideo2, extra: this.emoExtra2}); - } - emoNextEnded() { - Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, {compo: this.emoVideo2, extra: this.emoExtra2}); - } - removeEmoNextAudio() { - if (this.emoVideo2 && this.emoVideo2.isPlaying) { - this.emoVideo2.recycleVideo(); - } + if (this.emoVideo1 && this.emoVideo1.isPlaying) { + this.playEmoAudioNext(remoteUrl, vtype, loop, extra); + return; + // this.emoVideo1.recycleVideo(); } + if (!this.emoVideo1 || !isValid(this.emoVideo1.node)) { + this.emoVideo1 = bgvideo.getVideoClone(); + } + this.emoExtra1 = extra; + this.emoVideo1.vtype = vtype; + this.emoVideo1.cbReady = this.emoReady.bind(this); + this.emoVideo1.cbEnd = this.emoEnded.bind(this); + this.emoVideo1.playVideo(remoteUrl, loop, false); + } + emoReady() { + this.removeEmoNextAudio(); + Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, { + compo: this.emoVideo1, + extra: this.emoExtra1, + }); + } + emoEnded() { + Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, { + compo: this.emoVideo1, + extra: this.emoExtra1, + }); + } + removeEmoAudio() { + if (this.emoVideo1 && this.emoVideo1.isPlaying) { + this.emoVideo1.recycleVideo(); + } + } + // 播放emo临时视频 + private emoVideo2: BgVideo | null = null; + private emoExtra2: any = {}; + playEmoAudioNext( + remoteUrl: string, + vtype: VideoRoleType, + loop: boolean = false, + extra: any = {} + ) { + let bgvideo = SceneBgVideoLayer.handle; + if (!bgvideo) { + return; + } + this.removeEmoNextAudio(); + if (!this.emoVideo2) { + this.emoVideo2 = bgvideo.getVideoClone(); + } + this.emoExtra2 = extra; + this.emoVideo2.vtype = vtype; + this.emoVideo2.cbReady = this.emoNextReady.bind(this); + this.emoVideo2.cbEnd = this.emoNextEnded.bind(this); + this.emoVideo2.playVideo(remoteUrl, loop, false); + } + emoNextReady() { + this.removeEmoAudio(); + Utils.sendInnerMsg(InnerMsgCode.BgVideo_Ready, { + compo: this.emoVideo2, + extra: this.emoExtra2, + }); + } + emoNextEnded() { + Utils.sendInnerMsg(InnerMsgCode.BgVideo_End, { + compo: this.emoVideo2, + extra: this.emoExtra2, + }); + } + removeEmoNextAudio() { + if (this.emoVideo2 && this.emoVideo2.isPlaying) { + this.emoVideo2.recycleVideo(); + } + } - //region 友盟+ - umaInit() { + //region 复制到剪贴板 + /**复制文本到剪贴板 */ + copyToClipboard(text: string, cb?: Function) { + console.log("web 复制到剪贴板:", text); + + if (navigator.clipboard && window.isSecureContext) { + // 使用现代的 Clipboard API + navigator.clipboard + .writeText(text) + .then(() => { + console.log("web 复制成功 (Clipboard API)"); + cb && cb(true); + }) + .catch((err) => { + console.log("web 复制失败 (Clipboard API):", err); + this.fallbackCopyToClipboard(text, cb); + }); + } else { + // 使用兼容性方案 + this.fallbackCopyToClipboard(text, cb); } - //友盟统计是否开启 - umaSwt() { - return false; + } + + /**兼容性复制方案 */ + private fallbackCopyToClipboard(text: string, cb?: Function) { + const textArea = document.createElement("textarea"); + textArea.value = text; + + // 避免滚动到底部 + textArea.style.top = "0"; + textArea.style.left = "0"; + textArea.style.position = "fixed"; + textArea.style.opacity = "0"; + + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + + try { + const successful = document.execCommand("copy"); + if (successful) { + console.log("web 复制成功 (fallback)"); + cb && cb(true); + } else { + console.log("web 复制失败 (fallback)"); + cb && cb(false); + } + } catch (err) { + console.log("web 复制异常 (fallback):", err); + cb && cb(false); } - //友盟事件统计 - umaEvent(eventName: string, value: any = {}) { - } + + document.body.removeChild(textArea); + } + + //region 友盟+ + umaInit() {} + //友盟统计是否开启 + umaSwt() { + return false; + } + //友盟事件统计 + umaEvent(eventName: string, value: any = {}) {} } diff --git a/assets/Scripts/Main/Channel/wxSDK.ts b/assets/Scripts/Main/Channel/wxSDK.ts index 29d8ffb9..4ce8d972 100644 --- a/assets/Scripts/Main/Channel/wxSDK.ts +++ b/assets/Scripts/Main/Channel/wxSDK.ts @@ -3,927 +3,1016 @@ 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 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' +const wx_banner_ad_unit_id = "test"; +const wx_splash_ad_unit_id = "test"; +const wx_video_ad_unit_id = "adunit-a79e037dfaac7bae"; -export class WXSDK{ +export class WXSDK { + static g_InGameScene = null; //游戏场景值 - 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 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 = ["分享失败", "请分享到一个群", "请分享给一位好友", "分享过于频繁"] + private ShareSTime: any; + private ShareCb: any; //分享回调 + private shareTxt = [ + "分享失败", + "请分享到一个群", + "请分享给一位好友", + "分享过于频繁", + ]; - //初始化 - init(cb: Function = null) { - // 保持屏幕常亮 - window['wx'].setKeepScreenOn({ keepScreenOn: true }); - WXSDK.g_InGameScene = window['wx'].getLaunchOptionsSync().scene; - console.log('init 微信 - 进入游戏的场景值', WXSDK.g_InGameScene); + //初始化 + init(cb: Function = null) { + // 保持屏幕常亮 + window["wx"].setKeepScreenOn({ keepScreenOn: true }); + WXSDK.g_InGameScene = window["wx"].getLaunchOptionsSync().scene; + console.log("init 微信 - 进入游戏的场景值", WXSDK.g_InGameScene); - //显示分享按钮 - window['wx'].showShareMenu({ - withShareTicket: true, - menus: ["shareAppMessage", "shareTimeline"], - }); - window['wx'].onShareAppMessage(() => { - return this.shareInfo(); - }); - window['wx'].onShareTimeline(() => { - return this.shareInfo(); - }) - - //小游戏回到前台 - window['wx'].onShow(this.onWxShow.bind(this)); - //小游戏被隐藏 记个时间 - window['wx'].onHide(() => { - if (this.ShareCb) { - this.ShareSTime = new Date().getTime(); - console.log("分享时间差 记录:", this.ShareSTime); - } - }); + //显示分享按钮 + window["wx"].showShareMenu({ + withShareTicket: true, + menus: ["shareAppMessage", "shareTimeline"], + }); + window["wx"].onShareAppMessage(() => { + return this.shareInfo(); + }); + window["wx"].onShareTimeline(() => { + return this.shareInfo(); + }); - this.init_video(); //初始化视频广告 - this.init_splash(); //初始化插屏广告 - this.init_banner(); //初始化Banner广告 横幅广告 - this.qiangzhiUpdata(); //检测更新 - cb && cb(); - } - - //小游戏回到前台 - onWxShow(data: any) { - console.log("onWxShow:" + JSON.stringify(data)) - //返回小游戏场景值 - if (data && data.query && data.query.ShareCode) { - GlobalValue.ShareTocusid = data.query.ShareCode - } + window["wx"].onShow(this.onWxShow.bind(this)); + //小游戏被隐藏 记个时间 + window["wx"].onHide(() => { + if (this.ShareCb) { + this.ShareSTime = new Date().getTime(); + console.log("分享时间差 记录:", this.ShareSTime); + } + }); - if (this.ShareCb) { - if (this.ShareSTime) { - let nT = new Date().getTime(); - console.log("分享时间差 计算:",nT, this.ShareSTime); - if (nT - this.ShareSTime > 1500) { - let cb = this.ShareCb.succ - cb && cb() - } else { - this.tostErr() - } - } - this.ShareCb = null; - } - } - //分享失败 - tostErr() { - let rint = Math.floor( randomRange(0, this.shareTxt.length - 1) ) - SubManager.ShowPrompt(this.shareTxt[rint]) - if (this.ShareCb) { - let cb = this.ShareCb.fail - cb && cb() - } + this.init_video(); //初始化视频广告 + this.init_splash(); //初始化插屏广告 + this.init_banner(); //初始化Banner广告 横幅广告 + this.qiangzhiUpdata(); //检测更新 + cb && cb(); + } + + //小游戏回到前台 + onWxShow(data: any) { + console.log("onWxShow:" + JSON.stringify(data)); + //返回小游戏场景值 + if (data && data.query && data.query.ShareCode) { + GlobalValue.ShareTocusid = data.query.ShareCode; } - - /**获取用户授权状态 - * @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 + if (this.ShareCb) { + if (this.ShareSTime) { + let nT = new Date().getTime(); + console.log("分享时间差 计算:", nT, this.ShareSTime); + if (nT - this.ShareSTime > 1500) { + let cb = this.ShareCb.succ; + cb && cb(); } else { - this.videoAdaInfo.scale = ratioh - this.videoAdaInfo.x = -(this.videoWidth * ratioh - size.width) / 2 - this.videoAdaInfo.y = 0 + this.tostErr(); } - console.log("微信 视频适配信息", this.videoAdaInfo, size) - return this.videoAdaInfo + } + this.ShareCb = null; + } + } + //分享失败 + tostErr() { + let rint = Math.floor(randomRange(0, this.shareTxt.length - 1)); + SubManager.ShowPrompt(this.shareTxt[rint]); + if (this.ShareCb) { + let cb = this.ShareCb.fail; + 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; } - //设置暂停播放的主视频 - private vpWait: any = null; - setBgAudioPause(wait:any) { - console.log("微信 主视频暂停播放") - this.vpWait = wait - this.vpWait.pause() - } - replayBgAudioPause() { - console.log("微信 主视频继续播放") - if (this.vpWait) { - this.vpWait.play() + 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); } - } - - //设置准备好要播放的表情视频 - 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() - } + } else { + // 播放中途退出,不下发游戏奖励 + //wx_video_callback(-1); + } + SDKManager.video_ad_back(); + }); + } - - //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") + //初始化插屏广告 + private init_splash() { + if ((wx_splash_ad_unit_id as any) == "test") { + console.log("微信 插屏广告id未配置,跳过此类型初始化"); + return; } - stopRecordRecognition() { - if (this.rrmgr) { - this.rrmgr.stop(); - console.log("微信 同声传译444") - } + // 创建插屏广告实例,提前初始化 + 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 友盟+ - //初始化友盟+ - umaInit() { - window['wx'].uma.init({ - appKey:'67c969b99a16fe6dcd5bfec5', - useOpenid:true,// default true - autoGetOpenid:true, - debug:true, - uploadUserInfo:true// 上传用户信息,上传后可以看到有用户头像和昵称的分享信息 + //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(); }) - console.log("微信 uma 初始化"); + .catch((err) => { + console.log(err); + }); } - //友盟统计是否开启 - umaSwt() { - return true; - } - //友盟事件统计 - umaEvent(eventName: string, value: any = {}) { - window['wx'].uma.trackEvent(eventName, value); - console.log("微信 uma 统计:", eventName, value); - } -} + } + //显示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); + } +} diff --git a/assets/Scripts/Sub/UI/PreloadUI.ts b/assets/Scripts/Sub/UI/PreloadUI.ts index b97436db..0f5dc35d 100644 --- a/assets/Scripts/Sub/UI/PreloadUI.ts +++ b/assets/Scripts/Sub/UI/PreloadUI.ts @@ -63,8 +63,9 @@ export class PreloadUI extends Component { // 设备号 DeviceIdService.I.init(); - this.preloadFiles(); + SDKManager.init(); + this.preloadFiles(); } protected onDestroy(): void { @@ -187,6 +188,4 @@ export class PreloadUI extends Component { this.jinduBar.active = false; ResManager.I.goCustomScene("LoginScene"); } - - } diff --git a/assets/Scripts/chat18x/ui/panels/PurchasePanel.ts b/assets/Scripts/chat18x/ui/panels/PurchasePanel.ts index de5a09e1..5c619890 100644 --- a/assets/Scripts/chat18x/ui/panels/PurchasePanel.ts +++ b/assets/Scripts/chat18x/ui/panels/PurchasePanel.ts @@ -53,8 +53,8 @@ export class PurchasePanel extends li_BaseView { Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => { this.onVipExpireChange(); }); - Utils.addInnerEL(InnerMsgCode.PayOrderCreateSucc, this, () => { - this.createOrRefreshWeb3PayPanel; + Utils.addInnerEL(InnerMsgCode.PayOrderCreateSucc, this, (data) => { + this.createOrRefreshWeb3PayPanel(data); }); for (let index = 0; index < this.items.length; index++) { @@ -75,6 +75,7 @@ export class PurchasePanel extends li_BaseView { }, this ); + GButton.BandClick( this._nodeTab.Buy30DayVipBtn, () => { @@ -85,6 +86,22 @@ export class PurchasePanel extends li_BaseView { }, this ); + GButton.BandClick( + this._nodeTab.cashBtn, + () => { + // 购买7天会员 + this.onClickCashBtn(); + }, + this + ); + GButton.BandClick( + this._nodeTab.web3Btn, + () => { + // 购买7天会员 + this.onClickWeb3Btn(); + }, + this + ); GButton.BandClick( this._nodeTab.ReturnBtn, () => { @@ -145,6 +162,12 @@ export class PurchasePanel extends li_BaseView { // 需要外部支付进行购买 this.startPayment(id, this.currentPayType, networkType); } + //测试用 + // Utils.sendInnerMsg(InnerMsgCode.PayOrderCreateSucc, { + // orderId: 123, + // payType: 1, + // goodId: 1001, + // }); } createOrRefreshWeb3PayPanel(param: any) { @@ -159,7 +182,7 @@ export class PurchasePanel extends li_BaseView { if ( NavigationManager.Instance.getCurrentActivePanel() == PanelType.PERSONAL ) - if (this.web3PopPanel === null) + if (this.web3PopPanel == null) NavigationManager.Instance.openSubPanel( "Web3PopPanel", this.node, diff --git a/assets/Scripts/chat18x/ui/panels/Web3PopPanel.ts b/assets/Scripts/chat18x/ui/panels/Web3PopPanel.ts index 7405270b..75636902 100644 --- a/assets/Scripts/chat18x/ui/panels/Web3PopPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/Web3PopPanel.ts @@ -7,6 +7,9 @@ import { OrderData } from "../../data/OrderData"; import proto from "db://assets/Scripts/proto/proto.pb.js"; import ResManager from "../../../Main/Manager/ResManager"; import { PurchasePanel } from "./PurchasePanel"; +import { QRCodeGenerator } from "db://assets/utils/qrcodeGenerator"; +import { TipsPanel } from "./TipsPanel"; +import { SDKManager } from "../../../Main/Channel/SDKManager"; const { ccclass, property } = _decorator; @@ -21,6 +24,7 @@ export class Web3PopPanel extends li_BaseView { private expireTimeText: Label; private selection: Node; + private qrCode: Sprite; private curType: proto.cs.EnmNetworkType; private orderId; @@ -43,6 +47,7 @@ export class Web3PopPanel extends li_BaseView { this.coinText = this._nodeTab.SelectedCoinText.getComponent(Label); this.address = this._nodeTab.addressText.getComponent(Label); this.expireTimeText = this._nodeTab.expireTimeText.getComponent(Label); + this.qrCode = this._nodeTab.qrCode.getComponent(Sprite); this.registerListener(); this.selection.setScale(new Vec3(1, 0, 1)); @@ -107,6 +112,7 @@ export class Web3PopPanel extends li_BaseView { const expireTime = OrderData.getExpireById(this.orderId); const retCode = OrderData.getRetCodeById(this.orderId); + this.expireTimeText.string = expireTime.toString(); this.amount.string = amount; this.address.string = walletUrl; switch (this.networkType) { @@ -139,6 +145,21 @@ export class Web3PopPanel extends li_BaseView { this.coinText.string = "ENT_BEP"; break; } + + //this.address.string = "asdasdasd"; + //refreshQRcode + QRCodeGenerator.generateQRCodeSpriteFrame( + this.address.string, + 320, + 4, + (spriteframe) => { + if (spriteframe) { + this.qrCode.spriteFrame = spriteframe; + } else { + TipsPanel.show("qrcode generation fail, please copy url"); + } + } + ); } updateSelectNetwork() {} @@ -166,7 +187,15 @@ export class Web3PopPanel extends li_BaseView { } onClickCopy() { - //todo:copy 功能 + const stringToCopy = this.address.string; + + SDKManager.copyToClipboard(stringToCopy, (success: boolean) => { + if (success) { + TipsPanel.show("地址已复制到剪贴板"); + } else { + TipsPanel.show("复制失败,请手动复制地址"); + } + }); } onClickClose() { diff --git a/assets/Scripts/test.meta b/assets/Scripts/test.meta new file mode 100644 index 00000000..105d8667 --- /dev/null +++ b/assets/Scripts/test.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "937d6b90-9aae-4409-b77c-494e10bf1a78", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/test/QRCodeGeneratorTest.ts b/assets/Scripts/test/QRCodeGeneratorTest.ts new file mode 100644 index 00000000..52078a75 --- /dev/null +++ b/assets/Scripts/test/QRCodeGeneratorTest.ts @@ -0,0 +1,126 @@ +import { _decorator, Component, Node, Sprite, Label, Button } from 'cc'; +import { QRCodeGenerator } from '../../utils/qrcodeGenerator'; + +const { ccclass, property } = _decorator; + +/** + * 二维码生成器测试演示 + * 展示如何使用 QRCodeGenerator 工具类 + */ +@ccclass('QRCodeGeneratorTest') +export class QRCodeGeneratorTest extends Component { + + @property(Node) + qrCodeContainer: Node = null!; + + @property(Button) + generateBtn: Button = null!; + + @property(Label) + statusLabel: Label = null!; + + private testTexts = [ + 'https://example.com', + 'Hello World!', + '这是一个中文测试', + 'QR Code Generator Test - 二维码生成器测试', + JSON.stringify({ name: 'test', value: 123, timestamp: Date.now() }) + ]; + + private currentIndex = 0; + + start() { + if (this.generateBtn) { + this.generateBtn.node.on(Button.EventType.CLICK, this.onGenerateClick, this); + } + + // 初始生成第一个二维码 + this.generateQRCode(); + } + + private onGenerateClick() { + this.currentIndex = (this.currentIndex + 1) % this.testTexts.length; + this.generateQRCode(); + } + + private generateQRCode() { + if (!this.qrCodeContainer) { + this.updateStatus('错误: 二维码容器节点未设置'); + return; + } + + // 清空容器 + this.qrCodeContainer.removeAllChildren(); + + const testText = this.testTexts[this.currentIndex]; + this.updateStatus(`正在生成二维码: ${testText.substring(0, 30)}...`); + + try { + // 方法1: 生成 Sprite 组件(包含节点)- 异步版本 + QRCodeGenerator.generateQRCodeSprite(testText, 200, 8, (qrSprite) => { + if (qrSprite) { + // 将生成的 Sprite 节点添加到容器中 + qrSprite.node.setParent(this.qrCodeContainer); + qrSprite.node.setPosition(0, 0, 0); + + this.updateStatus(`✓ 成功生成二维码 (${this.currentIndex + 1}/${this.testTexts.length})`); + + // 打印一些调试信息 + console.log('QRCode生成成功:', { + text: testText, + spriteFrame: qrSprite.spriteFrame, + size: qrSprite.spriteFrame?.texture?.width + 'x' + qrSprite.spriteFrame?.texture?.height + }); + } else { + this.updateStatus('✗ 生成二维码失败'); + } + }); + + // 演示方法2: 生成 SpriteFrame 并应用到现有节点(异步版本) + // QRCodeGenerator.generateQRCodeSpriteFrame(testText, 200, 8, (spriteFrame) => { + // if (spriteFrame && existingSpriteNode) { + // const sprite = existingSpriteNode.getComponent(Sprite); + // if (sprite) { + // sprite.spriteFrame = spriteFrame; + // } + // } + // }); + + // 演示方法3: 生成 Base64 字符串 + // const base64 = QRCodeGenerator.generateQRCodeBase64(testText, 200, 8); + // console.log('QRCode Base64:', base64.substring(0, 100) + '...'); + + } catch (error) { + console.error('QRCode生成测试失败:', error); + this.updateStatus('✗ 生成失败: ' + error.message); + } + } + + private updateStatus(message: string) { + if (this.statusLabel) { + this.statusLabel.string = message; + } + console.log('QRCodeTest:', message); + } + + /** + * 静态方法示例:在其他地方直接调用 + */ + public static createQRCodeExample() { + // 示例1: 生成网址二维码(异步) + QRCodeGenerator.generateQRCodeSprite('https://www.example.com', 256, 4, (urlQR) => { + console.log('URL二维码生成完成:', urlQR); + }); + + // 示例2: 生成文本二维码,自定义尺寸(异步) + QRCodeGenerator.generateQRCodeSpriteFrame('Hello World!', 300, 10, (textQR) => { + console.log('文本二维码生成完成:', textQR); + }); + + // 示例3: 生成Base64格式二维码(同步) + const base64QR = QRCodeGenerator.generateQRCodeBase64('测试数据', 150, 5); + console.log('Base64二维码生成完成:', base64QR.substring(0, 100) + '...'); + + return { message: '二维码生成中,请查看控制台日志' }; + } +} \ No newline at end of file diff --git a/assets/Scripts/test/QRCodeGeneratorTest.ts.meta b/assets/Scripts/test/QRCodeGeneratorTest.ts.meta new file mode 100644 index 00000000..1e370c5a --- /dev/null +++ b/assets/Scripts/test/QRCodeGeneratorTest.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "8a671ed0-b5e1-46c1-b934-1957736ea00a", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/bundles/Chat18x/PurchasePanel.prefab b/assets/bundles/Chat18x/PurchasePanel.prefab index b08caa44..340001ce 100644 --- a/assets/bundles/Chat18x/PurchasePanel.prefab +++ b/assets/bundles/Chat18x/PurchasePanel.prefab @@ -25,20 +25,20 @@ "_active": true, "_components": [ { - "__id__": 355 + "__id__": 367 }, { - "__id__": 357 + "__id__": 369 }, { - "__id__": 359 + "__id__": 371 }, { - "__id__": 361 + "__id__": 373 } ], "_prefab": { - "__id__": 363 + "__id__": 375 }, "_lpos": { "__type__": "cc.Vec3", @@ -84,45 +84,24 @@ { "__id__": 30 }, - { - "__id__": 46 - }, - { - "__id__": 70 - }, - { - "__id__": 86 - }, - { - "__id__": 106 - }, - { - "__id__": 126 - }, { "__id__": 132 - }, - { - "__id__": 146 - }, - { - "__id__": 160 } ], "_active": true, "_components": [ { - "__id__": 348 + "__id__": 360 }, { - "__id__": 350 + "__id__": 362 }, { - "__id__": 352 + "__id__": 364 } ], "_prefab": { - "__id__": 354 + "__id__": 366 }, "_lpos": { "__type__": "cc.Vec3", @@ -749,12 +728,12 @@ "__prefab": { "__id__": 28 }, - "_alignFlags": 41, + "_alignFlags": 45, "_target": null, "_left": 0, "_right": 0, "_top": 99, - "_bottom": 0, + "_bottom": 2091, "_horizontalCenter": 0, "_verticalCenter": 0, "_isAbsLeft": true, @@ -764,9 +743,9 @@ "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 100, - "_originalHeight": 0, + "_originalHeight": 150, "_alignMode": 2, - "_lockFlags": 1, + "_lockFlags": 0, "_id": "" }, { @@ -788,7 +767,7 @@ }, { "__type__": "cc.Node", - "_name": "Coin", + "_name": "Vippanel", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -797,27 +776,93 @@ "_children": [ { "__id__": 31 + }, + { + "__id__": 47 + }, + { + "__id__": 71 + }, + { + "__id__": 87 + }, + { + "__id__": 107 } ], "_active": true, "_components": [ { - "__id__": 39 + "__id__": 127 }, { - "__id__": 41 - }, - { - "__id__": 43 + "__id__": 129 } ], "_prefab": { - "__id__": 45 + "__id__": 131 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 489.37300000000005, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Coin", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 30 + }, + "_children": [ + { + "__id__": 32 + } + ], + "_active": true, + "_components": [ + { + "__id__": 40 + }, + { + "__id__": 42 + }, + { + "__id__": 44 + } + ], + "_prefab": { + "__id__": 46 }, "_lpos": { "__type__": "cc.Vec3", "x": -101.37, - "y": 803.454, + "y": 314.0809999999999, "z": 0 }, "_lrot": { @@ -849,23 +894,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 30 + "__id__": 31 }, "_children": [], "_active": true, "_components": [ { - "__id__": 32 + "__id__": 33 }, { - "__id__": 34 + "__id__": 35 }, { - "__id__": 36 + "__id__": 37 } ], "_prefab": { - "__id__": 38 + "__id__": 39 }, "_lpos": { "__type__": "cc.Vec3", @@ -902,11 +947,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 31 + "__id__": 32 }, "_enabled": true, "__prefab": { - "__id__": 33 + "__id__": 34 }, "_contentSize": { "__type__": "cc.Size", @@ -930,11 +975,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 31 + "__id__": 32 }, "_enabled": true, "__prefab": { - "__id__": 35 + "__id__": 36 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1001,11 +1046,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 31 + "__id__": 32 }, "_enabled": true, "__prefab": { - "__id__": 37 + "__id__": 38 }, "_alignFlags": 10, "_target": null, @@ -1050,11 +1095,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 30 + "__id__": 31 }, "_enabled": true, "__prefab": { - "__id__": 40 + "__id__": 41 }, "_contentSize": { "__type__": "cc.Size", @@ -1078,11 +1123,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 30 + "__id__": 31 }, "_enabled": true, "__prefab": { - "__id__": 42 + "__id__": 43 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1123,13 +1168,13 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 30 + "__id__": 31 }, "_enabled": true, "__prefab": { - "__id__": 44 + "__id__": 45 }, - "_alignFlags": 33, + "_alignFlags": 32, "_target": null, "_left": 194.1, "_right": 582.87, @@ -1172,35 +1217,35 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 30 }, "_children": [ { - "__id__": 47 + "__id__": 48 }, { - "__id__": 55 + "__id__": 56 } ], "_active": true, "_components": [ { - "__id__": 63 + "__id__": 64 }, { - "__id__": 65 + "__id__": 66 }, { - "__id__": 67 + "__id__": 68 } ], "_prefab": { - "__id__": 69 + "__id__": 70 }, "_lpos": { "__type__": "cc.Vec3", "x": 254.16600000000005, - "y": 803.454, + "y": 314.0809999999999, "z": 0 }, "_lrot": { @@ -1232,23 +1277,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 47 }, "_children": [], "_active": true, "_components": [ { - "__id__": 48 + "__id__": 49 }, { - "__id__": 50 + "__id__": 51 }, { - "__id__": 52 + "__id__": 53 } ], "_prefab": { - "__id__": 54 + "__id__": 55 }, "_lpos": { "__type__": "cc.Vec3", @@ -1285,11 +1330,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 48 }, "_enabled": true, "__prefab": { - "__id__": 49 + "__id__": 50 }, "_contentSize": { "__type__": "cc.Size", @@ -1313,11 +1358,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 48 }, "_enabled": true, "__prefab": { - "__id__": 51 + "__id__": 52 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1384,11 +1429,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 48 }, "_enabled": true, "__prefab": { - "__id__": 53 + "__id__": 54 }, "_alignFlags": 34, "_target": null, @@ -1433,23 +1478,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 47 }, "_children": [], "_active": false, "_components": [ { - "__id__": 56 + "__id__": 57 }, { - "__id__": 58 + "__id__": 59 }, { - "__id__": 60 + "__id__": 61 } ], "_prefab": { - "__id__": 62 + "__id__": 63 }, "_lpos": { "__type__": "cc.Vec3", @@ -1486,11 +1531,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 55 + "__id__": 56 }, "_enabled": true, "__prefab": { - "__id__": 57 + "__id__": 58 }, "_contentSize": { "__type__": "cc.Size", @@ -1514,11 +1559,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 55 + "__id__": 56 }, "_enabled": true, "__prefab": { - "__id__": 59 + "__id__": 60 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1582,11 +1627,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 55 + "__id__": 56 }, "_enabled": true, "__prefab": { - "__id__": 61 + "__id__": 62 }, "_alignFlags": 34, "_target": null, @@ -1631,11 +1676,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 46 + "__id__": 47 }, "_enabled": true, "__prefab": { - "__id__": 64 + "__id__": 65 }, "_contentSize": { "__type__": "cc.Size", @@ -1659,11 +1704,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 46 + "__id__": 47 }, "_enabled": true, "__prefab": { - "__id__": 66 + "__id__": 67 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1704,13 +1749,13 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 46 + "__id__": 47 }, "_enabled": true, "__prefab": { - "__id__": 68 + "__id__": 69 }, - "_alignFlags": 33, + "_alignFlags": 32, "_target": null, "_left": 194.1, "_right": 225.83399999999995, @@ -1753,32 +1798,32 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 30 }, "_children": [ { - "__id__": 71 + "__id__": 72 } ], "_active": true, "_components": [ { - "__id__": 79 + "__id__": 80 }, { - "__id__": 81 + "__id__": 82 }, { - "__id__": 83 + "__id__": 84 } ], "_prefab": { - "__id__": 85 + "__id__": 86 }, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 727.8520000000001, + "y": 238.47900000000004, "z": 0 }, "_lrot": { @@ -1810,23 +1855,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 70 + "__id__": 71 }, "_children": [], "_active": true, "_components": [ { - "__id__": 72 + "__id__": 73 }, { - "__id__": 74 + "__id__": 75 }, { - "__id__": 76 + "__id__": 77 } ], "_prefab": { - "__id__": 78 + "__id__": 79 }, "_lpos": { "__type__": "cc.Vec3", @@ -1863,11 +1908,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 71 + "__id__": 72 }, "_enabled": true, "__prefab": { - "__id__": 73 + "__id__": 74 }, "_contentSize": { "__type__": "cc.Size", @@ -1891,11 +1936,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 71 + "__id__": 72 }, "_enabled": true, "__prefab": { - "__id__": 75 + "__id__": 76 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1959,11 +2004,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 71 + "__id__": 72 }, "_enabled": true, "__prefab": { - "__id__": 77 + "__id__": 78 }, "_alignFlags": 36, "_target": null, @@ -2008,11 +2053,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 70 + "__id__": 71 }, "_enabled": true, "__prefab": { - "__id__": 80 + "__id__": 81 }, "_contentSize": { "__type__": "cc.Size", @@ -2036,11 +2081,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 70 + "__id__": 71 }, "_enabled": true, "__prefab": { - "__id__": 82 + "__id__": 83 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2081,13 +2126,13 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 70 + "__id__": 71 }, "_enabled": true, "__prefab": { - "__id__": 84 + "__id__": 85 }, - "_alignFlags": 41, + "_alignFlags": 40, "_target": null, "_left": 79.08626898734173, "_right": 79.08626898734173, @@ -2130,35 +2175,35 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 30 }, "_children": [ { - "__id__": 87 + "__id__": 88 }, { - "__id__": 93 + "__id__": 94 } ], "_active": true, "_components": [ { - "__id__": 99 + "__id__": 100 }, { - "__id__": 101 + "__id__": 102 }, { - "__id__": 103 + "__id__": 104 } ], "_prefab": { - "__id__": 105 + "__id__": 106 }, "_lpos": { "__type__": "cc.Vec3", "x": 214.394, - "y": 168.19900000000007, + "y": -348.3620000000001, "z": 0 }, "_lrot": { @@ -2190,20 +2235,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 86 + "__id__": 87 }, "_children": [], "_active": true, "_components": [ { - "__id__": 88 + "__id__": 89 }, { - "__id__": 90 + "__id__": 91 } ], "_prefab": { - "__id__": 92 + "__id__": 93 }, "_lpos": { "__type__": "cc.Vec3", @@ -2240,11 +2285,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 87 + "__id__": 88 }, "_enabled": true, "__prefab": { - "__id__": 89 + "__id__": 90 }, "_contentSize": { "__type__": "cc.Size", @@ -2268,11 +2313,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 87 + "__id__": 88 }, "_enabled": true, "__prefab": { - "__id__": 91 + "__id__": 92 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2352,20 +2397,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 86 + "__id__": 87 }, "_children": [], "_active": true, "_components": [ { - "__id__": 94 + "__id__": 95 }, { - "__id__": 96 + "__id__": 97 } ], "_prefab": { - "__id__": 98 + "__id__": 99 }, "_lpos": { "__type__": "cc.Vec3", @@ -2402,11 +2447,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 93 + "__id__": 94 }, "_enabled": true, "__prefab": { - "__id__": 95 + "__id__": 96 }, "_contentSize": { "__type__": "cc.Size", @@ -2430,11 +2475,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 93 + "__id__": 94 }, "_enabled": true, "__prefab": { - "__id__": 97 + "__id__": 98 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2511,11 +2556,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 86 + "__id__": 87 }, "_enabled": true, "__prefab": { - "__id__": 100 + "__id__": 101 }, "_contentSize": { "__type__": "cc.Size", @@ -2539,11 +2584,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 86 + "__id__": 87 }, "_enabled": true, "__prefab": { - "__id__": 102 + "__id__": 103 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2584,11 +2629,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 86 + "__id__": 87 }, "_enabled": true, "__prefab": { - "__id__": 104 + "__id__": 105 }, "clickEvents": [], "_interactable": true, @@ -2631,7 +2676,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 86 + "__id__": 87 }, "_id": "" }, @@ -2658,35 +2703,35 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 30 }, "_children": [ { - "__id__": 107 + "__id__": 108 }, { - "__id__": 113 + "__id__": 114 } ], "_active": true, "_components": [ { - "__id__": 119 + "__id__": 120 }, { - "__id__": 121 + "__id__": 122 }, { - "__id__": 123 + "__id__": 124 } ], "_prefab": { - "__id__": 125 + "__id__": 126 }, "_lpos": { "__type__": "cc.Vec3", "x": -206.026, - "y": 168.19900000000007, + "y": -348.3620000000001, "z": 0 }, "_lrot": { @@ -2718,20 +2763,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 106 + "__id__": 107 }, "_children": [], "_active": true, "_components": [ { - "__id__": 108 + "__id__": 109 }, { - "__id__": 110 + "__id__": 111 } ], "_prefab": { - "__id__": 112 + "__id__": 113 }, "_lpos": { "__type__": "cc.Vec3", @@ -2768,11 +2813,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 107 + "__id__": 108 }, "_enabled": true, "__prefab": { - "__id__": 109 + "__id__": 110 }, "_contentSize": { "__type__": "cc.Size", @@ -2796,11 +2841,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 107 + "__id__": 108 }, "_enabled": true, "__prefab": { - "__id__": 111 + "__id__": 112 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2880,20 +2925,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 106 + "__id__": 107 }, "_children": [], "_active": true, "_components": [ { - "__id__": 114 + "__id__": 115 }, { - "__id__": 116 + "__id__": 117 } ], "_prefab": { - "__id__": 118 + "__id__": 119 }, "_lpos": { "__type__": "cc.Vec3", @@ -2930,11 +2975,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 113 + "__id__": 114 }, "_enabled": true, "__prefab": { - "__id__": 115 + "__id__": 116 }, "_contentSize": { "__type__": "cc.Size", @@ -2958,11 +3003,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 113 + "__id__": 114 }, "_enabled": true, "__prefab": { - "__id__": 117 + "__id__": 118 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3039,11 +3084,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 106 + "__id__": 107 }, "_enabled": true, "__prefab": { - "__id__": 120 + "__id__": 121 }, "_contentSize": { "__type__": "cc.Size", @@ -3067,11 +3112,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 106 + "__id__": 107 }, "_enabled": true, "__prefab": { - "__id__": 122 + "__id__": 123 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3112,11 +3157,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 106 + "__id__": 107 }, "_enabled": true, "__prefab": { - "__id__": 124 + "__id__": 125 }, "clickEvents": [], "_interactable": true, @@ -3156,7 +3201,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 106 + "__id__": 107 }, "_id": "" }, @@ -3177,31 +3222,169 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 30 + }, + "_enabled": true, + "__prefab": { + "__id__": 128 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 780.0999999999999 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "fcqMtKNSNBfogR1v874tu1" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 30 + }, + "_enabled": true, + "__prefab": { + "__id__": 130 + }, + "_alignFlags": 5, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 290.577, + "_bottom": 1269.323, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 780.1, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "f1sL5HJptPMYZe2BdO4AYw" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "bfmQnNE+dDppKipXIAljrF", + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.Node", - "_name": "charge-text", + "_name": "chargeArea", "_objFlags": 0, "__editorExtras__": {}, "_parent": { "__id__": 2 }, - "_children": [], + "_children": [ + { + "__id__": 133 + }, + { + "__id__": 139 + }, + { + "__id__": 153 + }, + { + "__id__": 167 + } + ], "_active": true, "_components": [ { - "__id__": 127 + "__id__": 355 }, { - "__id__": 129 + "__id__": 357 } ], "_prefab": { - "__id__": 131 + "__id__": 359 }, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 17.083000000000084, + "y": -431.11400000000003, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "charge-text", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 132 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 134 + }, + { + "__id__": 136 + } + ], + "_prefab": { + "__id__": 138 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 448.1970000000001, "z": 0 }, "_lrot": { @@ -3233,11 +3416,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 133 }, "_enabled": true, "__prefab": { - "__id__": 128 + "__id__": 135 }, "_contentSize": { "__type__": "cc.Size", @@ -3261,11 +3444,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 133 }, "_enabled": true, "__prefab": { - "__id__": 130 + "__id__": 137 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3342,32 +3525,32 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 132 }, "_children": [ { - "__id__": 133 + "__id__": 140 } ], "_active": true, "_components": [ { - "__id__": 139 + "__id__": 146 }, { - "__id__": 141 + "__id__": 148 }, { - "__id__": 143 + "__id__": 150 } ], "_prefab": { - "__id__": 145 + "__id__": 152 }, "_lpos": { "__type__": "cc.Vec3", "x": -120, - "y": -64.3309999999999, + "y": 366.78300000000013, "z": 0 }, "_lrot": { @@ -3399,20 +3582,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 132 + "__id__": 139 }, "_children": [], "_active": true, "_components": [ { - "__id__": 134 + "__id__": 141 }, { - "__id__": 136 + "__id__": 143 } ], "_prefab": { - "__id__": 138 + "__id__": 145 }, "_lpos": { "__type__": "cc.Vec3", @@ -3449,11 +3632,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 133 + "__id__": 140 }, "_enabled": true, "__prefab": { - "__id__": 135 + "__id__": 142 }, "_contentSize": { "__type__": "cc.Size", @@ -3477,11 +3660,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 133 + "__id__": 140 }, "_enabled": true, "__prefab": { - "__id__": 137 + "__id__": 144 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3558,11 +3741,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 132 + "__id__": 139 }, "_enabled": true, "__prefab": { - "__id__": 140 + "__id__": 147 }, "_contentSize": { "__type__": "cc.Size", @@ -3586,11 +3769,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 132 + "__id__": 139 }, "_enabled": true, "__prefab": { - "__id__": 142 + "__id__": 149 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3631,11 +3814,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 132 + "__id__": 139 }, "_enabled": true, "__prefab": { - "__id__": 144 + "__id__": 151 }, "clickEvents": [], "_interactable": true, @@ -3687,7 +3870,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 132 + "__id__": 139 }, "_id": "" }, @@ -3714,32 +3897,32 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 132 }, "_children": [ { - "__id__": 147 + "__id__": 154 } ], "_active": true, "_components": [ { - "__id__": 153 + "__id__": 160 }, { - "__id__": 155 + "__id__": 162 }, { - "__id__": 157 + "__id__": 164 } ], "_prefab": { - "__id__": 159 + "__id__": 166 }, "_lpos": { "__type__": "cc.Vec3", "x": 120, - "y": -64.3309999999999, + "y": 366.78300000000013, "z": 0 }, "_lrot": { @@ -3771,20 +3954,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 146 + "__id__": 153 }, "_children": [], "_active": true, "_components": [ { - "__id__": 148 + "__id__": 155 }, { - "__id__": 150 + "__id__": 157 } ], "_prefab": { - "__id__": 152 + "__id__": 159 }, "_lpos": { "__type__": "cc.Vec3", @@ -3821,11 +4004,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 147 + "__id__": 154 }, "_enabled": true, "__prefab": { - "__id__": 149 + "__id__": 156 }, "_contentSize": { "__type__": "cc.Size", @@ -3849,11 +4032,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 147 + "__id__": 154 }, "_enabled": true, "__prefab": { - "__id__": 151 + "__id__": 158 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3930,11 +4113,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 146 + "__id__": 153 }, "_enabled": true, "__prefab": { - "__id__": 154 + "__id__": 161 }, "_contentSize": { "__type__": "cc.Size", @@ -3958,11 +4141,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 146 + "__id__": 153 }, "_enabled": true, "__prefab": { - "__id__": 156 + "__id__": 163 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4003,11 +4186,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 146 + "__id__": 153 }, "_enabled": true, "__prefab": { - "__id__": 158 + "__id__": 165 }, "clickEvents": [], "_interactable": true, @@ -4059,7 +4242,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 146 + "__id__": 153 }, "_id": "" }, @@ -4086,47 +4269,47 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 2 + "__id__": 132 }, "_children": [ { - "__id__": 161 + "__id__": 168 }, { - "__id__": 191 + "__id__": 198 }, { - "__id__": 221 + "__id__": 228 }, { - "__id__": 251 + "__id__": 258 }, { - "__id__": 281 + "__id__": 288 }, { - "__id__": 311 + "__id__": 318 } ], "_active": true, "_components": [ { - "__id__": 341 + "__id__": 348 }, { - "__id__": 343 + "__id__": 350 }, { - "__id__": 345 + "__id__": 352 } ], "_prefab": { - "__id__": 347 + "__id__": 354 }, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -520.023, + "y": -88.90899999999999, "z": 0 }, "_lrot": { @@ -4158,36 +4341,36 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 160 + "__id__": 167 }, "_children": [ { - "__id__": 162 + "__id__": 169 }, { - "__id__": 168 + "__id__": 175 }, { - "__id__": 174 + "__id__": 181 } ], "_active": true, "_components": [ { - "__id__": 182 + "__id__": 189 }, { - "__id__": 184 + "__id__": 191 }, { - "__id__": 186 + "__id__": 193 }, { - "__id__": 188 + "__id__": 195 } ], "_prefab": { - "__id__": 190 + "__id__": 197 }, "_lpos": { "__type__": "cc.Vec3", @@ -4224,20 +4407,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 161 + "__id__": 168 }, "_children": [], "_active": true, "_components": [ { - "__id__": 163 + "__id__": 170 }, { - "__id__": 165 + "__id__": 172 } ], "_prefab": { - "__id__": 167 + "__id__": 174 }, "_lpos": { "__type__": "cc.Vec3", @@ -4274,11 +4457,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 162 + "__id__": 169 }, "_enabled": true, "__prefab": { - "__id__": 164 + "__id__": 171 }, "_contentSize": { "__type__": "cc.Size", @@ -4302,11 +4485,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 162 + "__id__": 169 }, "_enabled": true, "__prefab": { - "__id__": 166 + "__id__": 173 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4360,20 +4543,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 161 + "__id__": 168 }, "_children": [], "_active": true, "_components": [ { - "__id__": 169 + "__id__": 176 }, { - "__id__": 171 + "__id__": 178 } ], "_prefab": { - "__id__": 173 + "__id__": 180 }, "_lpos": { "__type__": "cc.Vec3", @@ -4410,11 +4593,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 168 + "__id__": 175 }, "_enabled": true, "__prefab": { - "__id__": 170 + "__id__": 177 }, "_contentSize": { "__type__": "cc.Size", @@ -4438,11 +4621,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 168 + "__id__": 175 }, "_enabled": true, "__prefab": { - "__id__": 172 + "__id__": 179 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4519,23 +4702,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 161 + "__id__": 168 }, "_children": [], "_active": true, "_components": [ { - "__id__": 175 + "__id__": 182 }, { - "__id__": 177 + "__id__": 184 }, { - "__id__": 179 + "__id__": 186 } ], "_prefab": { - "__id__": 181 + "__id__": 188 }, "_lpos": { "__type__": "cc.Vec3", @@ -4572,11 +4755,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 174 + "__id__": 181 }, "_enabled": true, "__prefab": { - "__id__": 176 + "__id__": 183 }, "_contentSize": { "__type__": "cc.Size", @@ -4600,11 +4783,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 174 + "__id__": 181 }, "_enabled": true, "__prefab": { - "__id__": 178 + "__id__": 185 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4668,11 +4851,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 174 + "__id__": 181 }, "_enabled": true, "__prefab": { - "__id__": 180 + "__id__": 187 }, "_alignFlags": 4, "_target": null, @@ -4717,11 +4900,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 161 + "__id__": 168 }, "_enabled": true, "__prefab": { - "__id__": 183 + "__id__": 190 }, "_contentSize": { "__type__": "cc.Size", @@ -4745,11 +4928,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 161 + "__id__": 168 }, "_enabled": true, "__prefab": { - "__id__": 185 + "__id__": 192 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4790,11 +4973,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 161 + "__id__": 168 }, "_enabled": true, "__prefab": { - "__id__": 187 + "__id__": 194 }, "clickEvents": [], "_interactable": true, @@ -4834,7 +5017,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 161 + "__id__": 168 }, "_id": "" }, @@ -4848,20 +5031,20 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 161 + "__id__": 168 }, "_enabled": true, "__prefab": { - "__id__": 189 + "__id__": 196 }, "count": { - "__id__": 171 + "__id__": 178 }, "price": { - "__id__": 177 + "__id__": 184 }, "icon": { - "__id__": 165 + "__id__": 172 }, "_id": "" }, @@ -4888,36 +5071,36 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 160 + "__id__": 167 }, "_children": [ { - "__id__": 192 + "__id__": 199 }, { - "__id__": 198 + "__id__": 205 }, { - "__id__": 204 + "__id__": 211 } ], "_active": true, "_components": [ { - "__id__": 212 + "__id__": 219 }, { - "__id__": 214 + "__id__": 221 }, { - "__id__": 216 + "__id__": 223 }, { - "__id__": 218 + "__id__": 225 } ], "_prefab": { - "__id__": 220 + "__id__": 227 }, "_lpos": { "__type__": "cc.Vec3", @@ -4954,20 +5137,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 191 + "__id__": 198 }, "_children": [], "_active": true, "_components": [ { - "__id__": 193 + "__id__": 200 }, { - "__id__": 195 + "__id__": 202 } ], "_prefab": { - "__id__": 197 + "__id__": 204 }, "_lpos": { "__type__": "cc.Vec3", @@ -5004,11 +5187,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 192 + "__id__": 199 }, "_enabled": true, "__prefab": { - "__id__": 194 + "__id__": 201 }, "_contentSize": { "__type__": "cc.Size", @@ -5032,11 +5215,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 192 + "__id__": 199 }, "_enabled": true, "__prefab": { - "__id__": 196 + "__id__": 203 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5090,20 +5273,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 191 + "__id__": 198 }, "_children": [], "_active": true, "_components": [ { - "__id__": 199 + "__id__": 206 }, { - "__id__": 201 + "__id__": 208 } ], "_prefab": { - "__id__": 203 + "__id__": 210 }, "_lpos": { "__type__": "cc.Vec3", @@ -5140,11 +5323,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 198 + "__id__": 205 }, "_enabled": true, "__prefab": { - "__id__": 200 + "__id__": 207 }, "_contentSize": { "__type__": "cc.Size", @@ -5168,11 +5351,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 198 + "__id__": 205 }, "_enabled": true, "__prefab": { - "__id__": 202 + "__id__": 209 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5249,23 +5432,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 191 + "__id__": 198 }, "_children": [], "_active": true, "_components": [ { - "__id__": 205 + "__id__": 212 }, { - "__id__": 207 + "__id__": 214 }, { - "__id__": 209 + "__id__": 216 } ], "_prefab": { - "__id__": 211 + "__id__": 218 }, "_lpos": { "__type__": "cc.Vec3", @@ -5302,11 +5485,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 204 + "__id__": 211 }, "_enabled": true, "__prefab": { - "__id__": 206 + "__id__": 213 }, "_contentSize": { "__type__": "cc.Size", @@ -5330,11 +5513,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 204 + "__id__": 211 }, "_enabled": true, "__prefab": { - "__id__": 208 + "__id__": 215 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5398,11 +5581,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 204 + "__id__": 211 }, "_enabled": true, "__prefab": { - "__id__": 210 + "__id__": 217 }, "_alignFlags": 4, "_target": null, @@ -5447,11 +5630,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 198 }, "_enabled": true, "__prefab": { - "__id__": 213 + "__id__": 220 }, "_contentSize": { "__type__": "cc.Size", @@ -5475,11 +5658,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 198 }, "_enabled": true, "__prefab": { - "__id__": 215 + "__id__": 222 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5520,11 +5703,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 198 }, "_enabled": true, "__prefab": { - "__id__": 217 + "__id__": 224 }, "clickEvents": [], "_interactable": true, @@ -5564,7 +5747,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 191 + "__id__": 198 }, "_id": "" }, @@ -5578,20 +5761,20 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 198 }, "_enabled": true, "__prefab": { - "__id__": 219 + "__id__": 226 }, "count": { - "__id__": 201 + "__id__": 208 }, "price": { - "__id__": 207 + "__id__": 214 }, "icon": { - "__id__": 195 + "__id__": 202 }, "_id": "" }, @@ -5618,36 +5801,36 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 160 + "__id__": 167 }, "_children": [ { - "__id__": 222 + "__id__": 229 }, { - "__id__": 228 + "__id__": 235 }, { - "__id__": 234 + "__id__": 241 } ], "_active": true, "_components": [ { - "__id__": 242 + "__id__": 249 }, { - "__id__": 244 + "__id__": 251 }, { - "__id__": 246 + "__id__": 253 }, { - "__id__": 248 + "__id__": 255 } ], "_prefab": { - "__id__": 250 + "__id__": 257 }, "_lpos": { "__type__": "cc.Vec3", @@ -5684,20 +5867,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 221 + "__id__": 228 }, "_children": [], "_active": true, "_components": [ { - "__id__": 223 + "__id__": 230 }, { - "__id__": 225 + "__id__": 232 } ], "_prefab": { - "__id__": 227 + "__id__": 234 }, "_lpos": { "__type__": "cc.Vec3", @@ -5734,11 +5917,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 222 + "__id__": 229 }, "_enabled": true, "__prefab": { - "__id__": 224 + "__id__": 231 }, "_contentSize": { "__type__": "cc.Size", @@ -5762,11 +5945,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 222 + "__id__": 229 }, "_enabled": true, "__prefab": { - "__id__": 226 + "__id__": 233 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5820,20 +6003,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 221 + "__id__": 228 }, "_children": [], "_active": true, "_components": [ { - "__id__": 229 + "__id__": 236 }, { - "__id__": 231 + "__id__": 238 } ], "_prefab": { - "__id__": 233 + "__id__": 240 }, "_lpos": { "__type__": "cc.Vec3", @@ -5870,11 +6053,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 228 + "__id__": 235 }, "_enabled": true, "__prefab": { - "__id__": 230 + "__id__": 237 }, "_contentSize": { "__type__": "cc.Size", @@ -5898,11 +6081,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 228 + "__id__": 235 }, "_enabled": true, "__prefab": { - "__id__": 232 + "__id__": 239 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5979,23 +6162,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 221 + "__id__": 228 }, "_children": [], "_active": true, "_components": [ { - "__id__": 235 + "__id__": 242 }, { - "__id__": 237 + "__id__": 244 }, { - "__id__": 239 + "__id__": 246 } ], "_prefab": { - "__id__": 241 + "__id__": 248 }, "_lpos": { "__type__": "cc.Vec3", @@ -6032,11 +6215,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 234 + "__id__": 241 }, "_enabled": true, "__prefab": { - "__id__": 236 + "__id__": 243 }, "_contentSize": { "__type__": "cc.Size", @@ -6060,11 +6243,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 234 + "__id__": 241 }, "_enabled": true, "__prefab": { - "__id__": 238 + "__id__": 245 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6128,11 +6311,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 234 + "__id__": 241 }, "_enabled": true, "__prefab": { - "__id__": 240 + "__id__": 247 }, "_alignFlags": 4, "_target": null, @@ -6177,11 +6360,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 221 + "__id__": 228 }, "_enabled": true, "__prefab": { - "__id__": 243 + "__id__": 250 }, "_contentSize": { "__type__": "cc.Size", @@ -6205,11 +6388,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 221 + "__id__": 228 }, "_enabled": true, "__prefab": { - "__id__": 245 + "__id__": 252 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6250,11 +6433,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 221 + "__id__": 228 }, "_enabled": true, "__prefab": { - "__id__": 247 + "__id__": 254 }, "clickEvents": [], "_interactable": true, @@ -6294,7 +6477,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 221 + "__id__": 228 }, "_id": "" }, @@ -6308,20 +6491,20 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 221 + "__id__": 228 }, "_enabled": true, "__prefab": { - "__id__": 249 + "__id__": 256 }, "count": { - "__id__": 231 + "__id__": 238 }, "price": { - "__id__": 237 + "__id__": 244 }, "icon": { - "__id__": 225 + "__id__": 232 }, "_id": "" }, @@ -6348,36 +6531,36 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 160 + "__id__": 167 }, "_children": [ { - "__id__": 252 + "__id__": 259 }, { - "__id__": 258 + "__id__": 265 }, { - "__id__": 264 + "__id__": 271 } ], "_active": true, "_components": [ { - "__id__": 272 + "__id__": 279 }, { - "__id__": 274 + "__id__": 281 }, { - "__id__": 276 + "__id__": 283 }, { - "__id__": 278 + "__id__": 285 } ], "_prefab": { - "__id__": 280 + "__id__": 287 }, "_lpos": { "__type__": "cc.Vec3", @@ -6414,20 +6597,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 251 + "__id__": 258 }, "_children": [], "_active": true, "_components": [ { - "__id__": 253 + "__id__": 260 }, { - "__id__": 255 + "__id__": 262 } ], "_prefab": { - "__id__": 257 + "__id__": 264 }, "_lpos": { "__type__": "cc.Vec3", @@ -6464,11 +6647,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 252 + "__id__": 259 }, "_enabled": true, "__prefab": { - "__id__": 254 + "__id__": 261 }, "_contentSize": { "__type__": "cc.Size", @@ -6492,11 +6675,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 252 + "__id__": 259 }, "_enabled": true, "__prefab": { - "__id__": 256 + "__id__": 263 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6550,20 +6733,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 251 + "__id__": 258 }, "_children": [], "_active": true, "_components": [ { - "__id__": 259 + "__id__": 266 }, { - "__id__": 261 + "__id__": 268 } ], "_prefab": { - "__id__": 263 + "__id__": 270 }, "_lpos": { "__type__": "cc.Vec3", @@ -6600,11 +6783,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 258 + "__id__": 265 }, "_enabled": true, "__prefab": { - "__id__": 260 + "__id__": 267 }, "_contentSize": { "__type__": "cc.Size", @@ -6628,11 +6811,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 258 + "__id__": 265 }, "_enabled": true, "__prefab": { - "__id__": 262 + "__id__": 269 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6709,23 +6892,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 251 + "__id__": 258 }, "_children": [], "_active": true, "_components": [ { - "__id__": 265 + "__id__": 272 }, { - "__id__": 267 + "__id__": 274 }, { - "__id__": 269 + "__id__": 276 } ], "_prefab": { - "__id__": 271 + "__id__": 278 }, "_lpos": { "__type__": "cc.Vec3", @@ -6762,11 +6945,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 264 + "__id__": 271 }, "_enabled": true, "__prefab": { - "__id__": 266 + "__id__": 273 }, "_contentSize": { "__type__": "cc.Size", @@ -6790,11 +6973,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 264 + "__id__": 271 }, "_enabled": true, "__prefab": { - "__id__": 268 + "__id__": 275 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6858,11 +7041,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 264 + "__id__": 271 }, "_enabled": true, "__prefab": { - "__id__": 270 + "__id__": 277 }, "_alignFlags": 4, "_target": null, @@ -6907,11 +7090,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 251 + "__id__": 258 }, "_enabled": true, "__prefab": { - "__id__": 273 + "__id__": 280 }, "_contentSize": { "__type__": "cc.Size", @@ -6935,11 +7118,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 251 + "__id__": 258 }, "_enabled": true, "__prefab": { - "__id__": 275 + "__id__": 282 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6980,11 +7163,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 251 + "__id__": 258 }, "_enabled": true, "__prefab": { - "__id__": 277 + "__id__": 284 }, "clickEvents": [], "_interactable": true, @@ -7024,7 +7207,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 251 + "__id__": 258 }, "_id": "" }, @@ -7038,20 +7221,20 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 251 + "__id__": 258 }, "_enabled": true, "__prefab": { - "__id__": 279 + "__id__": 286 }, "count": { - "__id__": 261 + "__id__": 268 }, "price": { - "__id__": 267 + "__id__": 274 }, "icon": { - "__id__": 255 + "__id__": 262 }, "_id": "" }, @@ -7078,36 +7261,36 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 160 + "__id__": 167 }, "_children": [ { - "__id__": 282 + "__id__": 289 }, { - "__id__": 288 + "__id__": 295 }, { - "__id__": 294 + "__id__": 301 } ], "_active": true, "_components": [ { - "__id__": 302 + "__id__": 309 }, { - "__id__": 304 + "__id__": 311 }, { - "__id__": 306 + "__id__": 313 }, { - "__id__": 308 + "__id__": 315 } ], "_prefab": { - "__id__": 310 + "__id__": 317 }, "_lpos": { "__type__": "cc.Vec3", @@ -7144,20 +7327,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 281 + "__id__": 288 }, "_children": [], "_active": true, "_components": [ { - "__id__": 283 + "__id__": 290 }, { - "__id__": 285 + "__id__": 292 } ], "_prefab": { - "__id__": 287 + "__id__": 294 }, "_lpos": { "__type__": "cc.Vec3", @@ -7194,11 +7377,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 282 + "__id__": 289 }, "_enabled": true, "__prefab": { - "__id__": 284 + "__id__": 291 }, "_contentSize": { "__type__": "cc.Size", @@ -7222,11 +7405,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 282 + "__id__": 289 }, "_enabled": true, "__prefab": { - "__id__": 286 + "__id__": 293 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -7280,20 +7463,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 281 + "__id__": 288 }, "_children": [], "_active": true, "_components": [ { - "__id__": 289 + "__id__": 296 }, { - "__id__": 291 + "__id__": 298 } ], "_prefab": { - "__id__": 293 + "__id__": 300 }, "_lpos": { "__type__": "cc.Vec3", @@ -7330,11 +7513,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 288 + "__id__": 295 }, "_enabled": true, "__prefab": { - "__id__": 290 + "__id__": 297 }, "_contentSize": { "__type__": "cc.Size", @@ -7358,11 +7541,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 288 + "__id__": 295 }, "_enabled": true, "__prefab": { - "__id__": 292 + "__id__": 299 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -7439,23 +7622,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 281 + "__id__": 288 }, "_children": [], "_active": true, "_components": [ { - "__id__": 295 + "__id__": 302 }, { - "__id__": 297 + "__id__": 304 }, { - "__id__": 299 + "__id__": 306 } ], "_prefab": { - "__id__": 301 + "__id__": 308 }, "_lpos": { "__type__": "cc.Vec3", @@ -7492,11 +7675,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 294 + "__id__": 301 }, "_enabled": true, "__prefab": { - "__id__": 296 + "__id__": 303 }, "_contentSize": { "__type__": "cc.Size", @@ -7520,11 +7703,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 294 + "__id__": 301 }, "_enabled": true, "__prefab": { - "__id__": 298 + "__id__": 305 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -7588,11 +7771,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 294 + "__id__": 301 }, "_enabled": true, "__prefab": { - "__id__": 300 + "__id__": 307 }, "_alignFlags": 4, "_target": null, @@ -7637,11 +7820,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 281 + "__id__": 288 }, "_enabled": true, "__prefab": { - "__id__": 303 + "__id__": 310 }, "_contentSize": { "__type__": "cc.Size", @@ -7665,11 +7848,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 281 + "__id__": 288 }, "_enabled": true, "__prefab": { - "__id__": 305 + "__id__": 312 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -7710,11 +7893,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 281 + "__id__": 288 }, "_enabled": true, "__prefab": { - "__id__": 307 + "__id__": 314 }, "clickEvents": [], "_interactable": true, @@ -7754,7 +7937,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 281 + "__id__": 288 }, "_id": "" }, @@ -7768,20 +7951,20 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 281 + "__id__": 288 }, "_enabled": true, "__prefab": { - "__id__": 309 + "__id__": 316 }, "count": { - "__id__": 291 + "__id__": 298 }, "price": { - "__id__": 297 + "__id__": 304 }, "icon": { - "__id__": 285 + "__id__": 292 }, "_id": "" }, @@ -7808,36 +7991,36 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 160 + "__id__": 167 }, "_children": [ { - "__id__": 312 + "__id__": 319 }, { - "__id__": 318 + "__id__": 325 }, { - "__id__": 324 + "__id__": 331 } ], "_active": true, "_components": [ { - "__id__": 332 + "__id__": 339 }, { - "__id__": 334 + "__id__": 341 }, { - "__id__": 336 + "__id__": 343 }, { - "__id__": 338 + "__id__": 345 } ], "_prefab": { - "__id__": 340 + "__id__": 347 }, "_lpos": { "__type__": "cc.Vec3", @@ -7874,20 +8057,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 311 + "__id__": 318 }, "_children": [], "_active": true, "_components": [ { - "__id__": 313 + "__id__": 320 }, { - "__id__": 315 + "__id__": 322 } ], "_prefab": { - "__id__": 317 + "__id__": 324 }, "_lpos": { "__type__": "cc.Vec3", @@ -7924,11 +8107,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 312 + "__id__": 319 }, "_enabled": true, "__prefab": { - "__id__": 314 + "__id__": 321 }, "_contentSize": { "__type__": "cc.Size", @@ -7952,11 +8135,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 312 + "__id__": 319 }, "_enabled": true, "__prefab": { - "__id__": 316 + "__id__": 323 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -8010,20 +8193,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 311 + "__id__": 318 }, "_children": [], "_active": true, "_components": [ { - "__id__": 319 + "__id__": 326 }, { - "__id__": 321 + "__id__": 328 } ], "_prefab": { - "__id__": 323 + "__id__": 330 }, "_lpos": { "__type__": "cc.Vec3", @@ -8060,11 +8243,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 318 + "__id__": 325 }, "_enabled": true, "__prefab": { - "__id__": 320 + "__id__": 327 }, "_contentSize": { "__type__": "cc.Size", @@ -8088,11 +8271,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 318 + "__id__": 325 }, "_enabled": true, "__prefab": { - "__id__": 322 + "__id__": 329 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -8169,23 +8352,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 311 + "__id__": 318 }, "_children": [], "_active": true, "_components": [ { - "__id__": 325 + "__id__": 332 }, { - "__id__": 327 + "__id__": 334 }, { - "__id__": 329 + "__id__": 336 } ], "_prefab": { - "__id__": 331 + "__id__": 338 }, "_lpos": { "__type__": "cc.Vec3", @@ -8222,11 +8405,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 324 + "__id__": 331 }, "_enabled": true, "__prefab": { - "__id__": 326 + "__id__": 333 }, "_contentSize": { "__type__": "cc.Size", @@ -8250,11 +8433,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 324 + "__id__": 331 }, "_enabled": true, "__prefab": { - "__id__": 328 + "__id__": 335 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -8318,11 +8501,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 324 + "__id__": 331 }, "_enabled": true, "__prefab": { - "__id__": 330 + "__id__": 337 }, "_alignFlags": 4, "_target": null, @@ -8367,11 +8550,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 311 + "__id__": 318 }, "_enabled": true, "__prefab": { - "__id__": 333 + "__id__": 340 }, "_contentSize": { "__type__": "cc.Size", @@ -8395,11 +8578,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 311 + "__id__": 318 }, "_enabled": true, "__prefab": { - "__id__": 335 + "__id__": 342 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -8440,11 +8623,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 311 + "__id__": 318 }, "_enabled": true, "__prefab": { - "__id__": 337 + "__id__": 344 }, "clickEvents": [], "_interactable": true, @@ -8484,7 +8667,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 311 + "__id__": 318 }, "_id": "" }, @@ -8498,20 +8681,20 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 311 + "__id__": 318 }, "_enabled": true, "__prefab": { - "__id__": 339 + "__id__": 346 }, "count": { - "__id__": 321 + "__id__": 328 }, "price": { - "__id__": 327 + "__id__": 334 }, "icon": { - "__id__": 315 + "__id__": 322 }, "_id": "" }, @@ -8538,11 +8721,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 160 + "__id__": 167 }, "_enabled": true, "__prefab": { - "__id__": 342 + "__id__": 349 }, "_contentSize": { "__type__": "cc.Size", @@ -8566,11 +8749,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 160 + "__id__": 167 }, "_enabled": true, "__prefab": { - "__id__": 344 + "__id__": 351 }, "_resizeMode": 1, "_layoutType": 3, @@ -8604,11 +8787,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 160 + "__id__": 167 }, "_enabled": true, "__prefab": { - "__id__": 346 + "__id__": 353 }, "_alignFlags": 16, "_target": null, @@ -8647,6 +8830,83 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 132 + }, + "_enabled": true, + "__prefab": { + "__id__": 356 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 1000 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "45eKrLZ6ZG8oqzlQq31Gnm" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 132 + }, + "_enabled": true, + "__prefab": { + "__id__": 358 + }, + "_alignFlags": 5, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 1101.114, + "_bottom": 238.88599999999997, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 1000, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b4Sg809CpDv6gDmwsB45W5" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "004R+7yJlCaK85GzBiH5Y2", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -8657,7 +8917,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 349 + "__id__": 361 }, "_contentSize": { "__type__": "cc.Size", @@ -8685,7 +8945,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 351 + "__id__": 363 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -8730,7 +8990,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 353 + "__id__": 365 }, "_alignFlags": 45, "_target": null, @@ -8765,8 +9025,6 @@ "__id__": 0 }, "fileId": "8dc0NuR9RL2Z5AGk4CecAE", - "instance": null, - "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -8779,7 +9037,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 356 + "__id__": 368 }, "_contentSize": { "__type__": "cc.Size", @@ -8807,7 +9065,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 358 + "__id__": 370 }, "_alignFlags": 45, "_target": null, @@ -8843,7 +9101,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 360 + "__id__": 372 }, "_id": "" }, @@ -8861,27 +9119,27 @@ }, "_enabled": true, "__prefab": { - "__id__": 362 + "__id__": 374 }, "m_rootNode": null, "items": [ { - "__id__": 188 + "__id__": 195 }, { - "__id__": 218 + "__id__": 225 }, { - "__id__": 248 + "__id__": 255 }, { - "__id__": 278 + "__id__": 285 }, { - "__id__": 308 + "__id__": 315 }, { - "__id__": 338 + "__id__": 345 } ], "_id": "" diff --git a/assets/bundles/Chat18x/Web3PopPanel.prefab b/assets/bundles/Chat18x/Web3PopPanel.prefab index 4e3a7154..0601d0cf 100644 --- a/assets/bundles/Chat18x/Web3PopPanel.prefab +++ b/assets/bundles/Chat18x/Web3PopPanel.prefab @@ -37,26 +37,26 @@ "__id__": 86 }, { - "__id__": 184 + "__id__": 202 }, { - "__id__": 216 + "__id__": 234 } ], "_active": true, "_components": [ { - "__id__": 236 + "__id__": 254 }, { - "__id__": 238 + "__id__": 256 }, { - "__id__": 240 + "__id__": 258 } ], "_prefab": { - "__id__": 242 + "__id__": 260 }, "_lpos": { "__type__": "cc.Vec3", @@ -1851,7 +1851,7 @@ }, { "__type__": "cc.Node", - "_name": "erweima", + "_name": "qrCode", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -1873,7 +1873,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -68.40200000000004, + "y": -54.40100000000007, "z": 0 }, "_lrot": { @@ -1913,8 +1913,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 261, - "height": 261 + "width": 320, + "height": 320 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1949,13 +1949,10 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "a9cc1220-5e62-4d8d-9dd2-7c323d863993@f9941", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -2169,11 +2166,11 @@ "_active": true, "_components": [ { - "__id__": 181 + "__id__": 199 } ], "_prefab": { - "__id__": 183 + "__id__": 201 }, "_lpos": { "__type__": "cc.Vec3", @@ -3017,22 +3014,25 @@ }, { "__id__": 156 + }, + { + "__id__": 174 } ], "_active": true, "_components": [ { - "__id__": 174 + "__id__": 192 }, { - "__id__": 176 + "__id__": 194 }, { - "__id__": 178 + "__id__": 196 } ], "_prefab": { - "__id__": 180 + "__id__": 198 }, "_lpos": { "__type__": "cc.Vec3", @@ -3050,7 +3050,7 @@ "_lscale": { "__type__": "cc.Vec3", "x": 1, - "y": 1, + "y": 0, "z": 1 }, "_mobility": 0, @@ -3065,7 +3065,7 @@ }, { "__type__": "cc.Node", - "_name": "CoinType1", + "_name": "ENT_TRON", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -3514,7 +3514,7 @@ }, { "__type__": "cc.Node", - "_name": "CoinType2", + "_name": "ENT_TON", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -3963,7 +3963,7 @@ }, { "__type__": "cc.Node", - "_name": "CoinType3", + "_name": "ENT_BEP", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -4410,6 +4410,455 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "ENT_ETH", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 119 + }, + "_children": [ + { + "__id__": 175 + }, + { + "__id__": 181 + } + ], + "_active": true, + "_components": [ + { + "__id__": 187 + }, + { + "__id__": 189 + } + ], + "_prefab": { + "__id__": 191 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -315, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "CoinIcon-003", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 174 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 176 + }, + { + "__id__": 178 + } + ], + "_prefab": { + "__id__": 180 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -172.75099999999998, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 175 + }, + "_enabled": true, + "__prefab": { + "__id__": 177 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 70, + "height": 70 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "53OvHy65VNOY1Bdclq7kzW" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 175 + }, + "_enabled": true, + "__prefab": { + "__id__": 179 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "51d2ab04-4a3e-4872-b41a-c3b752734c3c@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 1, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a5QIpFVM1LyYZulhYhciJm" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "05ue6w/WlBRpfxzN37bALb", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 174 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 182 + }, + { + "__id__": 184 + } + ], + "_prefab": { + "__id__": 186 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -69.14800000000002, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 181 + }, + "_enabled": true, + "__prefab": { + "__id__": 183 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 112.095703125, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e2s3K6y79FiZwsEP6Ypw1J" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 181 + }, + "_enabled": true, + "__prefab": { + "__id__": 185 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 245, + "g": 249, + "b": 255, + "a": 255 + }, + "_string": "Solana", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 36, + "_fontSize": 36, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b6t4/tTdpB9LL6h0LqOeOi" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "431tSCyCdKqLEmb1L3Hi67", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 174 + }, + "_enabled": true, + "__prefab": { + "__id__": 188 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 449, + "height": 90 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3eE6i8XkBK/JSHDcEjWfb8" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 174 + }, + "_enabled": true, + "__prefab": { + "__id__": 190 + }, + "clickEvents": [], + "_interactable": true, + "_transition": 1, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3bvXxbxlFNPaqA999YwRUz" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "4fFn0RCSRBC4o6dMF3xWQp", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -4420,12 +4869,12 @@ }, "_enabled": true, "__prefab": { - "__id__": 175 + "__id__": 193 }, "_contentSize": { "__type__": "cc.Size", "width": 449, - "height": 270 + "height": 360 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -4448,7 +4897,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 177 + "__id__": 195 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4493,7 +4942,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 179 + "__id__": 197 }, "_resizeMode": 0, "_layoutType": 2, @@ -4544,7 +4993,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 182 + "__id__": 200 }, "_contentSize": { "__type__": "cc.Size", @@ -4585,23 +5034,23 @@ }, "_children": [ { - "__id__": 185 + "__id__": 203 }, { - "__id__": 191 + "__id__": 209 }, { - "__id__": 199 + "__id__": 217 } ], "_active": true, "_components": [ { - "__id__": 213 + "__id__": 231 } ], "_prefab": { - "__id__": 215 + "__id__": 233 }, "_lpos": { "__type__": "cc.Vec3", @@ -4638,20 +5087,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 184 + "__id__": 202 }, "_children": [], "_active": true, "_components": [ { - "__id__": 186 + "__id__": 204 }, { - "__id__": 188 + "__id__": 206 } ], "_prefab": { - "__id__": 190 + "__id__": 208 }, "_lpos": { "__type__": "cc.Vec3", @@ -4688,11 +5137,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 185 + "__id__": 203 }, "_enabled": true, "__prefab": { - "__id__": 187 + "__id__": 205 }, "_contentSize": { "__type__": "cc.Size", @@ -4716,11 +5165,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 185 + "__id__": 203 }, "_enabled": true, "__prefab": { - "__id__": 189 + "__id__": 207 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4800,23 +5249,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 184 + "__id__": 202 }, "_children": [], "_active": true, "_components": [ { - "__id__": 192 + "__id__": 210 }, { - "__id__": 194 + "__id__": 212 }, { - "__id__": 196 + "__id__": 214 } ], "_prefab": { - "__id__": 198 + "__id__": 216 }, "_lpos": { "__type__": "cc.Vec3", @@ -4853,11 +5302,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 209 }, "_enabled": true, "__prefab": { - "__id__": 193 + "__id__": 211 }, "_contentSize": { "__type__": "cc.Size", @@ -4881,11 +5330,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 209 }, "_enabled": true, "__prefab": { - "__id__": 195 + "__id__": 213 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4949,11 +5398,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 191 + "__id__": 209 }, "_enabled": true, "__prefab": { - "__id__": 197 + "__id__": 215 }, "_alignFlags": 0, "_target": null, @@ -4998,27 +5447,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 184 + "__id__": 202 }, "_children": [ { - "__id__": 200 + "__id__": 218 } ], "_active": true, "_components": [ { - "__id__": 206 + "__id__": 224 }, { - "__id__": 208 + "__id__": 226 }, { - "__id__": 210 + "__id__": 228 } ], "_prefab": { - "__id__": 212 + "__id__": 230 }, "_lpos": { "__type__": "cc.Vec3", @@ -5055,20 +5504,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 199 + "__id__": 217 }, "_children": [], "_active": true, "_components": [ { - "__id__": 201 + "__id__": 219 }, { - "__id__": 203 + "__id__": 221 } ], "_prefab": { - "__id__": 205 + "__id__": 223 }, "_lpos": { "__type__": "cc.Vec3", @@ -5105,11 +5554,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 200 + "__id__": 218 }, "_enabled": true, "__prefab": { - "__id__": 202 + "__id__": 220 }, "_contentSize": { "__type__": "cc.Size", @@ -5133,11 +5582,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 200 + "__id__": 218 }, "_enabled": true, "__prefab": { - "__id__": 204 + "__id__": 222 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5214,11 +5663,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 199 + "__id__": 217 }, "_enabled": true, "__prefab": { - "__id__": 207 + "__id__": 225 }, "_contentSize": { "__type__": "cc.Size", @@ -5242,11 +5691,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 199 + "__id__": 217 }, "_enabled": true, "__prefab": { - "__id__": 209 + "__id__": 227 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5287,11 +5736,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 199 + "__id__": 217 }, "_enabled": true, "__prefab": { - "__id__": 211 + "__id__": 229 }, "clickEvents": [], "_interactable": true, @@ -5343,7 +5792,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 199 + "__id__": 217 }, "_id": "" }, @@ -5370,11 +5819,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 184 + "__id__": 202 }, "_enabled": true, "__prefab": { - "__id__": 214 + "__id__": 232 }, "_contentSize": { "__type__": "cc.Size", @@ -5415,23 +5864,23 @@ }, "_children": [ { - "__id__": 217 + "__id__": 235 }, { - "__id__": 225 + "__id__": 243 } ], "_active": true, "_components": [ { - "__id__": 231 + "__id__": 249 }, { - "__id__": 233 + "__id__": 251 } ], "_prefab": { - "__id__": 235 + "__id__": 253 }, "_lpos": { "__type__": "cc.Vec3", @@ -5468,23 +5917,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 216 + "__id__": 234 }, "_children": [], "_active": true, "_components": [ { - "__id__": 218 + "__id__": 236 }, { - "__id__": 220 + "__id__": 238 }, { - "__id__": 222 + "__id__": 240 } ], "_prefab": { - "__id__": 224 + "__id__": 242 }, "_lpos": { "__type__": "cc.Vec3", @@ -5521,11 +5970,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 217 + "__id__": 235 }, "_enabled": true, "__prefab": { - "__id__": 219 + "__id__": 237 }, "_contentSize": { "__type__": "cc.Size", @@ -5549,11 +5998,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 217 + "__id__": 235 }, "_enabled": true, "__prefab": { - "__id__": 221 + "__id__": 239 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5594,11 +6043,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 217 + "__id__": 235 }, "_enabled": true, "__prefab": { - "__id__": 223 + "__id__": 241 }, "_alignFlags": 9, "_target": null, @@ -5643,20 +6092,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 216 + "__id__": 234 }, "_children": [], "_active": true, "_components": [ { - "__id__": 226 + "__id__": 244 }, { - "__id__": 228 + "__id__": 246 } ], "_prefab": { - "__id__": 230 + "__id__": 248 }, "_lpos": { "__type__": "cc.Vec3", @@ -5693,11 +6142,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 225 + "__id__": 243 }, "_enabled": true, "__prefab": { - "__id__": 227 + "__id__": 245 }, "_contentSize": { "__type__": "cc.Size", @@ -5721,11 +6170,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 225 + "__id__": 243 }, "_enabled": true, "__prefab": { - "__id__": 229 + "__id__": 247 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5802,11 +6251,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 216 + "__id__": 234 }, "_enabled": true, "__prefab": { - "__id__": 232 + "__id__": 250 }, "_contentSize": { "__type__": "cc.Size", @@ -5830,11 +6279,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 216 + "__id__": 234 }, "_enabled": true, "__prefab": { - "__id__": 234 + "__id__": 252 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5915,7 +6364,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 237 + "__id__": 255 }, "_contentSize": { "__type__": "cc.Size", @@ -5943,7 +6392,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 239 + "__id__": 257 }, "_alignFlags": 45, "_target": null, @@ -5979,7 +6428,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 241 + "__id__": 259 }, "m_rootNode": null, "_id": "" diff --git a/assets/resources/ui/shop/coin/2001.png b/assets/resources/ui/shop/coin/1001.png similarity index 100% rename from assets/resources/ui/shop/coin/2001.png rename to assets/resources/ui/shop/coin/1001.png diff --git a/assets/resources/ui/shop/coin/2001.png.meta b/assets/resources/ui/shop/coin/1001.png.meta similarity index 97% rename from assets/resources/ui/shop/coin/2001.png.meta rename to assets/resources/ui/shop/coin/1001.png.meta index cb3dfaa9..c9269f93 100644 --- a/assets/resources/ui/shop/coin/2001.png.meta +++ b/assets/resources/ui/shop/coin/1001.png.meta @@ -11,7 +11,7 @@ "6c48a": { "importer": "texture", "uuid": "6a5c6f1e-d197-4f9c-8113-6732295ebf8e@6c48a", - "displayName": "2001", + "displayName": "1001", "id": "6c48a", "name": "texture", "userData": { @@ -35,7 +35,7 @@ "f9941": { "importer": "sprite-frame", "uuid": "6a5c6f1e-d197-4f9c-8113-6732295ebf8e@f9941", - "displayName": "2001", + "displayName": "1001", "id": "f9941", "name": "spriteFrame", "userData": { diff --git a/assets/resources/ui/shop/coin/2002.png b/assets/resources/ui/shop/coin/1002.png similarity index 100% rename from assets/resources/ui/shop/coin/2002.png rename to assets/resources/ui/shop/coin/1002.png diff --git a/assets/resources/ui/shop/coin/2002.png.meta b/assets/resources/ui/shop/coin/1002.png.meta similarity index 97% rename from assets/resources/ui/shop/coin/2002.png.meta rename to assets/resources/ui/shop/coin/1002.png.meta index b3e0d526..ad620c2b 100644 --- a/assets/resources/ui/shop/coin/2002.png.meta +++ b/assets/resources/ui/shop/coin/1002.png.meta @@ -11,7 +11,7 @@ "6c48a": { "importer": "texture", "uuid": "d75397cc-79ea-4678-9387-fec0502ae091@6c48a", - "displayName": "2002", + "displayName": "1002", "id": "6c48a", "name": "texture", "userData": { @@ -35,7 +35,7 @@ "f9941": { "importer": "sprite-frame", "uuid": "d75397cc-79ea-4678-9387-fec0502ae091@f9941", - "displayName": "2002", + "displayName": "1002", "id": "f9941", "name": "spriteFrame", "userData": { diff --git a/assets/resources/ui/shop/coin/2003.png b/assets/resources/ui/shop/coin/1003.png similarity index 100% rename from assets/resources/ui/shop/coin/2003.png rename to assets/resources/ui/shop/coin/1003.png diff --git a/assets/resources/ui/shop/coin/2003.png.meta b/assets/resources/ui/shop/coin/1003.png.meta similarity index 97% rename from assets/resources/ui/shop/coin/2003.png.meta rename to assets/resources/ui/shop/coin/1003.png.meta index 621328e5..fe7c67c8 100644 --- a/assets/resources/ui/shop/coin/2003.png.meta +++ b/assets/resources/ui/shop/coin/1003.png.meta @@ -11,7 +11,7 @@ "6c48a": { "importer": "texture", "uuid": "f944a7b5-bc82-484f-a5e9-904fcb317707@6c48a", - "displayName": "2003", + "displayName": "1003", "id": "6c48a", "name": "texture", "userData": { @@ -35,7 +35,7 @@ "f9941": { "importer": "sprite-frame", "uuid": "f944a7b5-bc82-484f-a5e9-904fcb317707@f9941", - "displayName": "2003", + "displayName": "1003", "id": "f9941", "name": "spriteFrame", "userData": { diff --git a/assets/resources/ui/shop/coin/2004.png b/assets/resources/ui/shop/coin/1004.png similarity index 100% rename from assets/resources/ui/shop/coin/2004.png rename to assets/resources/ui/shop/coin/1004.png diff --git a/assets/resources/ui/shop/coin/2004.png.meta b/assets/resources/ui/shop/coin/1004.png.meta similarity index 97% rename from assets/resources/ui/shop/coin/2004.png.meta rename to assets/resources/ui/shop/coin/1004.png.meta index 7c579f46..752cdb01 100644 --- a/assets/resources/ui/shop/coin/2004.png.meta +++ b/assets/resources/ui/shop/coin/1004.png.meta @@ -11,7 +11,7 @@ "6c48a": { "importer": "texture", "uuid": "1d7c6978-98a0-47a4-a62b-9f31a7d07617@6c48a", - "displayName": "2004", + "displayName": "1004", "id": "6c48a", "name": "texture", "userData": { @@ -35,7 +35,7 @@ "f9941": { "importer": "sprite-frame", "uuid": "1d7c6978-98a0-47a4-a62b-9f31a7d07617@f9941", - "displayName": "2004", + "displayName": "1004", "id": "f9941", "name": "spriteFrame", "userData": { diff --git a/assets/resources/ui/shop/coin/2005.png b/assets/resources/ui/shop/coin/1005.png similarity index 100% rename from assets/resources/ui/shop/coin/2005.png rename to assets/resources/ui/shop/coin/1005.png diff --git a/assets/resources/ui/shop/coin/2005.png.meta b/assets/resources/ui/shop/coin/1005.png.meta similarity index 97% rename from assets/resources/ui/shop/coin/2005.png.meta rename to assets/resources/ui/shop/coin/1005.png.meta index 1ee8a5e2..eb604635 100644 --- a/assets/resources/ui/shop/coin/2005.png.meta +++ b/assets/resources/ui/shop/coin/1005.png.meta @@ -11,7 +11,7 @@ "6c48a": { "importer": "texture", "uuid": "c41d8e92-69ca-4705-a43c-b134a367875e@6c48a", - "displayName": "2005", + "displayName": "1005", "id": "6c48a", "name": "texture", "userData": { @@ -35,7 +35,7 @@ "f9941": { "importer": "sprite-frame", "uuid": "c41d8e92-69ca-4705-a43c-b134a367875e@f9941", - "displayName": "2005", + "displayName": "1005", "id": "f9941", "name": "spriteFrame", "userData": { diff --git a/assets/resources/ui/shop/coin/2006.png b/assets/resources/ui/shop/coin/1006.png similarity index 100% rename from assets/resources/ui/shop/coin/2006.png rename to assets/resources/ui/shop/coin/1006.png diff --git a/assets/resources/ui/shop/coin/2006.png.meta b/assets/resources/ui/shop/coin/1006.png.meta similarity index 97% rename from assets/resources/ui/shop/coin/2006.png.meta rename to assets/resources/ui/shop/coin/1006.png.meta index 269253a0..33abe10a 100644 --- a/assets/resources/ui/shop/coin/2006.png.meta +++ b/assets/resources/ui/shop/coin/1006.png.meta @@ -11,7 +11,7 @@ "6c48a": { "importer": "texture", "uuid": "c1263d7c-a965-4ec8-a65a-bf514532b5d0@6c48a", - "displayName": "2006", + "displayName": "1006", "id": "6c48a", "name": "texture", "userData": { @@ -35,7 +35,7 @@ "f9941": { "importer": "sprite-frame", "uuid": "c1263d7c-a965-4ec8-a65a-bf514532b5d0@f9941", - "displayName": "2006", + "displayName": "1006", "id": "f9941", "name": "spriteFrame", "userData": { diff --git a/assets/utils/qrcodeGenerator.ts b/assets/utils/qrcodeGenerator.ts new file mode 100644 index 00000000..302af4d7 --- /dev/null +++ b/assets/utils/qrcodeGenerator.ts @@ -0,0 +1,208 @@ +import { Sprite, SpriteFrame, Texture2D, ImageAsset, Node } from 'cc'; +import qrcode from 'qrcode-generator'; + +/** + * 二维码生成工具类 + * 提供生成二维码Sprite的静态方法 + */ +export class QRCodeGenerator { + + /** + * 生成二维码 Sprite 组件(异步版本) + * @param text 要生成二维码的文本内容 + * @param size 二维码尺寸,默认256x256 + * @param margin 二维码边距,默认4 + * @param callback 完成回调函数 + */ + public static generateQRCodeSprite(text: string, size: number = 256, margin: number = 4, callback?: (sprite: Sprite | null) => void): void { + try { + if (!text || text.trim().length === 0) { + console.error('QRCodeGenerator: 文本内容不能为空'); + callback && callback(null); + return; + } + + this.generateQRCodeSpriteFrame(text, size, margin, (spriteFrame) => { + if (!spriteFrame) { + callback && callback(null); + return; + } + + try { + // 创建新节点和Sprite组件 + const node = new Node('QRCode'); + const sprite = node.addComponent(Sprite); + sprite.spriteFrame = spriteFrame; + + callback && callback(sprite); + } catch (error) { + console.error('QRCodeGenerator: 创建Sprite组件失败', error); + callback && callback(null); + } + }); + } catch (error) { + console.error('QRCodeGenerator: 生成二维码Sprite失败', error); + callback && callback(null); + } + } + + /** + * 生成二维码 SpriteFrame(异步版本) + * @param text 要生成二维码的文本内容 + * @param size 二维码尺寸,默认256x256 + * @param margin 二维码边距,默认4 + * @param callback 完成回调函数 + */ + public static generateQRCodeSpriteFrame(text: string, size: number = 256, margin: number = 4, callback?: (spriteFrame: SpriteFrame | null) => void): void { + try { + if (!text || text.trim().length === 0) { + console.error('QRCodeGenerator: 文本内容不能为空'); + callback && callback(null); + return; + } + + if (size <= 0 || size > 2048) { + console.error('QRCodeGenerator: 尺寸必须在1-2048之间'); + callback && callback(null); + return; + } + + // 生成二维码 + const qr = qrcode(0, 'M'); // 0表示自动类型选择,'M'表示中等纠错级别 + qr.addData(text); + qr.make(); + + // 创建Canvas绘制二维码 + const moduleCount = qr.getModuleCount(); + const cellSize = Math.floor((size - 2 * margin) / moduleCount); + const actualSize = cellSize * moduleCount + 2 * margin; + + const canvas = document.createElement('canvas'); + canvas.width = actualSize; + canvas.height = actualSize; + const ctx = canvas.getContext('2d'); + + if (!ctx) { + console.error('QRCodeGenerator: 无法获取Canvas上下文'); + callback && callback(null); + return; + } + + // 绘制白色背景 + ctx.fillStyle = '#ffffff'; + ctx.fillRect(0, 0, actualSize, actualSize); + + // 绘制二维码 + ctx.fillStyle = '#000000'; + for (let row = 0; row < moduleCount; row++) { + for (let col = 0; col < moduleCount; col++) { + if (qr.isDark(row, col)) { + ctx.fillRect( + margin + col * cellSize, + margin + row * cellSize, + cellSize, + cellSize + ); + } + } + } + + // 使用异步方式处理图片创建 + const img = new Image(); + img.onload = () => { + try { + // 创建ImageAsset并直接设置图片数据 + const imageAsset = new ImageAsset(img); + + // 创建Texture2D并设置ImageAsset + const texture = new Texture2D(); + texture.image = imageAsset; + + // 创建SpriteFrame并设置纹理 + const spriteFrame = new SpriteFrame(); + spriteFrame.texture = texture; + + callback && callback(spriteFrame); + } catch (error) { + console.error('QRCodeGenerator: 创建纹理失败', error); + callback && callback(null); + } + }; + + img.onerror = () => { + console.error('QRCodeGenerator: 图片加载失败'); + callback && callback(null); + }; + + // 设置图片源,触发加载 + img.src = canvas.toDataURL('image/png'); + + } catch (error) { + console.error('QRCodeGenerator: 生成二维码SpriteFrame失败', error); + callback && callback(null); + } + } + + /** + * 生成二维码的Base64字符串 + * @param text 要生成二维码的文本内容 + * @param size 二维码尺寸,默认256x256 + * @param margin 二维码边距,默认4 + * @returns 二维码的Base64字符串,失败时返回空字符串 + */ + public static generateQRCodeBase64(text: string, size: number = 256, margin: number = 4): string { + try { + if (!text || text.trim().length === 0) { + console.error('QRCodeGenerator: 文本内容不能为空'); + return ''; + } + + // 生成二维码 + const qr = qrcode(0, 'M'); + qr.addData(text); + qr.make(); + + // 创建Canvas绘制二维码 + const moduleCount = qr.getModuleCount(); + const cellSize = Math.floor((size - 2 * margin) / moduleCount); + const actualSize = cellSize * moduleCount + 2 * margin; + + const canvas = document.createElement('canvas'); + canvas.width = actualSize; + canvas.height = actualSize; + const ctx = canvas.getContext('2d'); + + if (!ctx) { + console.error('QRCodeGenerator: 无法获取Canvas上下文'); + return ''; + } + + // 绘制白色背景 + ctx.fillStyle = '#ffffff'; + ctx.fillRect(0, 0, actualSize, actualSize); + + // 绘制二维码 + ctx.fillStyle = '#000000'; + for (let row = 0; row < moduleCount; row++) { + for (let col = 0; col < moduleCount; col++) { + if (qr.isDark(row, col)) { + ctx.fillRect( + margin + col * cellSize, + margin + row * cellSize, + cellSize, + cellSize + ); + } + } + } + + // 返回Base64字符串 + return canvas.toDataURL('image/png'); + } catch (error) { + console.error('QRCodeGenerator: 生成二维码Base64失败', error); + return ''; + } + } +} + + diff --git a/assets/utils/qrcodeGenerator.ts.meta b/assets/utils/qrcodeGenerator.ts.meta new file mode 100644 index 00000000..c7793539 --- /dev/null +++ b/assets/utils/qrcodeGenerator.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "af3f0b82-68ae-4820-90af-594d57f19dda", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/package-lock.json b/package-lock.json index 6715db5d..e96277b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,8 @@ "dependencies": { "@google/genai": "^1.13.0", "buffer": "^6.0.3", - "protobufjs": "^7.5.3" + "protobufjs": "^7.5.3", + "qrcode-generator": "^2.0.4" }, "devDependencies": { "fs-extra": "^11.3.1", @@ -1086,6 +1087,12 @@ "node": ">=6" } }, + "node_modules/qrcode-generator": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-2.0.4.tgz", + "integrity": "sha512-mZSiP6RnbHl4xL2Ap5HfkjLnmxfKcPWpWe/c+5XxCuetEenqmNFf1FH/ftXPCtFG5/TDobjsjz6sSNL0Sr8Z9g==", + "license": "MIT" + }, "node_modules/requizzle": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", diff --git a/package.json b/package.json index 999f598c..d423f8b5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "dependencies": { "@google/genai": "^1.13.0", "buffer": "^6.0.3", - "protobufjs": "^7.5.3" + "protobufjs": "^7.5.3", + "qrcode-generator": "^2.0.4" }, "devDependencies": { "fs-extra": "^11.3.1",