init
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "d5244228-33d7-4283-92f7-404f0ac0c4ff",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "Setting_UI"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 471 KiB |
|
After Width: | Height: | Size: 162 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 232 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "306ff24b-5365-4490-86f0-60e47bdc5c17",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "306ff24b-5365-4490-86f0-60e47bdc5c17@6c48a",
|
||||
"displayName": "raw1",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "306ff24b-5365-4490-86f0-60e47bdc5c17",
|
||||
"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": "306ff24b-5365-4490-86f0-60e47bdc5c17@f9941",
|
||||
"displayName": "raw1",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 630,
|
||||
"height": 1010,
|
||||
"rawWidth": 630,
|
||||
"rawHeight": 1010,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-315,
|
||||
-505,
|
||||
0,
|
||||
315,
|
||||
-505,
|
||||
0,
|
||||
-315,
|
||||
505,
|
||||
0,
|
||||
315,
|
||||
505,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1010,
|
||||
630,
|
||||
1010,
|
||||
0,
|
||||
0,
|
||||
630,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-315,
|
||||
-505,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
315,
|
||||
505,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "306ff24b-5365-4490-86f0-60e47bdc5c17@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "306ff24b-5365-4490-86f0-60e47bdc5c17@6c48a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
import { _decorator, instantiate, Label, Layout, Node, Prefab, ScrollView, Sprite, tween, UIOpacity, UITransform } from 'cc';
|
||||
import { GButton } from '../../Main/Common/GButton';
|
||||
import Utils from '../../Main/Common/Utils';
|
||||
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
|
||||
import li_BaseView from '../../Main/Common/li_BaseView';
|
||||
import GameManager from '../../Main/Manager/GameManager';
|
||||
import ResManager from '../../Main/Manager/ResManager';
|
||||
import { SDKManager } from '../../Main/Channel/SDKManager';
|
||||
import { ViewManager } from '../../Main/Manager/ViewManager';
|
||||
import { E_AD_TARGET } from './TalkAdDialog';
|
||||
import SubManager from '../SubManager';
|
||||
import HttpUnit from '../../Main/Common/HttpUnit';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//聊天记录界面
|
||||
@ccclass('Record_UI')
|
||||
export class Record_UI extends li_BaseView {
|
||||
|
||||
@property(Prefab)
|
||||
private talkNpcItem: Prefab = null;
|
||||
@property(Prefab)
|
||||
private talkUserItem: Prefab = null;
|
||||
|
||||
private _nodeTab: any = {};
|
||||
private talkSV: ScrollView = null;
|
||||
private _data;
|
||||
|
||||
private itemNodeList: any[] = [];
|
||||
private itemDataList: any[] = [];
|
||||
|
||||
//----重写父类接口---------------------------------------
|
||||
onLoadCT() {
|
||||
this.registerListenner();
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
this.talkSV = this._nodeTab.talkSV.getComponent(ScrollView);
|
||||
}
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data
|
||||
}
|
||||
|
||||
|
||||
registerListenner() {
|
||||
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
GButton.BandClick(this._nodeTab.btnBack, ()=>{
|
||||
this.onClose();
|
||||
}, this);
|
||||
|
||||
//撤回按钮
|
||||
GButton.BandClick(this._nodeTab.chehuiNode, ()=>{
|
||||
let cellLen = this.itemDataList.length
|
||||
if (cellLen <= 1) {
|
||||
SubManager.ShowPrompt("没有可以撤回的对话")
|
||||
return
|
||||
}
|
||||
|
||||
let contStr = ""
|
||||
let levelData = GameManager.CurLevelData
|
||||
if (!levelData || levelData.can_use_cancel_cnt <= 0) {
|
||||
contStr = "关卡内撤回次数已用完"
|
||||
} else {
|
||||
contStr = `观看广告,可撤回最近一次对话并返还 1 次对话次数,剩余${levelData.can_use_cancel_cnt}次`
|
||||
}
|
||||
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
|
||||
type: E_AD_TARGET.chehui, //撤回,并加聊天次数
|
||||
content: contStr,
|
||||
adCallback: ()=>{
|
||||
SDKManager.show_reward_video_ad(this.node.uuid, 1)
|
||||
},
|
||||
shareCallback: ()=>{
|
||||
SDKManager.show_reward_share(this.node.uuid, 1)
|
||||
}
|
||||
})
|
||||
}, this);
|
||||
|
||||
SDKManager.register_video_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("视频广告回调", tag)
|
||||
if (tag == 1) {
|
||||
// 撤回聊天
|
||||
this.doChehuiTalk()
|
||||
}
|
||||
})
|
||||
SDKManager.register_share_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("分享回调", tag)
|
||||
if (tag == 1) {
|
||||
// 撤回聊天
|
||||
this.doChehuiTalk()
|
||||
}
|
||||
})
|
||||
|
||||
let lvCfg = GameManager.getLevelCfg(GameManager.CurLevelId)
|
||||
//npc名字
|
||||
Utils.setString(this._nodeTab.npcName, lvCfg.name)
|
||||
|
||||
this.itemNodeList = []
|
||||
this.itemDataList = []
|
||||
let talkLay: Layout = this.talkSV.content.getComponent(Layout)
|
||||
let talkCellLen = GameManager.TalkRecordList.length
|
||||
let aniTime = 0 //滚动动作总时间
|
||||
talkLay.enabled = false;
|
||||
for (let i=0; i<talkCellLen; i++) {
|
||||
// for (let i=talkCellLen-1; i>=0; i--) {
|
||||
let info = GameManager.TalkRecordList[i];
|
||||
let titem = info.isMe ? this.talkUserItem : this.talkNpcItem;
|
||||
let itemClone:any = instantiate(titem);
|
||||
this._nodeTab.talkLay.addChild(itemClone);
|
||||
|
||||
Utils.parseNode(itemClone);
|
||||
this.itemNodeList.push(itemClone);
|
||||
this.itemDataList.push(info);
|
||||
//头像
|
||||
let spt = itemClone.headIcon.getComponent(Sprite)
|
||||
if (info.isMe) {
|
||||
let avatarUrl = SDKManager.avatarUrl;
|
||||
if (avatarUrl == "" || avatarUrl == null) {
|
||||
SDKManager.getUserInfo((data) => {
|
||||
ResManager.I.changeRemoteSpriteFrame(spt, data.avatarUrl)
|
||||
})
|
||||
} else {
|
||||
ResManager.I.changeRemoteSpriteFrame(spt, avatarUrl)
|
||||
}
|
||||
} else {
|
||||
let headPath = `head/${lvCfg.characterAvatar}`
|
||||
ResManager.I.changeBundleSpriteFrame(spt.getComponent(Sprite), headPath, "Raw")
|
||||
}
|
||||
//对话文本
|
||||
Utils.setString(itemClone.labTalk, info.talk)
|
||||
//得分
|
||||
if (info.isMe || info.score < 0) {
|
||||
itemClone.labScore.active = false;
|
||||
} else {
|
||||
itemClone.labScore.active = true;
|
||||
Utils.setString(itemClone.labScore, `得分:${info.score}`)
|
||||
}
|
||||
|
||||
//动作
|
||||
let kuangOpa:UIOpacity = itemClone.kuang.getComponent(UIOpacity)
|
||||
kuangOpa.opacity = 1;
|
||||
// let didx = talkCellLen-1-i;
|
||||
let didx = i;
|
||||
let tdelay = didx * 0.03;
|
||||
let self = this;
|
||||
if (i == talkCellLen-1) {
|
||||
aniTime = 0.2 + tdelay;
|
||||
}
|
||||
tween(kuangOpa)
|
||||
.delay(0.2 + tdelay)
|
||||
.to(0.2, { opacity: 255 })
|
||||
.call(()=>{
|
||||
//滚动到当前节点处
|
||||
self.talkSV.scrollToPercentVertical((talkCellLen-1-i) / talkCellLen, 0.1);
|
||||
//调整框宽度
|
||||
let labTf:UITransform = itemClone.labTalk.getComponent(UITransform);
|
||||
let kuangTf:UITransform = itemClone.kuang.getComponent(UITransform);
|
||||
kuangTf.width = labTf.width + 30;
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
//延迟一下,设置文本换行模式
|
||||
this.scheduleOnce(()=>{
|
||||
for (let i=0; i<this.itemNodeList.length; i++) {
|
||||
let item = this.itemNodeList[i];
|
||||
let labTf:UITransform = item.labTalk.getComponent(UITransform);
|
||||
let lab:Label = item.labTalk.getComponent(Label);
|
||||
if (labTf.height < 50) { //小于50,说明没换行,改为自动宽度
|
||||
lab.overflow = Label.Overflow.NONE;
|
||||
} else {
|
||||
lab.overflow = Label.Overflow.RESIZE_HEIGHT;
|
||||
}
|
||||
}
|
||||
}, 0.1)
|
||||
|
||||
//延迟一下,调整文本框的宽度。高度由layout自动调整
|
||||
this.scheduleOnce(()=>{
|
||||
talkLay.enabled = true;
|
||||
}, 0.15)
|
||||
|
||||
//撤回按钮显示动画
|
||||
let chehuiOpa: UIOpacity = this._nodeTab.chehuiNode.getComponent(UIOpacity);
|
||||
chehuiOpa.opacity = 0;
|
||||
tween(chehuiOpa)
|
||||
.delay(aniTime)
|
||||
.to(0.2, {opacity: 255})
|
||||
.start();
|
||||
|
||||
//刷新撤回次数
|
||||
this.refreshChehuiCount()
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**刷新撤回次数 */
|
||||
refreshChehuiCount() {
|
||||
let levelData = GameManager.CurLevelData
|
||||
let n_cur = levelData.can_use_cancel_cnt || 0
|
||||
let n_max = 3
|
||||
Utils.setString(this._nodeTab.labChehui, n_cur + "/" + n_max)
|
||||
}
|
||||
|
||||
|
||||
/**撤回上一轮发言 */
|
||||
doChehuiTalk() {
|
||||
HttpUnit.ins.sendTalkChehui({record_id: GameManager.RecordId}, (data) => {
|
||||
if (data) {
|
||||
SubManager.ShowPrompt("聊天次数+1")
|
||||
GameManager.CurLevelData = data.level
|
||||
GameManager.srouceCnt = data.level.current_cnt
|
||||
Utils.sendInnerMsg(InnerMsgCode.Data_LunciUp, {})
|
||||
this.refreshChehuiCount()
|
||||
let cellLen = this.itemNodeList.length
|
||||
if (cellLen > 1) {
|
||||
for (let i=cellLen-1; i>=0; i--) {
|
||||
let item: Node = this.itemNodeList[i]
|
||||
let info = this.itemDataList[i]
|
||||
item.removeFromParent()
|
||||
this.itemNodeList.splice(i, 1)
|
||||
this.itemDataList.splice(i, 1)
|
||||
if (info && info.isMe) {
|
||||
break
|
||||
}
|
||||
}
|
||||
GameManager.RemoveLastRoundTalkRecord()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
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';
|
||||
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: any[] = []; //关卡数据
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
|
||||
GButton.BandClick(this._nodeTab.btnStart, this.onStartClick, this);
|
||||
// GButton.BandClick(this._nodeTab.btnSetting, this.onSettingClick, this);
|
||||
|
||||
AudioManager.I.PlayMusic(1, true) //背景乐
|
||||
GameRootUI.InitDisableOperUI(false)
|
||||
GameRootUI.InitCrossUI(false)
|
||||
this.setUIVisible(true)
|
||||
|
||||
//判断玩家权限是否已获取
|
||||
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("收到退出聊天消息")
|
||||
this.setUIVisible(true)
|
||||
}
|
||||
|
||||
|
||||
//显示主界面UI
|
||||
setUIVisible(vis: boolean) {
|
||||
this._nodeTab.UIRoot.active = vis
|
||||
}
|
||||
|
||||
//刷新玩家信息完毕
|
||||
userInited() {
|
||||
this.refreshSdkUI()
|
||||
//初始化关卡列表
|
||||
this.levelData = [1,2,3,4,5,6,7,8,9]
|
||||
this.levelData.unshift(0) //在最前面插入一个占位数据,用于数组排版显示
|
||||
this.Level_List.numItems = this.levelData.length
|
||||
this.curLevelIdx = 1
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//关卡列表渲染
|
||||
onRenderItemList(node: any, idx: number) {
|
||||
if(!isValid(node)) {return}
|
||||
if (!node.inited) {
|
||||
node.inited = true;
|
||||
Utils.parseNode(node);
|
||||
}
|
||||
|
||||
//第一个是占位用的
|
||||
if (idx == 0) {
|
||||
node.l_rotateN.active = false
|
||||
return
|
||||
}
|
||||
|
||||
node.l_rotateN.active = true
|
||||
let data = this.levelData[idx]
|
||||
|
||||
GButton.RemoveAndBandClick(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]
|
||||
let bgPath = "bg"+idx
|
||||
let rolePath = "role"+idx
|
||||
Utils.sendInnerMsg(InnerMsgCode.SceneLayerBgUp, {bgPath:bgPath, rolePath:rolePath})
|
||||
}
|
||||
|
||||
|
||||
//开始游戏
|
||||
onStartClick() {
|
||||
Utils.Log("点击开始游戏");
|
||||
// //测试代码
|
||||
// if (true) {
|
||||
// this.setUIVisible(false)
|
||||
// ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
|
||||
// return
|
||||
// }
|
||||
|
||||
let level_id = `game_level_${this.curLevelIdx}`
|
||||
HttpUnit.ins.levelStart({level_id:level_id}, (data) => {
|
||||
this.setUIVisible(false)
|
||||
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
|
||||
})
|
||||
}
|
||||
|
||||
// //设置
|
||||
// onSettingClick() {
|
||||
// ViewManager.I.openBundlesView("UI/StartUI/Setting_UI")
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "cd14a47d-6bb6-4a94-864e-f5c675c83c2d",
|
||||
"files": [
|
||||
".jpg",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "cd14a47d-6bb6-4a94-864e-f5c675c83c2d@6c48a",
|
||||
"displayName": "xinfu_3_cg",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "cd14a47d-6bb6-4a94-864e-f5c675c83c2d",
|
||||
"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": "cd14a47d-6bb6-4a94-864e-f5c675c83c2d@f9941",
|
||||
"displayName": "xinfu_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": "cd14a47d-6bb6-4a94-864e-f5c675c83c2d@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": false,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "cd14a47d-6bb6-4a94-864e-f5c675c83c2d@6c48a"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 417 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "96d7b836-48be-4a1f-a293-8620c2107959",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "96d7b836-48be-4a1f-a293-8620c2107959@6c48a",
|
||||
"displayName": "shirley_disgust",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "96d7b836-48be-4a1f-a293-8620c2107959",
|
||||
"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": "96d7b836-48be-4a1f-a293-8620c2107959@f9941",
|
||||
"displayName": "shirley_disgust",
|
||||
"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": "96d7b836-48be-4a1f-a293-8620c2107959@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "96d7b836-48be-4a1f-a293-8620c2107959@6c48a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
import { _decorator, Node, v2 } from "cc";
|
||||
import { I_LevelConfig, I_LevelStepData, I_NpcTalkBack, I_TalkRecordInfo } from "../Config/CommonConfig";
|
||||
import SocketUnit from "../Common/SocketUnit";
|
||||
import Utils from "../Common/Utils";
|
||||
import { InnerMsgCode } from "../Config/InnerMsgCode";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
/**聊天状态 */
|
||||
export enum E_TalkStatusType {
|
||||
succ = 0, //成功
|
||||
talking = 1, //对话中
|
||||
fail = 2, //失败
|
||||
noCount = 3, //次数不足
|
||||
}
|
||||
|
||||
|
||||
//游戏管理器
|
||||
@ccclass('GameManager')
|
||||
export default class GameManager {
|
||||
|
||||
private static _I: GameManager = null;
|
||||
public static get I(): GameManager {
|
||||
if (!GameManager._I) {
|
||||
GameManager._I = new GameManager();
|
||||
GameManager._I.init();
|
||||
}
|
||||
return GameManager._I;
|
||||
}
|
||||
|
||||
private init(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//长连接相关==============================================================
|
||||
private _socket: SocketUnit = null;
|
||||
/**连接长连接 */
|
||||
public connetSorcket(record_id:string){
|
||||
this.disconnectSocket();
|
||||
this._socket = new SocketUnit();
|
||||
this._socket.connect(`ws://47.119.190.199:20190/game/ai/response/${record_id}`);
|
||||
this._socket.onDataReceived((data: any) => {
|
||||
let resData = JSON.parse(data.data)
|
||||
// console.log("收到长连接消息", resData)
|
||||
Utils.sendInnerMsg(InnerMsgCode.Data_NpcTalkBack, resData || {})
|
||||
})
|
||||
}
|
||||
/**断开长连接 */
|
||||
public disconnectSocket(){
|
||||
if (this._socket){
|
||||
this._socket.disconnect();
|
||||
}
|
||||
this._socket = null;
|
||||
}
|
||||
/**获取npc回复 */
|
||||
public getNpcTalkBack(data: any){
|
||||
if (this._socket){
|
||||
let str = JSON.stringify(data)
|
||||
this._socket.sendData(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//关卡数据相关==============================================================
|
||||
private static _levelCfgArray: I_LevelConfig[] = [];
|
||||
private static _levelCfgMap: {[key: string]: I_LevelConfig} = {};
|
||||
/**设置关卡配置数据 */
|
||||
public static SetLevelCfg(levelCfg: any[]) {
|
||||
GameManager._levelCfgArray = levelCfg;
|
||||
let info:any = null;
|
||||
for (let i = 0; i < levelCfg.length; i++) {
|
||||
info = levelCfg[i];
|
||||
GameManager._levelCfgMap[info.id] = info;
|
||||
}
|
||||
}
|
||||
|
||||
/**获取关卡配置 */
|
||||
public static getLevelCfg(levelId: string): I_LevelConfig {
|
||||
return GameManager._levelCfgMap[levelId];
|
||||
}
|
||||
|
||||
|
||||
private static _AIVoiceSwt: boolean = false;
|
||||
/**设置是否显示AI语音 */
|
||||
public static set AIVoiceSwt(value: boolean) {
|
||||
GameManager._AIVoiceSwt = value;
|
||||
}
|
||||
/**获取是否显示AI语音 */
|
||||
public static get AIVoiceSwt(): boolean {
|
||||
return GameManager._AIVoiceSwt;
|
||||
}
|
||||
|
||||
|
||||
private static _curLevelId: string = "";
|
||||
/**设置当前关卡ID */
|
||||
public static set CurLevelId(value: string) {
|
||||
GameManager._curLevelId = value;
|
||||
}
|
||||
/**获取当前关卡ID */
|
||||
public static get CurLevelId(): string {
|
||||
return GameManager._curLevelId;
|
||||
}
|
||||
|
||||
|
||||
private static _recordId: string = "";
|
||||
/**设置当前关卡流程ID */
|
||||
public static set RecordId(value: string) {
|
||||
GameManager._recordId = value;
|
||||
}
|
||||
/**获取当前关卡流程ID */
|
||||
public static get RecordId(): string {
|
||||
return GameManager._recordId;
|
||||
}
|
||||
|
||||
|
||||
private static _curLevelData: I_LevelStepData = null;
|
||||
/**设置当前步骤数据 */
|
||||
public static set CurLevelData(value: I_LevelStepData) {
|
||||
GameManager._curLevelData = value;
|
||||
}
|
||||
/**获取当前步骤数据 */
|
||||
public static get CurLevelData(): I_LevelStepData {
|
||||
return GameManager._curLevelData;
|
||||
}
|
||||
|
||||
|
||||
private static _curNpcTalkData: I_NpcTalkBack = null;
|
||||
/**设置当前NPC回复数据 */
|
||||
public static set CurNpcTalkData(value: I_NpcTalkBack) {
|
||||
GameManager._curNpcTalkData = value;
|
||||
}
|
||||
/**获取当前NPC回复数据 */
|
||||
public static get CurNpcTalkData(): I_NpcTalkBack {
|
||||
return GameManager._curNpcTalkData;
|
||||
}
|
||||
|
||||
|
||||
private static stepScoreList: number[] = [];
|
||||
/**设置关卡步骤评分 */
|
||||
public static AddStepScore(score: number) {
|
||||
GameManager.stepScoreList.push(score);
|
||||
}
|
||||
/**清空关卡步骤评分 */
|
||||
public static ClearStepScore() {
|
||||
GameManager.stepScoreList = [];
|
||||
}
|
||||
/**获取关卡当前评分
|
||||
* @returns [总分,平均分]
|
||||
*/
|
||||
public static getGameScore(): [number,number] {
|
||||
let totalScore = 0;
|
||||
let totalStep = 0;
|
||||
GameManager.stepScoreList.forEach((score) => {
|
||||
totalScore += score;
|
||||
totalStep++;
|
||||
})
|
||||
let scoreRate = totalStep > 0 ? Math.floor(totalScore / totalStep) : 0;
|
||||
return [totalScore, scoreRate];
|
||||
}
|
||||
|
||||
|
||||
private static talkRecordList: I_TalkRecordInfo[] = [];
|
||||
/**添加对话记录 */
|
||||
public static AddTalkRecord(record: I_TalkRecordInfo) {
|
||||
GameManager.talkRecordList.push(record);
|
||||
}
|
||||
/**清空对话记录 */
|
||||
public static ClearTalkRecord() {
|
||||
GameManager.talkRecordList = [];
|
||||
}
|
||||
/**获取对话记录 */
|
||||
public static get TalkRecordList(): I_TalkRecordInfo[] {
|
||||
return GameManager.talkRecordList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "15fd7a10-8bd1-4d2a-b906-d4396cdd6507",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "15fd7a10-8bd1-4d2a-b906-d4396cdd6507@6c48a",
|
||||
"displayName": "jinhyun_avatar",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "15fd7a10-8bd1-4d2a-b906-d4396cdd6507",
|
||||
"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": "15fd7a10-8bd1-4d2a-b906-d4396cdd6507@f9941",
|
||||
"displayName": "jinhyun_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": "15fd7a10-8bd1-4d2a-b906-d4396cdd6507@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "15fd7a10-8bd1-4d2a-b906-d4396cdd6507@6c48a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "0ee189a2-1560-4d46-b2b0-e570ca1e707b",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "0ee189a2-1560-4d46-b2b0-e570ca1e707b@6c48a",
|
||||
"displayName": "lv_15",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "0ee189a2-1560-4d46-b2b0-e570ca1e707b",
|
||||
"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": "0ee189a2-1560-4d46-b2b0-e570ca1e707b@f9941",
|
||||
"displayName": "lv_15",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 1,
|
||||
"trimY": 0,
|
||||
"width": 162,
|
||||
"height": 54,
|
||||
"rawWidth": 164,
|
||||
"rawHeight": 54,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-81,
|
||||
-27,
|
||||
0,
|
||||
81,
|
||||
-27,
|
||||
0,
|
||||
-81,
|
||||
27,
|
||||
0,
|
||||
81,
|
||||
27,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
1,
|
||||
54,
|
||||
163,
|
||||
54,
|
||||
1,
|
||||
0,
|
||||
163,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0.006097560975609756,
|
||||
0,
|
||||
0.9939024390243902,
|
||||
0,
|
||||
0.006097560975609756,
|
||||
1,
|
||||
0.9939024390243902,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-81,
|
||||
-27,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
81,
|
||||
27,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "0ee189a2-1560-4d46-b2b0-e570ca1e707b@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "0ee189a2-1560-4d46-b2b0-e570ca1e707b@6c48a"
|
||||
}
|
||||
}
|
||||