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: 344 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "368b06cc-cb91-4091-9243-3bf51ac5e2c3",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "368b06cc-cb91-4091-9243-3bf51ac5e2c3@6c48a",
"displayName": "jieun_1_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "368b06cc-cb91-4091-9243-3bf51ac5e2c3",
"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": "368b06cc-cb91-4091-9243-3bf51ac5e2c3@f9941",
"displayName": "jieun_1_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "368b06cc-cb91-4091-9243-3bf51ac5e2c3@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "368b06cc-cb91-4091-9243-3bf51ac5e2c3@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "7ced076e-d3ae-430c-8f47-711b86493e66",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "7ced076e-d3ae-430c-8f47-711b86493e66@6c48a",
"displayName": "nanamiya_rie_2_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "7ced076e-d3ae-430c-8f47-711b86493e66",
"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": "7ced076e-d3ae-430c-8f47-711b86493e66@f9941",
"displayName": "nanamiya_rie_2_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "7ced076e-d3ae-430c-8f47-711b86493e66@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "7ced076e-d3ae-430c-8f47-711b86493e66@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "91c22405-e7db-402c-9d68-462d7466a5c0",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "91c22405-e7db-402c-9d68-462d7466a5c0@6c48a",
"displayName": "lingxia_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "91c22405-e7db-402c-9d68-462d7466a5c0",
"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": "91c22405-e7db-402c-9d68-462d7466a5c0@f9941",
"displayName": "lingxia_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 15,
"offsetY": -8,
"trimX": 157,
"trimY": 16,
"width": 516,
"height": 1013,
"rawWidth": 800,
"rawHeight": 1029,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-258,
-506.5,
0,
258,
-506.5,
0,
-258,
506.5,
0,
258,
506.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
157,
1013,
673,
1013,
157,
0,
673,
0
],
"nuv": [
0.19625,
0,
0.84125,
0,
0.19625,
0.9844509232264335,
0.84125,
0.9844509232264335
],
"minPos": [
-258,
-506.5,
0
],
"maxPos": [
258,
506.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "91c22405-e7db-402c-9d68-462d7466a5c0@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "91c22405-e7db-402c-9d68-462d7466a5c0@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "49307426-aaec-47ee-b396-f9d3325dfde1",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "49307426-aaec-47ee-b396-f9d3325dfde1@6c48a",
"displayName": "celestine_3_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "49307426-aaec-47ee-b396-f9d3325dfde1",
"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": "49307426-aaec-47ee-b396-f9d3325dfde1@f9941",
"displayName": "celestine_3_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "49307426-aaec-47ee-b396-f9d3325dfde1@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "49307426-aaec-47ee-b396-f9d3325dfde1@6c48a"
}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "cbfe2285-2589-4912-9f81-b3e87d256e41",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "4d2f2c3c-2410-42ad-87d1-5138283c1c45",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "4d2f2c3c-2410-42ad-87d1-5138283c1c45@6c48a",
"displayName": "bd_4",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "4d2f2c3c-2410-42ad-87d1-5138283c1c45",
"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": "4d2f2c3c-2410-42ad-87d1-5138283c1c45@f9941",
"displayName": "bd_4",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 494,
"height": 85,
"rawWidth": 494,
"rawHeight": 85,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-247,
-42.5,
0,
247,
-42.5,
0,
-247,
42.5,
0,
247,
42.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
85,
494,
85,
0,
0,
494,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-247,
-42.5,
0
],
"maxPos": [
247,
42.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "4d2f2c3c-2410-42ad-87d1-5138283c1c45@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "4d2f2c3c-2410-42ad-87d1-5138283c1c45@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 406 KiB

@@ -0,0 +1,663 @@
import { _decorator, instantiate, isValid, Label, Node, PageView, Prefab, Sprite, UITransform, view } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import AudioManager from '../../Main/Manager/AudioManager';
import Utils from '../../Main/Common/Utils';
import { ViewManager } from '../../Main/Manager/ViewManager';
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
import li_BaseView from '../../Main/Common/li_BaseView';
import GameRootUI from '../../Main/Common/GameRootUI';
import ResManager from '../../Main/Manager/ResManager';
import HttpUnit from '../../Main/Common/HttpUnit';
import { SDKManager } from '../../Main/Channel/SDKManager';
import ScrollViewList from '../../Main/Common/ScrollViewList';
import GameManager, { E_TalkStage, E_TalkStatusType } from '../../Main/Manager/GameManager';
import { I_LevelConfig, I_NpcTalkBack } from '../../Main/Config/CommonConfig';
import SubManager from '../SubManager';
import { ByteDanceSDK } from '../../Main/Channel/bdSDK';
import GlobalValue from '../../Main/Common/GlobalValue';
import PlayerDataManager from '../../Main/Manager/PlayerDataManager';
import { E_AD_TARGET } from './TalkAdDialog';
const { ccclass, property } = _decorator;
//主界面
@ccclass('Start_UI')
export class Start_UI extends li_BaseView {
@property(ScrollViewList)
private Level_List: ScrollViewList = null
@property(Prefab)
private Level_Item: Prefab = null
private itemClone: any = null
@property(Prefab)
private GuidePageItem: Prefab = null //引导选择角色页签
private guidePageView: PageView = null //引导选择角色页签容器
private _nodeTab: any = {};
private _data;
private levelData: I_LevelConfig[] = []; //关卡数据
private curLevelIdx: number = 0; //当前关卡Idx
private lvUnlockId: string = ""; //解锁关卡id
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
Utils.parseNode(this.node, this._nodeTab)
this.itemClone = instantiate(this.Level_Item)
this.Level_List.setTemplateItem(this.itemClone)
this.guidePageView = this._nodeTab.guidePageView.getComponent(PageView)
Utils.setString(this._nodeTab.labNpcName, "")
Utils.setString(this._nodeTab.labNpcTalk, "")
}
openUIDataCT(data: any): void {
this._data = data
}
registerListenner() {
Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
Utils.addInnerEL(InnerMsgCode.UI_Talk_Back, this, this.resiveTalkBack)
Utils.addInnerEL(InnerMsgCode.UI_BD_Sidebar, this, this.resiveBDSidebar)
Utils.addInnerEL(InnerMsgCode.Data_BDSidebarReward, this, this.resiveBDSidebarReward)
}
start() {
GButton.BandClick(this._nodeTab.btnStart, this.onStartClick, this, 10002);
GButton.BandClick(this._nodeTab.btnKefu, this.onKefuClick, this);
GButton.BandClick(this._nodeTab.btnAddTZCount, this.onAddTZClick, this);
GButton.BandClick(this._nodeTab.tzCountNode, this.onAddTZClick, this);
GButton.BandClick(this._nodeTab.btnSetting, this.onSettingClick, this);
GButton.BandClick(this._nodeTab.btnBDSidebar, this.onBDSidebarClick, this);
GButton.BandClick(this._nodeTab.btnGM, this.onGMClick, this);
GButton.BandClick(this._nodeTab.btnTujian, this.onTujianClick, this);
SDKManager.register_video_reward(this.node.uuid, (tag:number)=>{
console.log("视频广告回调", tag)
if (tag == 1) {
// 加次数
HttpUnit.ins.setUserAd({type:1}, (data) => {
SubManager.ShowPrompt("观看视频成功,获得相亲次数")
this.refreshXiangqinTicket()
})
} else if (tag == 2) {
// 解锁关卡
HttpUnit.ins.levelUnlock({level_id: this.lvUnlockId}, (data) => {
// SubManager.ShowPrompt("关卡解锁成功")
this.refreshLevelList()
this.enterLevelAfterUnlock()
})
}
})
SDKManager.register_share_reward(this.node.uuid, (tag:number)=>{
console.log("分享回调", tag)
if (tag == 1) {
// 加次数
HttpUnit.ins.setUserShare({type:1}, (data) => {
SubManager.ShowPrompt("分享成功,获得相亲次数")
this.refreshXiangqinTicket()
})
}
})
AudioManager.I.PlayMusic(1, true) //背景乐
GameRootUI.InitDisableOperUI(false)
GameRootUI.InitCrossUI(false)
this.setUIVisible(true)
// this._nodeTab.labStart2.active = false //快手去掉英文
//客服按钮
this._nodeTab.btnKefu.active = SDKManager.KefuSupport()
//设置按钮
if (GlobalValue.GMSwtitch) {
this._nodeTab.btnSetting.active = true
this._nodeTab.btnGM.active = true
} else {
this._nodeTab.btnSetting.active = false
this._nodeTab.btnGM.active = false
}
//抖音侧边栏
this._nodeTab.btnBDSidebar.active = false
if (SDKManager.isByteDance()) {
this.refreshBdSidebarUI()
ByteDanceSDK.CheckSidebarState((state) =>{
if (state == true) {
this.refreshBdSidebarUI()
}
})
}
//重置引导
this.resetGuide()
GameRootUI.DisableOper(2)
//判断玩家权限是否已获取
if (!HttpUnit.IsLogin()) {
HttpUnit.ins.login((loginData) => {
console.log("主界面: 获取授权并登录成功!")
this.userInited()
})
} else {
this.userInited()
}
}
update(deltaTime: number) {
}
//GM界面关闭消息
resiveGMClose(data) {
Utils.Log("收到GM界面关闭消息")
}
//退出聊天消息
resiveTalkBack(data) {
Utils.Log("收到退出聊天消息")
AudioManager.I.PlayMusic(1, true) //背景乐
this.setUIVisible(true)
this.refreshLevelList()
HttpUnit.ins.getUserData((userData) => {
this.refreshXiangqinTicket()
})
}
//抖音侧边栏消息
resiveBDSidebar(data) {
this.refreshBdSidebarUI()
}
//领取抖音侧边栏奖励消息
resiveBDSidebarReward(data) {
this.refreshXiangqinTicket()
}
//增加相亲次数
private doAddXiangqinCnt(add:number = 1) {
}
//显示主界面UI
setUIVisible(vis: boolean) {
this._nodeTab.UIRoot.active = vis
}
//刷新抖音侧边栏按钮显示状态
refreshBdSidebarUI() {
if (!SDKManager.isByteDance()) {
//不是抖音平台,不显示
this._nodeTab.btnBDSidebar.active = false
return
}
let stage = ByteDanceSDK.SidebarState
if (stage == 1) {
//前往
this._nodeTab.btnBDSidebar.active = true
// Utils.setString(this._nodeTab.labBDSidebar, "前往抖音侧边栏")
} else if (stage == 2) {
//从侧边栏返回
this._nodeTab.btnBDSidebar.active = false
// Utils.setString(this._nodeTab.labBDSidebar, "领取抖音侧边栏")
} else {
//版本不支持或奖励已领取
this._nodeTab.btnBDSidebar.active = false
}
}
//刷新玩家信息完毕
userInited() {
this.refreshSdkUI()
this.refreshLevelList()
this.refreshXiangqinTicket()
}
//刷新剩余相亲次数
private refreshXiangqinTicket() {
let xqnum = HttpUnit.GetXiangqinTickets()
// let xqmax = HttpUnit.GetXiangqinMaxTickets()
Utils.setString(this._nodeTab.labTZCount, xqnum + "")
Utils.setString(this._nodeTab.labBtnTZCount, "" + xqnum)
}
//刷新关卡列表
private refreshLevelList() {
HttpUnit.ins.getLevelList((levelList) => {
if (levelList) {
GameRootUI.EnableOper()
GameManager.SetLevelCfg(levelList)
this.levelData = levelList
this.levelData.unshift({} as any) //在最前面插入一个占位数据,用于数组排版显示
this.Level_List.numItems = this.levelData.length
if (this.curLevelIdx < 1) {
this.curLevelIdx = 1
//自动滚动只在引导后生效
if (PlayerDataManager.I.GuideMainFinished) {
for (let i = 1; i < this.levelData.length; i++) {
if (this.levelData[i].is_unlock == true) {
if (this.curLevelIdx < i) {
this.curLevelIdx = i
}
} else {
break
}
}
if (this.curLevelIdx > 2) {
this.scheduleOnce(() => {
this.Level_List.scrollTo(this.curLevelIdx-2)
}, 0.1)
}
} else {
this.checkGuide()
}
}
this.changeLevel(this.curLevelIdx, true)
}
})
}
//刷新SDK相关的UI
refreshSdkUI() {
console.log("主界面:刷新SDK相关的UI...")
SDKManager.getUserInfo((data) => {
//头像
let spt = this._nodeTab.headIcon.getComponent(Sprite)
ResManager.I.changeRemoteSpriteFrame(spt, data.avatarUrl)
SDKManager.avatarUrl = data.avatarUrl
//名字
let nickName = this._nodeTab.nickName.getComponent(Label)
nickName.string = data.nickName
SDKManager.nickName = data.nickName
console.log("主界面 设置头像和名字:", data.avatarUrl, data.nickName)
})
//刷新id
let id = HttpUnit.GetID()
Utils.setString(this._nodeTab.userId, `ID:${id}`)
// Utils.setString(this._nodeTab.userId, `${id}`) //快手去掉英文
}
//region 关卡列表渲染
onRenderItemList(node: any, idx: number) {
if(!isValid(node)) {return}
if (!node.inited) {
node.inited = true;
Utils.parseNode(node);
}
GButton.RemoveClick(node)
//第一个是占位用的
if (idx == 0) {
node.l_rotateN.active = false
node.zhanweiNode.active = true
return
}
node.l_rotateN.active = true
node.zhanweiNode.active = false
let data = this.levelData[idx]
//npc名
// console.log("关卡列表渲染:", data.name)
//头像
let headPath = `headLevel/${data.icon}`
ResManager.I.changeBundleSpriteFrame(node.head1.getComponent(Sprite), headPath, "Raw")
//解锁状态
node.lockNode.active = data.is_unlock ? false : true
node.unlockNode.active = data.is_unlock ? true : false
if (data.is_unlock) {
//分数
Utils.setString(node.labScore, data.score)
//星级
if (data.star == 3) {
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_11", "Zhujiemian")
} else if (data.star == 2) {
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_10", "Zhujiemian")
} else if (data.star == 1) {
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_9", "Zhujiemian")
} else {
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_8", "Zhujiemian")
}
//满星效果
node.l_manxing.active = data.star == 3 ? true : false
if (data.star == 3) {
ResManager.I.changeBundleSpriteFrame(node.l_bg.getComponent(Sprite), "zjm_6", "Zhujiemian")
} else {
ResManager.I.changeBundleSpriteFrame(node.l_bg.getComponent(Sprite), "zjm_5", "Zhujiemian")
}
}
GButton.BandClick(node, ()=>{
this.changeLevel(idx)
}, this)
}
//切换关卡
changeLevel(idx:number, force:boolean = false) {
if (this.curLevelIdx == idx && !force) {
return
}
this.curLevelIdx = idx
let data = this.levelData[idx]
//名字
Utils.setString(this._nodeTab.labNpcName, data.characterName)
//介绍
Utils.setString(this._nodeTab.labNpcTalk, data.description)
//是否解锁
if (data.is_unlock) {
Utils.setString(this._nodeTab.labStart1, "游戏开始")
Utils.setString(this._nodeTab.labStart2, "GAME\nSTART")
} else {
Utils.setString(this._nodeTab.labStart1, "解锁关卡")
Utils.setString(this._nodeTab.labStart2, "UNLOCK\nGAME")
}
let bgPath = `bg/${data.bgImage}`
let rolePath = `role/${data.characterFullLengthPortrait}`
Utils.sendInnerMsg(InnerMsgCode.SceneLayerBgUp, {bgPath:bgPath, rolePath:rolePath})
}
//region 开始游戏
onStartClick() {
Utils.Log("点击开始游戏");
this.finishGuide()
if (this.curLevelIdx == 0) {
console.error("当前关卡为0,此关卡是占位用的")
return
}
let data = this.levelData[this.curLevelIdx]
let level_id = data.id
GameManager.EndGame()
//未解锁
if (data.is_unlock != true) {
if (HttpUnit.GetXiangqinTickets() <= 0) {
SubManager.ShowPrompt("今日相亲次数已耗尽,无法提前解锁更多关卡");
} else {
this.lvUnlockId = level_id
SubManager.ShowCommonAdDialog({
content: "关卡未解锁,需要通过本关卡的前置关卡,或观看广告提前解锁关卡,并消耗 1 点相亲次数进入关卡",
strAd: "观看广告",
strLeft: "返回",
adCallback: () => {
SDKManager.show_reward_video_ad(this.node.uuid, 2)
}
})
}
return
}
//检测存档
if (GlobalValue.LvHuancun && data.record_id && data.record_id != "") {
HttpUnit.ins.getTalkStage({record_id: data.record_id}, (_data) => {
if (_data) {
if (_data.level.status == E_TalkStatusType.talking) {
this._continueLevel(level_id, _data)
} else {
this._startNewLevel(level_id)
}
} else {
this._startNewLevel(level_id)
}
})
} else {
SubManager.ShowConfirm({
content: `确认消耗 1 点“相亲次数” 开始与【${data.name}】相亲吗?`,
strYes: "确认",
strNo: "返回",
yesCallback: () => {
this._startNewLevel(level_id)
}
})
}
}
//开始新关卡
private _startNewLevel(level_id) {
if (HttpUnit.GetXiangqinTickets() <= 0) {
SubManager.ShowPrompt("今日相亲次数已用完");
return;
}
GameManager.CurLevelId = level_id
HttpUnit.ins.levelStart({level_id:level_id}, (data) => {
GameManager.CurLevelData = data.level
GameManager.RecordId = data.record_id
GameManager.I.connetSorcket(data.record_id) //连接socket
this.setUIVisible(false)
AudioManager.I.StopMusic() //停止背景音乐,进去后播放当前关卡音乐
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
})
}
//region 继续关卡存档
private _continueLevel(level_id, data) {
SubManager.ShowConfirm({
content: "检测到进行中的记录,是否继续?",
strYes: "继续",
strNo: "重新开始",
yesCallback: () => {
//继续对话
let lvCfg = this.levelData[this.curLevelIdx]
let t_xindong = 0
let t_xihuan = 0
let t_taoyan = 0
//聊天记录
GameManager.AddTalkRecord({talk:lvCfg.prologueMessage, isMe:false, score:-1, scoreBase:-1, scoreAdditional:0})
let msg = data.messages || []
for (let i = 0; i < msg.length; i++) {
let m = msg[i]
let talkData: I_NpcTalkBack = {
aiEmoji: m.ai_emoji,
aiResponse: m.ai_response,
aiScore: m.ai_score || 0,
aiBaseScore: m.ai_base_score || 0,
aiAdditionalScore: m.ai_additional_score || 0,
isFinished: m.is_finished,
sourceCnt: m.source_cnt,
userInput: m.user_input,
judgement: m.judgement,
}
GameManager.CurNpcTalkData = talkData
GameManager.AddStepScore(m.ai_score) //记录本次分数
GameManager.AddTalkRecord({talk:m.user_input, isMe:true, score:-1, scoreBase:-1, scoreAdditional:0})
GameManager.AddTalkRecord({talk:m.ai_response, isMe:false, score:m.ai_score, scoreBase:talkData.aiBaseScore, scoreAdditional:talkData.aiAdditionalScore})
if (m.judgement == 0) {
t_xindong++
t_xihuan++
} else if (m.judgement == 2) {
t_taoyan++
}
}
GameManager.CurLevelId = level_id
GameManager.CurLevelData = data.level
GameManager.RecordId = data.record_id
GameManager.srouceCnt = data.level.current_cnt
GameManager.xindongCishu = t_xindong
GameManager.npcFixTalkCountXihuan = t_xihuan
GameManager.npcFixTalkCountTaoyan = t_taoyan
GameManager.TurnToStage(E_TalkStage.myTalk)
GameManager.I.connetSorcket(data.record_id) //连接socket
this.setUIVisible(false)
AudioManager.I.StopMusic() //停止背景音乐,进去后播放当前关卡音乐
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
},
noCallback: () => {
//重新开始
this._startNewLevel(level_id)
}
})
}
/**手动解锁关卡后进入 */
enterLevelAfterUnlock() {
this._startNewLevel(this.lvUnlockId)
this.lvUnlockId = ""
}
//点击客服
onKefuClick() {
SDKManager.OpenKefu()
}
//增加相亲次数
onAddTZClick() {
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
type: E_AD_TARGET.xiangqin, //加相亲次数
content: GlobalValue.XiangQinAdTipsStr,
adCallback: ()=>{
SDKManager.show_reward_video_ad(this.node.uuid, 1)
},
shareCallback: ()=>{
SDKManager.show_reward_share(this.node.uuid, 1)
}
})
}
//设置
onSettingClick() {
ViewManager.I.openBundlesView("UI/StartUI/Setting_UI")
}
//gm
onGMClick() {
ViewManager.I.openBundlesView("UI/GM_UI")
}
onTujianClick() {
ViewManager.I.openBundlesView("UI/StartUI/Tujian_UI")
}
//点击抖音侧边栏按钮
onBDSidebarClick() {
if (!SDKManager.isByteDance()) {
//不是抖音平台
return
}
ViewManager.I.openBundlesView("UI/StartUI/BDSidebar_UI")
}
//region 引导相关
private _guideInterval: number = 0.3 //引导间隔
//重置引导节点显示
private resetGuide() {
this._nodeTab.guideStep1.active = false
this._nodeTab.guideStep2.active = false
this._nodeTab.guideHandNode.active = false
this._nodeTab.btnStart.parent = this._nodeTab.startParent1
}
//检查引导
private checkGuide() {
if (PlayerDataManager.I.GuideMainFinished) {
return
}
this.doGuideStep1()
}
//引导步骤1 显示介绍弹窗
private doGuideStep1() {
GameRootUI.DisableOper(this._guideInterval)
this.scheduleOnce(() => {
this._nodeTab.guideStep1.active = true
GButton.RemoveAndBandClick(this._nodeTab.btnGs1Ok, this.onGuide1OkClick, this);
},this._guideInterval)
}
//引导步骤2 显示手
private doGuideStep2() {
GameRootUI.DisableOper(this._guideInterval)
this.scheduleOnce(() => {
this._nodeTab.guideStep2.active = true
this.scheduleOnce(() => {
let tempNode = instantiate(this.GuidePageItem)
let tntf = tempNode.getComponent(UITransform)
let wsize = view.getVisibleSize()
tntf.setContentSize(wsize.width, tntf.height)
//0号是占位的,从1开始
for (let i=1; i<this.levelData.length; i++) {
let data = this.levelData[i]
if (data.is_unlock) {
let node: any = instantiate(tempNode)
this.guidePageView.addPage(node)
Utils.parseNode(node)
//背景图
let bgPath = `bg/${data.bgImage}`
ResManager.I.changeBundleSpriteFrame(node.guideBg.getComponent(Sprite), bgPath, "Raw")
//角色立绘
let rolePath = `role/${data.characterFullLengthPortrait}`
ResManager.I.changeBundleSpriteFrame(node.guideRole.getComponent(Sprite), rolePath, "Raw")
//名字
Utils.setString(node.guideName, data.characterName)
//介绍
Utils.setString(node.guideDesc, data.description)
} else {
break
}
}
GButton.RemoveAndBandClick(this._nodeTab.gs2BtnKaishi, this.onGuideKaishiClick, this);
}, 0.1)
// this._nodeTab.guideHandNode.active = true
// this._nodeTab.btnStart.parent = this._nodeTab.startParent2
}, this._guideInterval)
}
//引导完成
private finishGuide() {
if (PlayerDataManager.I.GuideMainFinished) {
return
}
PlayerDataManager.I.SetGuideMainFinish(true)
this.resetGuide()
}
//翻页容器事件回调
guidePageViewEvent(param1, param2) {
// console.log("guidePageViewEvent", param1, param2)
this._nodeTab.gs2Zhisk.active = false
let pageIdx = this.guidePageView.curPageIdx
this.changeLevel(pageIdx+1)
}
//引导 下一步
onGuide1OkClick() {
this._nodeTab.guideStep1.active = false
this.doGuideStep2()
}
//引导 开始游戏
onGuideKaishiClick() {
// this.finishGuide()
// let pageIdx = this.guidePageView.curPageIdx
// let data = this.levelData[pageIdx+1]
// let level_id = data.id
// GameManager.EndGame()
// SubManager.ShowConfirm({
// content: `确认消耗 1 点“相亲次数” 开始与【${data.name}】相亲吗?`,
// strYes: "确认",
// strNo: "返回",
// yesCallback: () => {
// this._startNewLevel(level_id)
// }
// })
this.onStartClick()
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 799 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0b8269f5-8eb2-442e-a0bb-d6ad2cbe9edc",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0b8269f5-8eb2-442e-a0bb-d6ad2cbe9edc@6c48a",
"displayName": "xinfu_2_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0b8269f5-8eb2-442e-a0bb-d6ad2cbe9edc",
"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": "0b8269f5-8eb2-442e-a0bb-d6ad2cbe9edc@f9941",
"displayName": "xinfu_2_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "0b8269f5-8eb2-442e-a0bb-d6ad2cbe9edc@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "0b8269f5-8eb2-442e-a0bb-d6ad2cbe9edc@6c48a"
}
}
@@ -0,0 +1,474 @@
import { randomRange, view } from "cc";
import GlobalValue from "../Common/GlobalValue";
import SubManager from "../../Sub/SubManager";
import { I_SDK_UserInfo_Callback, SDKManager } 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() {
if (wx_video_ad_unit_id as any == "test") {
console.log("快手 激励广告id未配置,跳过此类型初始化")
return
}
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);
}
SDKManager.video_ad_back();
});
}
//初始化插屏广告
private init_splash() {
if (wx_splash_ad_unit_id as any == "test") {
console.log("快手 插屏广告id未配置,跳过此类型初始化")
return
}
// 创建插屏广告实例,提前初始化
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() {
if (wx_banner_ad_unit_id as any == "test") {
console.log("快手 横幅广告id未配置,跳过此类型初始化")
return
}
}
//显示视频广告
show_video(callback:Function, tag:number) {
if (wx_video_ad_unit_id == '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;
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 = {}) {
}
}