This commit is contained in:
2025-07-17 17:18:21 +08:00
commit 1ffc1b5cf0
5309 changed files with 1150310 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 407 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "41e09b09-d5b9-4465-a604-b28cd186db53",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "41e09b09-d5b9-4465-a604-b28cd186db53@6c48a",
"displayName": "rose_laugh",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "41e09b09-d5b9-4465-a604-b28cd186db53",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "41e09b09-d5b9-4465-a604-b28cd186db53@f9941",
"displayName": "rose_laugh",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 10,
"offsetY": -6.5,
"trimX": 21,
"trimY": 13,
"width": 903,
"height": 1176,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-451.5,
-588,
0,
451.5,
-588,
0,
-451.5,
588,
0,
451.5,
588,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
21,
1176,
924,
1176,
21,
0,
924,
0
],
"nuv": [
0.022702702702702703,
0,
0.9989189189189189,
0,
0.022702702702702703,
0.9890664423885618,
0.9989189189189189,
0.9890664423885618
],
"minPos": [
-451.5,
-588,
0
],
"maxPos": [
451.5,
588,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "41e09b09-d5b9-4465-a604-b28cd186db53@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "41e09b09-d5b9-4465-a604-b28cd186db53@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

@@ -0,0 +1,663 @@
[
{
"__type__": "cc.Prefab",
"_name": "tjhy_Cell",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "tjhy_Cell",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 32
},
{
"__id__": 34
}
],
"_prefab": {
"__id__": 36
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"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.Node",
"_name": "hyLay1",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 13
},
{
"__id__": 15
}
],
"_prefab": {
"__id__": 17
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -180,
"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.Node",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_prefab": {
"__id__": 4
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 3
},
"asset": {
"__uuid__": "a05f1cc1-5ed9-4662-ae86-980b774e60fa",
"__expectedType__": "cc.Prefab"
},
"fileId": "88rZ2ljq9DH5H4fMqTusPo",
"instance": {
"__id__": 5
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "ffCiMl/+tG9qed9EMLuXzj",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 6
},
{
"__id__": 8
},
{
"__id__": 9
},
{
"__id__": 10
},
{
"__id__": 11
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 7
},
"propertyPath": [
"_name"
],
"value": "hyItem1"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"88rZ2ljq9DH5H4fMqTusPo"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 7
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 7
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 7
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 12
},
"propertyPath": [
"_lscale"
],
"value": {
"__type__": "cc.Vec3",
"x": 0.278,
"y": 0.278,
"z": 1
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"0agzFBV6hONJ/q1pdcn4DA"
]
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_contentSize": {
"__type__": "cc.Size",
"width": 360,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c44fFsWI5Ch7qyK40NL9gM"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 16
},
"_alignFlags": 40,
"_target": null,
"_left": 0,
"_right": 0.5,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": false,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0dkV3REVlGNLl8lruFfCn9"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "3dkW7RsY9B6q7a+OPfAq3U",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "hyLay2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 19
}
],
"_active": true,
"_components": [
{
"__id__": 27
},
{
"__id__": 29
}
],
"_prefab": {
"__id__": 31
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 180,
"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.Node",
"_objFlags": 0,
"_parent": {
"__id__": 18
},
"_prefab": {
"__id__": 20
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 19
},
"asset": {
"__uuid__": "a05f1cc1-5ed9-4662-ae86-980b774e60fa",
"__expectedType__": "cc.Prefab"
},
"fileId": "88rZ2ljq9DH5H4fMqTusPo",
"instance": {
"__id__": 21
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "ebDCxAi1hH0JfkjnCE0gXK",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 22
},
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 23
},
"propertyPath": [
"_name"
],
"value": "hyItem2"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"88rZ2ljq9DH5H4fMqTusPo"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 23
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 23
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 23
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 18
},
"_enabled": true,
"__prefab": {
"__id__": 28
},
"_contentSize": {
"__type__": "cc.Size",
"width": 360,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6elu1uGcBApZhHgWwnuaUI"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 18
},
"_enabled": true,
"__prefab": {
"__id__": 30
},
"_alignFlags": 40,
"_target": null,
"_left": 0.5,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": false,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8b86B+SD1CkYXn7Joo0I+K"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "b1wfKIz45CJrTsdYgE6Aqv",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 33
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 390
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d9BqFE0w5DWqRYMxMRobx3"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 35
},
"_alignFlags": 40,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 606,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8dxf5VCPNF9YvIVXzh4AEh"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "61pS/W0ZhFvo+KwoaNRALA",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": [
{
"__id__": 19
},
{
"__id__": 3
}
]
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 889 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@@ -0,0 +1,458 @@
import { randomRange, view } from "cc";
import GlobalValue from "../Common/GlobalValue";
import SubManager from "../../Sub/SubManager";
import { I_SDK_UserInfo_Callback } from "./SDKManager";
//广告ID
const wx_banner_ad_unit_id = 'test'
const wx_splash_ad_unit_id = 'test'
const wx_video_ad_unit_id = 'test'
export class KSSDK{
static g_InGameScene = null; //游戏场景值
private wx_video:any = null;
private wx_splash:any = null;
private wx_banner:any = null;
private wx_video_callback:Function = null;
private wx_video_tag:number = null;
private wx_gameClub:any = null; //游戏圈按钮
private ShareSTime: any;
private ShareCb: any; //分享回调
private shareTxt = ["分享失败", "请分享到一个群", "请分享给一位好友", "分享过于频繁"]
//初始化
init(cb: Function = null) {
// 保持屏幕常亮
// window['ks'].setKeepScreenOn({ keepScreenOn: true });
//获取小游戏冷启动时的参数 热启动参数通过 ks.onShow 接口获取。
let launchOption = window['ks'].getLaunchOptionsSync();
KSSDK.g_InGameScene = launchOption.from;
console.log('init 快手 - 进入游戏的场景值', launchOption);
// //显示分享按钮
// window['ks'].showShareMenu({
// withShareTicket: true,
// menus: ["shareAppMessage", "shareTimeline"],
// });
// window['ks'].onShareAppMessage(() => {
// return this.shareInfo();
// });
// window['ks'].onShareTimeline(() => {
// return this.shareInfo();
// })
//小游戏回到前台
window['ks'].onShow(this.onWxShow.bind(this));
//小游戏被隐藏 记个时间
window['ks'].onHide(() => {
console.log("快手 onHide回调:")
if (this.ShareCb) {
this.ShareSTime = new Date().getTime();
console.log("分享时间差 记录:", this.ShareSTime);
}
});
this.init_video(); //初始化视频广告
this.init_splash(); //初始化插屏广告
this.init_banner(); //初始化Banner广告 弹窗广告
this.qiangzhiUpdata(); //强制更新
cb && cb();
}
//小游戏回到前台
onWxShow(data: any) {
console.log("快手 onShow回调:", data)
if (data) {
//启动小游戏时传入的参数 object
if (data.query) {
GlobalValue.ShareTocusid = data.query.ShareCode
}
//游戏启动场景 string
if (data.from) {
}
}
if (this.ShareCb) {
if (this.ShareSTime) {
let nT = new Date().getTime();
console.log("分享时间差 计算:",nT, this.ShareSTime, nT - this.ShareSTime);
if (nT - this.ShareSTime > 1) { //快手的onHide有问题,离onShow很近
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()
}
}
/**获取用户授权状态
* @param autoKey string 授权类型 userInfo=用户信息,对应接口wx.getUserInfo
*/
checkAutoSetting(autoKey:string, cb:Function = null) {
window['ks'].getSetting({
success(res:any) {
console.log("快手 - 检测权限状态 succ:", res)
if (autoKey == "userInfo" && res.authSetting['scope.userInfo']) {
cb && cb(true)
} else {
cb && cb(false)
}
},
fail(res:any) {
console.log("快手 - 检测权限状态 fail:", res)
cb && cb(false)
}
})
}
/**
* 获取个人信息
*/
getUserInfo(cb:I_SDK_UserInfo_Callback = null) {
var self = this;
window['ks'].getSetting({
success(res:any) {
console.log("快手 - 获取授权信息成功:", res);
let isScope = res.authSetting['scope.userInfo']
if (isScope) {
window['ks'].getUserInfo({
success: (res2) => {
console.log("快手 - 获取用户信息成功:", res2);
cb && cb({avatarUrl:res2.userInfo.avatarUrl, nickName:res2.userInfo.nickName})
},
fail: (error) => {
console.log("快手 - 获取用户信息失败:", error);
}
})
} else {
//向用户发起授权请求
window['ks'].authorize({
scope: 'scope.userInfo',
success: (res) => {
console.log("快手 - 发起授权请求成功:", res);
self.getUserInfo(cb)
},
fail: (error) => {
console.log("快手 - 发起授权请求失败: ", error);
}
})
}
},
fail: (error) => {
console.log("快手 - 获取授权信息失败: ", error);
// cb && cb({avatarUrl:"", nickName:""})
}
})
}
//快手登录
login(cb: Function = null) {
window['ks'].login({
success: (res) => {
console.log('快手 - 登录成功', res.code);
cb && cb({ platform:3, code: res.code });
},
fail(res: any) {
console.log(`快手 login 调用失败`, res);
cb && cb({ platform:3, code: null });
},
});
}
//初始化视频广告
private init_video() {
this.wx_video = window['ks'].createRewardedVideoAd({
adUnitId: wx_video_ad_unit_id
});
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);
}
});
}
//初始化插屏广告
private init_splash() {
// 创建插屏广告实例,提前初始化
if (window['ks'].createInterstitialAd){
this.wx_splash = window['ks'].createInterstitialAd({
adUnitId: wx_splash_ad_unit_id
});
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() {
}
//显示视频广告
show_video(callback:Function, tag:number) {
if (wx_video_ad_unit_id == 'test') {
console.log('未接入广告ID,视频广告请求直接返回');
callback && callback();
return;
}
if (this.wx_video) {
this.wx_video_callback = callback;
this.wx_video_tag = tag;
let p = this.wx_video.show()
p.then(function(result){
// 激励视频展示成功
console.log(`快手 show rewarded video ad success, result is ${result}`)
}).catch(function(error){
// 激励视频展示失败
console.log(`快手 show rewarded video ad failed, error is ${error}`)
})
// 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) {
let p = this.wx_splash.show()
p.then(function(result){
// 插屏广告展示成功
console.log(`快手 show interstitial ad success, result is ${result}`)
}).catch(function(error){
// 插屏广告展示失败
console.log(`快手 show interstitial ad failed, error is ${error}`)
if (error.code === -10005) {
// 表明当前app版本不支持插屏广告,可以提醒用户升级app版本
}
})
}
}
//显示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) 要打开
}
}
//分享信息
shareInfo() {
return {
templateId: undefined, //分享模版id,不传走默认分享文案
//查询字符串,从这条转发消息进入后,可通过 ks.getLaunchOptionsSync() 或 ks.onShow() 获取启动参数中的 query。必须是 key1=val1&key2=val2 的格式。
query: "ShareCode=" + "user_default", //ModelPlayer.I.getPlayerId(),
}
}
//主动拉起分享
show_share(rewardCB?:Function) {
console.log("主动拉起分享");
let info:any = this.shareInfo();
info.succ = rewardCB;
info.success = null;
info.fail = null;
this.ShareCb = info;
window['ks'].shareAppMessage(info);
}
//获取设备分辨率
getWindowSize() {
let windowinfo = window['ks'].getSystemInfoSync();
return {width:windowinfo.screenWidth, height: windowinfo.screenHeight};
}
//显示游戏圈
show_gameClub(leftRatio, topRatio, widthRatio, heightRatio) {
if (true) {
console.log("显示游戏圈,快手暂不支持");
return
}
}
//隐藏游戏圈
hide_gameClub() {
console.log("隐藏游戏圈");
if (this.wx_gameClub) {
this.wx_gameClub.hide();
}
}
//检查是否支持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['ks'].getFileSystemManager();
//1.删除上一个音频
const lastPath = window['ks'].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['ks'].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['ks'].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() {
if (window['ks'].getUpdateManager == null) {
console.log("快手 没有更新管理器", window['ks'].getUpdateManager)
return;
}
const updateManager = window['ks'].getUpdateManager();
//监听向微信后台请求检查更新结果事件。微信在小程序每次启动(包括热启动)时自动检查更新,不需由开发者主动触发。
updateManager.onCheckForUpdate((res) => {
// 请求完新版本信息的回调
console.log("快手 检查是否有新版本:", res.hasUpdate)
});
//监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
updateManager.onUpdateReady(async () => {
const { confirm } = await window['ks'].showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
});
if (confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
});
//监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)时回调
updateManager.onUpdateFailed(function (err) {
console.log("快手 新版本下载失败", err)
})
}
//客服功能是否支持
kefuSupport() {
console.log("快手 不支持联系客服")
return false;
}
//进入联系客服
openKefu() {
console.log("快手 进入联系客服")
}
//region 友盟+
umaInit() {
}
//友盟统计是否开启
umaSwt() {
return false;
}
//友盟事件统计
umaEvent(eventName: string, value: any = {}) {
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "f187eeca-740c-4e02-9a2e-99965ee996ee",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "f187eeca-740c-4e02-9a2e-99965ee996ee@6c48a",
"displayName": "novaxia_shy",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "f187eeca-740c-4e02-9a2e-99965ee996ee",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "f187eeca-740c-4e02-9a2e-99965ee996ee@f9941",
"displayName": "novaxia_shy",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "none",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 925,
"height": 1189,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-462.5,
-594.5,
0,
462.5,
-594.5,
0,
-462.5,
594.5,
0,
462.5,
594.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1189,
925,
1189,
0,
0,
925,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-462.5,
-594.5,
0
],
"maxPos": [
462.5,
594.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "f187eeca-740c-4e02-9a2e-99965ee996ee@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "f187eeca-740c-4e02-9a2e-99965ee996ee@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "6359cd8e-774c-4b65-9545-56a2b0aa9dbb",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "6359cd8e-774c-4b65-9545-56a2b0aa9dbb@6c48a",
"displayName": "coco_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "6359cd8e-774c-4b65-9545-56a2b0aa9dbb",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "6359cd8e-774c-4b65-9545-56a2b0aa9dbb@f9941",
"displayName": "coco_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 3.5,
"offsetY": -5.5,
"trimX": 33,
"trimY": 11,
"width": 866,
"height": 1178,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-433,
-589,
0,
433,
-589,
0,
-433,
589,
0,
433,
589,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
33,
1178,
899,
1178,
33,
0,
899,
0
],
"nuv": [
0.03567567567567568,
0,
0.9718918918918918,
0,
0.03567567567567568,
0.990748528174937,
0.9718918918918918,
0.990748528174937
],
"minPos": [
-433,
-589,
0
],
"maxPos": [
433,
589,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "6359cd8e-774c-4b65-9545-56a2b0aa9dbb@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "6359cd8e-774c-4b65-9545-56a2b0aa9dbb@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "2c86d323-1bf7-4b6a-b75f-81738b587f48",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "2c86d323-1bf7-4b6a-b75f-81738b587f48@6c48a",
"displayName": "lingxia_stage_icon",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "2c86d323-1bf7-4b6a-b75f-81738b587f48",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "2c86d323-1bf7-4b6a-b75f-81738b587f48@f9941",
"displayName": "lingxia_stage_icon",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 138,
"height": 138,
"rawWidth": 138,
"rawHeight": 138,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-69,
-69,
0,
69,
-69,
0,
-69,
69,
0,
69,
69,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
138,
138,
138,
0,
0,
138,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-69,
-69,
0
],
"maxPos": [
69,
69,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "2c86d323-1bf7-4b6a-b75f-81738b587f48@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "2c86d323-1bf7-4b6a-b75f-81738b587f48@6c48a"
}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d38f950e-9cfd-4b27-a028-ef45bad34709",
"files": [],
"subMetas": {},
"userData": {}
}