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

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0cc93f21-4578-47df-aebf-6133f43d8703",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0cc93f21-4578-47df-aebf-6133f43d8703@6c48a",
"displayName": "ninian_3_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0cc93f21-4578-47df-aebf-6133f43d8703",
"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": "0cc93f21-4578-47df-aebf-6133f43d8703@f9941",
"displayName": "ninian_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": "0cc93f21-4578-47df-aebf-6133f43d8703@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "0cc93f21-4578-47df-aebf-6133f43d8703@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "c74c5735-42a7-43a7-8e2b-42b3ce25776b",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@6c48a",
"displayName": "pauline_stage_icon",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "c74c5735-42a7-43a7-8e2b-42b3ce25776b",
"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": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@f9941",
"displayName": "pauline_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": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@6c48a"
}
}
@@ -0,0 +1,464 @@
import { _decorator, instantiate, isValid, Label, Node, Prefab, Sprite } 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 from '../../Main/Manager/GameManager';
import { I_LevelConfig } 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
private _nodeTab: any = {};
private _data;
private levelData: I_LevelConfig[] = []; //关卡数据
private curLevelIdx: number = 0; //当前关卡Idx
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
Utils.parseNode(this.node, this._nodeTab)
this.itemClone = instantiate(this.Level_Item)
this.Level_List.setTemplateItem(this.itemClone)
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)
}
start() {
GButton.BandClick(this._nodeTab.btnStart, this.onStartClick, this, 10002);
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);
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()
})
}
})
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)
//设置按钮
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()
}
})
}
//判断玩家权限是否已获取
if (!HttpUnit.IsLogin()) {
HttpUnit.ins.login((loginData) => {
console.log("主界面: 获取授权并登录成功!")
this.userInited()
})
} else {
this.userInited()
}
//判断是否需要显示引导
this.resetGuide()
this.checkGuide()
}
update(deltaTime: number) {
}
//GM界面关闭消息
resiveGMClose(data) {
Utils.Log("收到GM界面关闭消息")
}
//退出聊天消息
resiveTalkBack(data) {
Utils.Log("收到退出聊天消息")
this.setUIVisible(true)
this.refreshLevelList()
HttpUnit.ins.getUserData((userData) => {
this.refreshXiangqinTicket()
})
}
//抖音侧边栏消息
resiveBDSidebar(data) {
this.refreshBdSidebarUI()
}
//增加相亲次数
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 = true
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) {
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
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.Level_List.scrollTo(this.curLevelIdx-2)
}
}
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)
//名字
let nickName = this._nodeTab.nickName.getComponent(Label)
nickName.string = data.nickName
console.log("主界面 设置头像和名字:", data.avatarUrl, data.nickName)
})
//刷新id
let id = HttpUnit.GetID()
Utils.setString(this._nodeTab.userId, `ID:${id}`)
}
//关卡列表渲染
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]
//头像
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)
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]
//未解锁
if (data.is_unlock != true) {
SubManager.ShowPrompt("关卡未解锁")
return
}
if (HttpUnit.GetXiangqinTickets() <= 0) {
SubManager.ShowPrompt("今日相亲次数已用完");
return;
}
let level_id = data.id
let dongId = GameManager.CurLevelId //当前进行中的关卡
//有在进行的关卡
if (dongId != "") {
//功能没开放
if (!GlobalValue.LvHuancun) {
GameManager.EndGame()
this._startNewLevel(level_id)
//进入的还是上次没结束的关卡,则继续当前关卡
}else if (level_id == dongId) {
this.setUIVisible(false)
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
//进入的是其他关卡,则提示是否要放弃当前关卡
} else {
SubManager.ShowConfirm({
content: "有进行中的关卡,是否中断当前关卡,开始新的关卡?",
yesCallback: () => {
GameManager.EndGame()
this._startNewLevel(level_id)
}
})
}
//没有在进行的关卡,则直接进入
} else {
this._startNewLevel(level_id)
}
}
//开始新关卡
private _startNewLevel(level_id) {
GameManager.CurLevelId = level_id
HttpUnit.ins.levelStart({level_id:level_id}, (data) => {
this.setUIVisible(false)
GameManager.CurLevelData = data.level
GameManager.RecordId = data.record_id
GameManager.I.connetSorcket(data.record_id) //连接socket
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
})
}
//增加相亲次数
onAddTZClick() {
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
type: E_AD_TARGET.xiangqin, //加相亲次数
content: "每天只有 5 次相亲次数,请谨慎使用。分享游戏,观看广告都可以获得 3 次相亲次数奖励,该奖励每日限领一次,每日 5:00 刷新相亲次数以及奖励获取次数。",
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")
}
//点击抖音侧边栏按钮
onBDSidebarClick() {
if (!SDKManager.isByteDance()) {
//不是抖音平台
return
}
ViewManager.I.openBundlesView("UI/StartUI/BDSidebar_UI")
}
//region 引导相关
private _guideInterval: number = 0.5 //引导间隔
//重置引导节点显示
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._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()
}
onGuide1OkClick() {
this._nodeTab.guideStep1.active = false
this.doGuideStep2()
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "b3874086-be30-4af3-ab8b-95335a5b69f9",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "b3874086-be30-4af3-ab8b-95335a5b69f9@6c48a",
"displayName": "metis_2_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "b3874086-be30-4af3-ab8b-95335a5b69f9",
"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": "b3874086-be30-4af3-ab8b-95335a5b69f9@f9941",
"displayName": "metis_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": "b3874086-be30-4af3-ab8b-95335a5b69f9@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "b3874086-be30-4af3-ab8b-95335a5b69f9@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 610 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "47ad3ab4-10dd-4a13-ab62-e0f6bd0abdda",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "47ad3ab4-10dd-4a13-ab62-e0f6bd0abdda@6c48a",
"displayName": "minseo_avatar",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "47ad3ab4-10dd-4a13-ab62-e0f6bd0abdda",
"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": "47ad3ab4-10dd-4a13-ab62-e0f6bd0abdda@f9941",
"displayName": "minseo_avatar",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 80,
"height": 80,
"rawWidth": 80,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-40,
-40,
0,
40,
-40,
0,
-40,
40,
0,
40,
40,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
80,
80,
80,
0,
0,
80,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-40,
-40,
0
],
"maxPos": [
40,
40,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "47ad3ab4-10dd-4a13-ab62-e0f6bd0abdda@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "47ad3ab4-10dd-4a13-ab62-e0f6bd0abdda@6c48a"
}
}
@@ -0,0 +1,718 @@
import { _decorator, AudioSource, EditBox, EventTouch, isValid, Label, Node, Sprite, Tween, tween, UIOpacity, utils, v3, Vec3 } from 'cc';
import { GButton } from '../../Main/Common/GButton';
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 SubManager from '../SubManager';
import GameManager, { E_TalkStage, E_TalkStatusType } from '../../Main/Manager/GameManager';
import { I_LevelConfig, I_NpcTalkBack } from '../../Main/Config/CommonConfig';
import HttpUnit from '../../Main/Common/HttpUnit';
import { SDKManager } from '../../Main/Channel/SDKManager';
import ResManager from '../../Main/Manager/ResManager';
import PlayerDataManager from '../../Main/Manager/PlayerDataManager';
import GameRootUI from '../../Main/Common/GameRootUI';
import { E_AD_TARGET } from './TalkAdDialog';
import GlobalValue from '../../Main/Common/GlobalValue';
const { ccclass, property } = _decorator;
//聊天界面
@ccclass('Talk_UI')
export class Talk_UI extends li_BaseView {
private _nodeTab: any = {};
private _data;
private dazijiInfo = {stage: 0, idx: 0, str: "", tm:0, ts:0.05, lab:null}; //打字机信息 stage:0-未开始,1-正在打字,2-打字结束
private npcTalkInfo = {stage: 0, str:"", dotStr:"...", dotIdx:0, tm:0, ts:0.3}; //等待npc回复 stage:0-未开始,1-获取中,2-获取完成
private ebTalk: EditBox;
private labNpcTalk: Label;
private xindongSpt: Sprite;
private lvCfg: I_LevelConfig = null; //当前关卡配置
private lastRandTalkIdx: number = -1; //上一次随机对话的索引
//----重写父类接口---------------------------------------
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab)
this.registerListenner();
this.ebTalk = this._nodeTab.ebTalk.getComponent(EditBox);
this.labNpcTalk = this._nodeTab.npcTalk.getComponent(Label);
this.xindongSpt = this._nodeTab.xindongSpt.getComponent(Sprite);
this.ebTalk.node.on('editing-did-began', this.onEditingBegan, this);
this.ebTalk.node.on('editing-did-ended', this.onEditingEnded, this);
this.ebTalk.node.on('editing-return', this.onEditingReturn, this);
// this._nodeTab.npcTalkSV.on(Node.EventType.TOUCH_START, (event: EventTouch)=>{
// event.preventSwallow = true; //允许点击事件穿透
// }, this);
this._nodeTab.npcTalkSV.getChildByName("view").on(Node.EventType.TOUCH_END, (event:EventTouch) => {
// event.preventSwallow = true; //允许点击事件穿透
this.onNpcFramClick();
}, this);
this._nodeTab.arrowNode.active = false;
let npcNextArrow:Node = this._nodeTab.npcNextArrow
tween(npcNextArrow)
.to(0.5, {position: new Vec3(15, 0, 0)})
.to(0.5, {position: new Vec3(-15, 0, 0)})
.union()
.repeatForever()
.start()
}
openUIDataCT(data: any): void {
this._data = data
}
registerListenner() {
Utils.addInnerEL(InnerMsgCode.Data_NpcTalkBack, this, this.resiveNpcTalkBack)
Utils.addInnerEL(InnerMsgCode.UI_Socket_Timeout, this, this.resiveSocketTimeout)
Utils.addInnerEL(InnerMsgCode.UI_TalkStageUp, this, this.resiveTalkStageUp)
Utils.addInnerEL(InnerMsgCode.Data_LevelStarUp, this, this.resiveLevelStarUp)
Utils.addInnerEL(InnerMsgCode.UI_ResartGame, this, this.resiveResartGame)
}
start() {
GButton.BandClick(this._nodeTab.btnBack, this.onBackClick, this);
GButton.BandClick(this._nodeTab.btnSend, this.onSendClick, this);
GButton.BandClick(this._nodeTab.btnSuiji, this.onSuijiClick, this);
//弹窗适配
let scaleRatio = Utils.getScaleRatio(2)
if (scaleRatio > 1) {
scaleRatio = 1;
}
this._nodeTab.gs1frame.scale = new Vec3(scaleRatio, scaleRatio, 1)
//规则内容
Utils.setString(this._nodeTab.labGs1Tips, GlobalValue.RuleStr)
// GButton.BandClick(this._nodeTab.npcTalkFrame, ()=>{
// this.onNpcFramClick();
// }, this, 0, null, null, false);
GButton.BandClick(this._nodeTab.btnRecord, ()=>{
// 测试代码
// if (true) {
// this.showXinAddAnimation()
// return
// }
ViewManager.I.openBundlesView("UI/StartUI/Record_UI")
}, this);
GButton.BandClick(this._nodeTab.btnTishi, ()=>{
ViewManager.I.openBundlesView("UI/StartUI/Tips_UI")
}, this);
GButton.BandClick(this._nodeTab.btnAD, ()=>{
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
type: E_AD_TARGET.liaotian, //加聊天次数
content: "看广告或分享可额外获取对话次数",
adCallback: ()=>{
SDKManager.show_reward_video_ad(this.node.uuid, 1)
},
shareCallback: ()=>{
SDKManager.show_reward_share(this.node.uuid, 1)
}
})
}, this);
GButton.BandClick(this._nodeTab.btnRole, ()=>{
this._nodeTab.ruleNode.active = true
}, this);
GButton.BandClick(this._nodeTab.btnRoleOk, ()=>{
this.onRoleCloseClick()
}, this);
GButton.BandClick(this._nodeTab.btnRoleClose, ()=>{
this.onRoleCloseClick()
}, this);
//ai语音开关
GButton.BandClick(this._nodeTab.btnYuyin, ()=>{
GameManager.AIVoiceSwt = !GameManager.AIVoiceSwt;
this.refreshAIVoiceState()
}, this);
this.refreshAIVoiceState()
if (!SDKManager.checkSupportBase64Audio()) {
this._nodeTab.btnYuyin.active = false
}
SDKManager.register_video_reward(this.node.uuid, (tag:number)=>{
console.log("视频广告回调", tag)
if (tag == 1) {
// 加次数
SubManager.ShowPrompt("观看视频成功,获得聊天次数")
this.doAddLevelCnt(1)
}
})
SDKManager.register_share_reward(this.node.uuid, (tag:number)=>{
console.log("分享回调", tag)
if (tag == 1) {
// 加次数
SubManager.ShowPrompt("分享成功,获得聊天次数")
this.doAddLevelCnt(2)
}
})
this.initedGame()
this.initXinAni()
}
onDestroy () {
super.onDestroy()
if (isValid(this.ebTalk)) {
this.ebTalk.node.off('editing-did-began', this.onEditingBegan, this);
this.ebTalk.node.off('editing-did-ended', this.onEditingEnded, this);
this.ebTalk.node.off('editing-return', this.onEditingReturn, this);
}
}
update(deltaTime: number) {
//region 打字机效果逻辑
if (this.dazijiInfo.stage == 1) {
this.dazijiInfo.tm += deltaTime
if (this.dazijiInfo.tm >= this.dazijiInfo.ts) {
this.dazijiInfo.tm = 0
this.dazijiInfo.lab.string = this.dazijiInfo.str.substring(0, this.dazijiInfo.idx)
this.dazijiInfo.idx += 1
if (this.dazijiInfo.idx > this.dazijiInfo.str.length) {
this.dazijiInfo.stage = 2
}
}
} else if (this.dazijiInfo.stage == 2) {
console.log("文本打字机效果结束")
this.dazijiInfo.stage = 0
this.dazijiInfo.lab.string = this.dazijiInfo.str
this._nodeTab.arrowNode.active = true;
}
//接收npc回复逻辑
if (this.npcTalkInfo.stage == 1) {
this.npcTalkInfo.tm += deltaTime
if (this.npcTalkInfo.tm >= this.npcTalkInfo.ts) {
this.npcTalkInfo.tm = 0
GameManager.I.getNpcTalkBack({})
this.labNpcTalk.string = this.npcTalkInfo.dotStr.substring(0, this.npcTalkInfo.dotIdx)
this.npcTalkInfo.dotIdx += 1
if (this.npcTalkInfo.dotIdx > this.npcTalkInfo.dotStr.length) {
this.npcTalkInfo.dotIdx = 0
}
}
}
}
//region AI回复消息
/**接收到npc回复数据流 */
resiveNpcTalkBack(data:I_NpcTalkBack) {
this.npcTalkInfo.stage = 0
GameManager.TurnToStage(E_TalkStage.npcTalk)
}
/**socket连接超时 */
resiveSocketTimeout(data:any) {
SubManager.ShowConfirm({
content: "连接已断开,请重新开始游戏",
hideNo: true, //隐藏取消按钮
yesCallback: () => {
ViewManager.I.closeAllView();
Utils.sendInnerMsg(InnerMsgCode.UI_Talk_Back, {})
},
closeCallback: () => {
ViewManager.I.closeAllView();
Utils.sendInnerMsg(InnerMsgCode.UI_Talk_Back, {})
}
})
this.npcTalkInfo.stage = 0
}
/**接收到聊天状态变化消息 */
resiveTalkStageUp(data:any) {
this.refreshTalkStage()
}
/**接收到星级变化消息 */
resiveLevelStarUp(data:any) {
if (data && data.level == GameManager.CurLevelId) {
for (let i=1; i<=3; i++) {
let lsStar = this._nodeTab["lsStar"+i].getComponent(Sprite)
let starPath = data.star >= i ? "lv_3" : "lv_2"
ResManager.I.changeBundleSpriteFrame(lsStar, starPath, "Zhujiemian")
}
}
}
/**重新开始游戏 */
resiveResartGame(data:any) {
console.log("重新开始游戏")
this.initedGame()
}
/**初始化 */
initedGame() {
this.lvCfg = GameManager.getLevelCfg(GameManager.CurLevelId)
//名称
Utils.setString(this._nodeTab.npcName, this.lvCfg.name)
//刷新历史星级
for (let i=1; i<=3; i++) {
let lsStar = this._nodeTab["lsStar"+i].getComponent(Sprite)
let starPath = this.lvCfg.star >= i ? "lv_3" : "lv_2"
ResManager.I.changeBundleSpriteFrame(lsStar, starPath, "Zhujiemian")
}
this._nodeTab.ruleNode.active = false
this.refreshTalkStage()
//刷新状态显示
this.refreshTalkStepData()
this.refreshXindongCishu(false)
this.refreshDuihuaDefen()
//检测引导
this.checkGuide()
}
//输入框开始编辑事件
onEditingBegan(param1:any, param2:any) {
console.log("聊天界面1 onEditingBegan", param1, param2)
}
//输入框回车事件
onEditingReturn(param1:any, param2:any) {
console.log("聊天界面2 onEditingReturn", param1, param2)
}
//输入框结束编辑事件
onEditingEnded(param1:any, param2:any) {
console.log("聊天界面3 onEditingEnded", param1, param2)
}
//刷新AI语音状态
private refreshAIVoiceState() {
let voicePath = GameManager.AIVoiceSwt ? "lv_4" : "lv_5"
let sptYuyin = this._nodeTab.sptYuyin.getComponent(Sprite)
ResManager.I.changeBundleSpriteFrame(sptYuyin, voicePath, "Zhujiemian")
}
//播放AI语音
private playAIVoice(str:string) {
if (!GameManager.AIVoiceSwt) {
return //开关没开
}
if (!SDKManager.checkSupportBase64Audio()) {
return //不支持base64音频
}
HttpUnit.ins.getAIVoice({record_id: GameManager.RecordId, text:str}, (data) => {
if (data) {
console.log("播放AI语音11", data)
SDKManager.playBase64Audio(data.url, false)
}
})
}
//region 刷新聊天状态
private refreshTalkStage() {
let gStage = GameManager.curStage
if (gStage == E_TalkStage.prologue) {
this.showNpcPrologue()
} else if (gStage == E_TalkStage.myTalk) {
this.turnToMyTalk()
} else if (gStage == E_TalkStage.waitNpcTalk) {
this.turnToWaitNpcTalk()
} else if (gStage == E_TalkStage.npcTalk) {
this.turnToNpcTalk(GameManager.CurNpcTalkData)
} else if (gStage == E_TalkStage.npcFixedTalk) {
this.turnToNpcFixedTalk(GameManager.CurNpcFixedTalkText)
} else if (gStage == E_TalkStage.upTalkStatus) {
this.turnToUpdateStage()
}
}
//显示NPC开场白
private showNpcPrologue() {
this._nodeTab.NpcTalkNode.active = true
this._nodeTab.MyTalkNode.active = false
this._nodeTab.arrowNode.active = false;
//开场白
this.dazijiInfo.stage = 1
this.dazijiInfo.idx = 0
this.dazijiInfo.lab = this.labNpcTalk
this.dazijiInfo.str = this.lvCfg.prologueMessage
this.dazijiInfo.tm = this.dazijiInfo.ts
GameManager.AddTalkRecord({talk:this.lvCfg.prologueMessage, isMe:false})
// this.playAIVoice(this.lvCfg.prologueMessage)
}
/**切换到玩家说话状态 */
private turnToMyTalk() {
this._nodeTab.NpcTalkNode.active = false
this._nodeTab.MyTalkNode.active = true
this.ebTalk.string = ""
// //刷新npc表情
// let rolePath = GameManager.GetNpcEmoPic("")
// Utils.sendInnerMsg(InnerMsgCode.SceneLayerBgUp, {rolePath:rolePath})
}
/**切换到等待NPC说话状态 */
private turnToWaitNpcTalk() {
this._nodeTab.NpcTalkNode.active = true
this._nodeTab.MyTalkNode.active = false
this._nodeTab.arrowNode.active = false;
this.labNpcTalk.string = ""
}
/**切换到NPC说话状态 */
private turnToNpcTalk(data:I_NpcTalkBack) {
this._nodeTab.NpcTalkNode.active = true
this._nodeTab.MyTalkNode.active = false
this._nodeTab.arrowNode.active = false;
GameManager.AddStepScore(data.aiScore) //记录本次分数
this.refreshDuihuaDefen()
//npc回复
// this.labNpcTalk.string = data.aiResponse
this.dazijiInfo.stage = 1
this.dazijiInfo.idx = 0
this.dazijiInfo.lab = this.labNpcTalk
this.dazijiInfo.str = data.aiResponse
this.dazijiInfo.tm = this.dazijiInfo.ts
GameManager.AddTalkRecord({talk:data.aiResponse, isMe:false})
this.playAIVoice(data.aiResponse)
//刷新npc表情
let rolePath = GameManager.GetNpcEmoPic(data.aiEmoji)
Utils.sendInnerMsg(InnerMsgCode.SceneLayerBgUp, {rolePath:rolePath})
//分数
//对话轮次
GameManager.srouceCnt = data.sourceCnt
this.refreshTalkStepData()
}
/**切换到npc固定话术展示状态 */
private turnToNpcFixedTalk(str:string) {
this._nodeTab.NpcTalkNode.active = true
this._nodeTab.MyTalkNode.active = false
this._nodeTab.arrowNode.active = false;
//npc固定话术
this.dazijiInfo.stage = 1
this.dazijiInfo.idx = 0
this.dazijiInfo.lab = this.labNpcTalk
this.dazijiInfo.str = str
this.dazijiInfo.tm = this.dazijiInfo.ts
}
/**切换到更新聊天状态状态 */
private turnToUpdateStage() {
HttpUnit.ins.getTalkStage({record_id: GameManager.RecordId}, (data) => {
if (data) {
GameManager.CurLevelData = data.level
this.refreshTalkStepData()
this.checkIsFinish()
}
})
}
/**刷新心动次数 */
private refreshXindongCishu(doAct:boolean = true) {
let maxCount = HttpUnit.GetXindongMaxCount()
let curCount = GameManager.xindongCishu
Utils.setString(this._nodeTab.xindongNum, `${curCount}/${maxCount}`)
Tween.stopAllByTarget(this.xindongSpt)
if (doAct) {
tween(this.xindongSpt).to(0.3, { fillRange: curCount / maxCount }).start()
} else {
this.xindongSpt.fillRange = curCount / maxCount
}
}
/**刷新对话得分 */
private refreshDuihuaDefen() {
let curScore = GameManager.getCurStepScore()
let [totalScore, pjScore] = GameManager.getGameScore()
Utils.setString(this._nodeTab.scoreNew, curScore+"")
Utils.setString(this._nodeTab.scoreTotal, totalScore+"")
}
/**刷新当前状态显示 */
private refreshTalkStepData() {
let curCnt = GameManager.srouceCnt
let stepData = GameManager.CurLevelData
Utils.setString(this._nodeTab.lunciNum, `${curCnt}/${stepData.total_cnt}`)
}
//region 检测是否结束
/**检查对话轮次是否用完
* @returns [是否结束对话,是否显示广告加次数]
*/
private checkIsFinish() {
let isFinish = false //是否结束对话
let isShowAD = false //是否显示广告
let isSendEnd = false //是否发送结束请求
let stepData = GameManager.CurLevelData
if (stepData.status == E_TalkStatusType.succ) {
//已成功
isFinish = true
} else if (stepData.status == E_TalkStatusType.fail) {
//已失败
isFinish = true
} else if (stepData.status == E_TalkStatusType.noCount) {
//次数已用完
isFinish = true
isShowAD = true
isSendEnd = true
}
if (isFinish) {
if (isShowAD) {
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
type: E_AD_TARGET.liaotian, //加聊天次数
content: "看广告或分享可额外获取对话次数",
adCallback: ()=>{
SDKManager.show_reward_video_ad(this.node.uuid, 1)
},
shareCallback: ()=>{
SDKManager.show_reward_share(this.node.uuid, 1)
},
closeCallback: ()=>{
if (isSendEnd) {
this.doJiesuan()
} else {
ViewManager.I.openBundlesView("UI/StartUI/Finish_UI", stepData)
}
}
})
} else {
if (isSendEnd) {
this.doJiesuan()
} else {
ViewManager.I.openBundlesView("UI/StartUI/Finish_UI", stepData)
}
}
} else {
GameManager.TurnToStage(E_TalkStage.myTalk)
}
}
//增加聊天次数 atype: 1=看广告 2=分享
private doAddLevelCnt(atype:number) {
HttpUnit.ins.addTalkCnt({record_id: GameManager.RecordId, type:atype}, (data) => {
if (data) {
GameManager.CurLevelData = data.level
this.refreshTalkStepData()
//判断是否继续对话
if (GameManager.srouceCnt < data.level.total_cnt) {
GameManager.TurnToStage(E_TalkStage.myTalk)
} else {
this.doJiesuan()
}
}
})
}
//结算
private doJiesuan() {
let [score_all, score] = GameManager.getGameScore()
HttpUnit.ins.sendLevelFinish({record_id: GameManager.RecordId, score:score, score_all:score_all}, (data) => {
if (data && data.level) {
//成功
ViewManager.I.openBundlesView("UI/StartUI/Finish_UI", data.level)
} else {
//失败
console.warn("结算失败,服务器返回异常!")
ViewManager.I.closeAllView();
Utils.sendInnerMsg(InnerMsgCode.UI_Talk_Back, {})
}
})
}
//退出聊天
onBackClick() {
SubManager.ShowConfirm({
content: "确定退出吗?\n(退出会保留当前聊天进度)",
yesCallback: () => {
//退出并结算
// this.doJiesuan();
//只退出聊天,不结算
this.onClose();
Utils.sendInnerMsg(InnerMsgCode.UI_Talk_Back, {})
}
})
}
//发送消息
onSendClick() {
let str = this.ebTalk.string;
if (str.length == 0) {
SubManager.ShowPrompt("请先输入内容")
return
}
GameManager.TurnToStage(E_TalkStage.waitNpcTalk)
this.ebTalk.string = ""
HttpUnit.ins.sendUserTalk({record_id: GameManager.RecordId, user_input: str}, (data) => {
if (data) {
GameManager.AddTalkRecord({talk:str, isMe:true})
//开始接收npc回复
this.npcTalkInfo.stage = 1
this.npcTalkInfo.str = ""
this.npcTalkInfo.tm = this.npcTalkInfo.ts
this.npcTalkInfo.dotIdx = 0
}
})
}
//随机回复对话
onSuijiClick() {
let sjLen = this.lvCfg.randomInputPool.length
let randIdx = Utils.getRandomInt(0, sjLen-1)
console.log("随机回复对话:", randIdx, sjLen)
if (randIdx == this.lastRandTalkIdx) {
randIdx++
if (randIdx >= sjLen) randIdx = 0
}
this.lastRandTalkIdx = randIdx
this.ebTalk.string = this.lvCfg.randomInputPool[randIdx]
}
//点击npc对话背景
onNpcFramClick() {
if (this.dazijiInfo.stage == 1) {
this.dazijiInfo.stage = 2
} else {
if (GameManager.curStage == E_TalkStage.prologue) {
GameManager.TurnToStage(E_TalkStage.upTalkStatus)
} else if (GameManager.curStage == E_TalkStage.npcTalk) {
let npcTalk = GameManager.CurNpcTalkData
if (npcTalk.judgement == 0) {
console.log("固定鼓励话术展示!", GameManager.npcFixTalkCountXihuan)
if (GameManager.npcFixTalkCountXihuan > 0) {
GameManager.TurnToStage(E_TalkStage.upTalkStatus)
} else {
GameManager.CurNpcFixedTalkText = this.lvCfg.encourageMessage
GameManager.TurnToStage(E_TalkStage.npcFixedTalk)
}
GameManager.npcFixTalkCountXihuan = GameManager.npcFixTalkCountXihuan + 1
GameManager.xindongCishu = GameManager.xindongCishu + 1
this.showXinAddAnimation()
// this.refreshXindongCishu(true)
} else if (npcTalk.judgement == 2) {
console.log("固定厌恶话术展示!", GameManager.npcFixTalkCountTaoyan)
if (GameManager.npcFixTalkCountTaoyan > 0) {
GameManager.TurnToStage(E_TalkStage.upTalkStatus)
} else {
GameManager.CurNpcFixedTalkText = this.lvCfg.hateMessage
GameManager.TurnToStage(E_TalkStage.npcFixedTalk)
}
GameManager.npcFixTalkCountTaoyan = GameManager.npcFixTalkCountTaoyan + 1
} else {
GameManager.TurnToStage(E_TalkStage.upTalkStatus)
}
} else if (GameManager.curStage == E_TalkStage.npcFixedTalk) {
GameManager.TurnToStage(E_TalkStage.upTalkStatus)
}
}
}
//region 爱心增加动画
private _xin1PosOrig: Vec3
private _xin2PosOrig: Vec3
private _xin2Opa: UIOpacity = null
//初始化爱心动画
private initXinAni() {
this._xin1PosOrig = (this._nodeTab.xinSpt1 as Node).position.clone()
this._xin2PosOrig = (this._nodeTab.xinSpt2 as Node).position.clone()
this._xin2Opa = this._nodeTab.xinSpt2.getComponent(UIOpacity)
this._xin2Opa.opacity = 0
}
//显示爱心增加动画
private showXinAddAnimation() {
Tween.stopAllByTarget(this._nodeTab.xinSpt2)
Tween.stopAllByTarget(this._xin2Opa)
let xinSpt2: Node = this._nodeTab.xinSpt2
xinSpt2.position = this._xin2PosOrig
tween(xinSpt2)
.to(0.45, { position: this._xin1PosOrig }, {easing: 'sineIn'})
.call(() => {
this.showXin2Animation()
this.refreshXindongCishu(true) //刷新次数显示
})
.start()
// #region 贝塞尔曲线动作
// // 三维空间的缓动
// const quadraticCurve = (t: number, p1: Vec3, cp: Vec3, p2: Vec3, out: Vec3) => {
// out.x = (1 - t) * (1 - t) * p1.x + 2 * t * (1 - t) * cp.x + t * t * p2.x
// out.y = (1 - t) * (1 - t) * p1.y + 2 * t * (1 - t) * cp.y + t * t * p2.y
// out.z = (1 - t) * (1 - t) * p1.z + 2 * t * (1 - t) * cp.z + t * t * p2.z
// }
// const startPos = this._xin2PosOrig
// const controlPos = v3(2, 3, 0)
// const endPos = this._xin1PosOrig
// const tempVec3 = v3()
// tween(xinSpt2)
// .to(
// 0.45,
// { position: endPos },
// {
// onUpdate: (target, ratio) => {
// quadraticCurve(ratio, startPos, controlPos, endPos, tempVec3)
// xinSpt2.setPosition(tempVec3)
// },
// }
// )
// .call(() => {
// this.showXin2Animation()
// this.refreshXindongCishu(true) //刷新次数显示
// })
// .start()
// #endregion
this._xin2Opa.opacity = 0
tween(this._xin2Opa)
.to(0.05, { opacity: 255 })
.delay(0.35)
.to(0.05, { opacity: 0 })
.start()
}
private showXin2Animation() {
Tween.stopAllByTarget(this._nodeTab.xinSpt1)
let xinSpt1: Node = this._nodeTab.xinSpt1
xinSpt1.scale = new Vec3(1, 1, 1)
tween(xinSpt1)
.to(0.3, {scale: new Vec3(1.4, 1.4, 1.4) }, {easing: 'sineInOut'})
.to(0.3, {scale: new Vec3(1, 1, 1) }, {easing: 'sineInOut'})
.start()
}
//region 引导相关
//检查引导
private checkGuide() {
if (PlayerDataManager.I.GuideTalkFinished) {
return
}
let delayInterval = 0.5
GameRootUI.DisableOper(delayInterval)
this.scheduleOnce(() => {
this._nodeTab.ruleNode.active = true
},delayInterval)
}
//引导完成
private finishGuide() {
if (PlayerDataManager.I.GuideTalkFinished) {
return
}
PlayerDataManager.I.SetGuideTalkFinish(true)
}
//关闭规则弹窗
private onRoleCloseClick() {
this._nodeTab.ruleNode.active = false
this.finishGuide()
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "2566589f-db98-4d79-9fb5-3181c0882f62",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "tj_hy_Cell"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "9ccc8ad0-7342-44f7-a963-b3aea0b0bcfe",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "9ccc8ad0-7342-44f7-a963-b3aea0b0bcfe@6c48a",
"displayName": "may_maria_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "9ccc8ad0-7342-44f7-a963-b3aea0b0bcfe",
"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": "9ccc8ad0-7342-44f7-a963-b3aea0b0bcfe@f9941",
"displayName": "may_maria_default",
"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": "9ccc8ad0-7342-44f7-a963-b3aea0b0bcfe@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "9ccc8ad0-7342-44f7-a963-b3aea0b0bcfe@6c48a"
}
}