This commit is contained in:
2025-07-17 17:18:21 +08:00
commit 1ffc1b5cf0
5309 changed files with 1150310 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "b23e329d-e36f-455f-ab7f-8b6ae75865a1",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "b23e329d-e36f-455f-ab7f-8b6ae75865a1@6c48a",
"displayName": "guihua_stage_bg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "b23e329d-e36f-455f-ab7f-8b6ae75865a1",
"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": "b23e329d-e36f-455f-ab7f-8b6ae75865a1@f9941",
"displayName": "guihua_stage_bg",
"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": "b23e329d-e36f-455f-ab7f-8b6ae75865a1@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "b23e329d-e36f-455f-ab7f-8b6ae75865a1@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "823055ea-aff7-4b11-ae8a-cd028a90989b",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "823055ea-aff7-4b11-ae8a-cd028a90989b@6c48a",
"displayName": "maki_anna_3_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "823055ea-aff7-4b11-ae8a-cd028a90989b",
"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": "823055ea-aff7-4b11-ae8a-cd028a90989b@f9941",
"displayName": "maki_anna_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": "823055ea-aff7-4b11-ae8a-cd028a90989b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "823055ea-aff7-4b11-ae8a-cd028a90989b@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "74f06575-b975-4642-8661-6556f77dee73",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "74f06575-b975-4642-8661-6556f77dee73@6c48a",
"displayName": "nanamiya_rie_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "74f06575-b975-4642-8661-6556f77dee73",
"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": "74f06575-b975-4642-8661-6556f77dee73@f9941",
"displayName": "nanamiya_rie_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 9.5,
"offsetY": -6,
"trimX": 89,
"trimY": 12,
"width": 766,
"height": 1177,
"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": [
-383,
-588.5,
0,
383,
-588.5,
0,
-383,
588.5,
0,
383,
588.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
89,
1177,
855,
1177,
89,
0,
855,
0
],
"nuv": [
0.09621621621621622,
0,
0.9243243243243243,
0,
0.09621621621621622,
0.9899074852817493,
0.9243243243243243,
0.9899074852817493
],
"minPos": [
-383,
-588.5,
0
],
"maxPos": [
383,
588.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "74f06575-b975-4642-8661-6556f77dee73@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "74f06575-b975-4642-8661-6556f77dee73@6c48a"
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

@@ -0,0 +1,126 @@
import HttpUnit from "../Common/HttpUnit";
export class WebSDK{
//初始化
init(cb: Function = null) {
console.log("init webSDK");
cb && cb();
}
//检查权限
checkAutoSetting(autoKey:string, cb:Function = null) {
cb && cb(true);
}
//获取用户信息
getUserInfo(cb:Function = null) {
let name = HttpUnit.GetNickName();
cb && cb({ nickName:name, avatarUrl:"https://hxzgame.vip.hnhxzkj.com/lzx/XiangQin/webHead.png" });
}
//登录
login(cb: Function = null) {
cb && cb({ platform:2, code: null });
}
//显示视频广告
show_video(callback:Function, tag:number) {
callback && callback({ code: 0, tag: tag });
}
//显示插屏
show_splash() {
}
//显示Banner
show_banner(...args) {
}
//隐藏Banner
hide_banner(...args) {
}
//主动拉起分享
show_share(rewardCB?:Function) {
rewardCB && rewardCB();
}
//获取设备分辨率
getWindowSize() {
return {width:screen.width, height: screen.height};
}
//显示游戏圈
show_gameClub(leftRatio, topRatio, widthRatio, heightRatio) {
}
//隐藏游戏圈
hide_gameClub() {
}
//检查是否支持base64音频播放
checkSupportBase64Audio() {
return true;
}
//播放base64音频
private _audioInst:HTMLAudioElement = null;
playBase64Audio(base64:string, loop:boolean) {
let substring = base64;
let qianzhui = "data:audio/x-wav;base64,"
if(base64.startsWith(qianzhui)) {
substring = base64.substring(qianzhui.length, base64.length)
}
// 解码 Base64 字符串为二进制数据
const binaryData = atob(substring);
// 创建一个包含二进制数据的 Uint8Array
const byteArray = new Uint8Array(binaryData.length);
for (let i = 0; i < binaryData.length; i++) {
byteArray[i] = binaryData.charCodeAt(i);
}
// 创建 Blob 对象,指定 MIME 类型为音频格式(例如 mp3)
const audioBlob = new Blob([byteArray], { type: 'audio/mp3' });
// 创建音频 URL
const audioUrl = URL.createObjectURL(audioBlob);
console.log("web 播放base64音频", audioUrl)
// 创建音频元素并播放
if (this._audioInst == null) {
this._audioInst = new Audio(audioUrl);
} else {
this._audioInst.src = audioUrl;
}
this._audioInst.play();
}
//客服功能是否支持
kefuSupport() {
console.log("web 不支持联系客服")
return false;
}
//进入联系客服
openKefu() {
console.log("web 进入联系客服")
}
//region 友盟+
umaInit() {
}
//友盟统计是否开启
umaSwt() {
return false;
}
//友盟事件统计
umaEvent(eventName: string, value: any = {}) {
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "6956800b-8bc3-40f0-abbd-932f51d77026",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "6956800b-8bc3-40f0-abbd-932f51d77026@6c48a",
"displayName": "hilaryvel_0_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "6956800b-8bc3-40f0-abbd-932f51d77026",
"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": "6956800b-8bc3-40f0-abbd-932f51d77026@f9941",
"displayName": "hilaryvel_0_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": "6956800b-8bc3-40f0-abbd-932f51d77026@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "6956800b-8bc3-40f0-abbd-932f51d77026@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 632 KiB

@@ -0,0 +1,455 @@
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";
import SubManager from "../../Sub/SubManager";
import HttpUnit from "../Common/HttpUnit";
import { SDKManager } from "../Channel/SDKManager";
const { ccclass, property } = _decorator;
/**聊天状态 */
export enum E_TalkStatusType {
succ = 0, //成功
talking = 1, //对话中
fail = 2, //失败
noCount = 3, //次数不足
}
/**对话阶段 */
export enum E_TalkStage {
/**开场白 */
prologue,
/**我的对话 */
myTalk,
/**等待NPC回复 */
waitNpcTalk,
/**NPC对话 */
npcTalk,
/**NPC固定话术 */
npcFixedTalk,
/**更新对话状态 */
upTalkStatus,
}
//游戏管理器
@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(){
}
//region长连接相关
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}`);
let socketUrl = `${HttpUnit.SocketHost}${record_id}`
this._socket.connect(socketUrl);
this._socket.onDataReceived((data: any) => {
let resData = JSON.parse(data.data)
if (GameManager.curStage != E_TalkStage.waitNpcTalk) return
if (resData.isFinished) {
console.log("npc回复:", resData)
GameManager.CurNpcTalkData = 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);
}
}
//region关卡配置
private static _levelCfgArray: I_LevelConfig[] = [];
private static _levelCfgMap: {[key: string]: I_LevelConfig} = {};
/**设置关卡配置数据 */
public static SetLevelCfg(levelCfg: any[]) {
GameManager._levelCfgArray = levelCfg;
let info:any = null;
let umRecords = [] //友盟解锁关卡记录
let recordLvs = HttpUnit.GetLevelRecord(); //友盟已记录的关卡
for (let i = 0; i < levelCfg.length; i++) {
info = levelCfg[i];
GameManager._levelCfgMap[info.id] = info;
//判断是否已记录
if (info.is_unlock) {
if (recordLvs.indexOf(info.id) == -1){
umRecords.push(info.id)
}
}
}
//友盟记录关卡
if (umRecords.length > 0 && SDKManager.umaSwt()){
let umr = umRecords.join(',')
HttpUnit.ins.sendLevelRecord({level_ids:umr}, (_data)=>{
console.log('友盟记录关卡',_data)
let userId = HttpUnit.GetID()
let curDate = Utils.GetNowFormatDay()
for (let i = 0; i < umRecords.length; i++) {
let lvId = umRecords[i]
let _cfg = GameManager._levelCfgMap[lvId]
SDKManager.umaEvent(SDKManager.Uma_Event_LvUnlock, {
lvId: lvId,
userId: userId,
time: curDate,
type: _cfg.unlock_type
})
}
})
}
}
/**设置关卡星级 */
public static SetLevelStar(levelId: string, star: number) {
let cfg = GameManager._levelCfgMap[levelId];
if (cfg) {
cfg.star = star;
}
}
/**获取关卡配置 */
public static getLevelCfg(levelId: string): I_LevelConfig {
return GameManager._levelCfgMap[levelId];
}
/**获取关卡配置列表 */
public static getLevelCfgList(): I_LevelConfig[] {
return GameManager._levelCfgArray;
}
/**获取npc表情图片 */
public static GetNpcEmoPic(emoStr: string): string {
let path = ""
let lvCfg = GameManager.getLevelCfg(GameManager.CurLevelId);
if (emoStr == "害羞") {
path = `emo_1/${lvCfg.characterShyPortrait}`
} else if (emoStr == "开心") {
path = `emo_2/${lvCfg.characterHappyPortrait}`
} else if (emoStr == "厌恶") {
path = `emo_3/${lvCfg.characterHatePortrait}`
} else {
path = `role/${lvCfg.characterFullLengthPortrait}` //默认
}
return path;
}
//regionAI语音开关
private static _AIVoiceSwt: boolean = false;
/**设置是否显示AI语音 */
public static set AIVoiceSwt(value: boolean) {
GameManager._AIVoiceSwt = value;
}
/**获取是否显示AI语音 */
public static get AIVoiceSwt(): boolean {
return GameManager._AIVoiceSwt;
}
//region当前关卡ID
private static _curLevelId: string = "";
/**设置当前关卡ID */
public static set CurLevelId(value: string) {
GameManager._curLevelId = value;
}
/**获取当前关卡ID */
public static get CurLevelId(): string {
return GameManager._curLevelId;
}
//region流程id
private static _recordId: string = "";
/**设置当前关卡流程ID */
public static set RecordId(value: string) {
GameManager._recordId = value;
}
/**获取当前关卡流程ID */
public static get RecordId(): string {
return GameManager._recordId;
}
//region当前步骤数据
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;
}
//region NPC回复数据
private static _curNpcTalkData: I_NpcTalkBack = null;
private static _npcTalkDataAry: I_NpcTalkBack[] = [];
/**设置当前NPC回复数据 */
public static set CurNpcTalkData(value: I_NpcTalkBack) {
GameManager._curNpcTalkData = value;
GameManager._npcTalkDataAry.push(value);
}
/**获取当前NPC回复数据 */
public static get CurNpcTalkData(): I_NpcTalkBack {
return GameManager._curNpcTalkData;
}
/**移除最后一条NPC回复数据 */
public static removeLastNpcTalkData() {
if (GameManager._npcTalkDataAry.length > 0) {
let talkData = GameManager._npcTalkDataAry.pop();
//心动次数也要减
if (talkData.judgement == 0) {
if (GameManager.xindongCishu > 0) {
GameManager.xindongCishu = GameManager.xindongCishu - 1
}
}
}
if (GameManager._npcTalkDataAry.length == 0) {
GameManager._curNpcTalkData = null;
} else {
GameManager._curNpcTalkData = GameManager._npcTalkDataAry[GameManager._npcTalkDataAry.length - 1];
}
}
//region 当前NPC话术文本
private static _curNpcFixedTalkText: string = "";
/**设置当前NPC话术文本 */
public static set CurNpcFixedTalkText(value: string) {
GameManager._curNpcFixedTalkText = value;
}
/**获取当前NPC话术文本 */
public static get CurNpcFixedTalkText(): string {
return GameManager._curNpcFixedTalkText;
}
//region关卡步骤评分
private static stepScoreList: number[] = [];
/**设置关卡步骤评分 */
public static AddStepScore(score: number) {
GameManager.stepScoreList.push(score);
}
/**移除最后一步骤评分 */
public static RemoveLastSetpScore() {
let cellLen = GameManager.stepScoreList.length;
if (cellLen > 0) {
GameManager.stepScoreList.pop();
}
}
/**清空关卡步骤评分 */
public static ClearStepScore() {
GameManager.stepScoreList = [];
}
/**获取最新得分 */
public static getCurStepScore(): number {
if (GameManager.stepScoreList.length == 0) return 0;
return GameManager.stepScoreList[GameManager.stepScoreList.length - 1];
}
/**获取关卡当前评分
* @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];
}
//region对话记录
private static talkRecordList: I_TalkRecordInfo[] = [];
/**添加对话记录 */
public static AddTalkRecord(record: I_TalkRecordInfo) {
GameManager.talkRecordList.push(record);
}
/**移除最后一条对话记录 */
public static RemoveLastRoundTalkRecord() {
let cellLen = GameManager.talkRecordList.length;
if (cellLen > 1) {
for (let i=cellLen-1; i>=0; i--) {
let talkCell = GameManager.talkRecordList.pop();
if (talkCell.isMe) {
break
}
}
}
}
/**清空对话记录 */
public static ClearTalkRecord() {
GameManager.talkRecordList = [];
}
/**获取对话记录 */
public static get TalkRecordList(): I_TalkRecordInfo[] {
return GameManager.talkRecordList;
}
//region 当前对话阶段
private static _curStage: E_TalkStage = E_TalkStage.prologue;
/**获取当前对话阶段 */
public static get curStage(): E_TalkStage {
return GameManager._curStage;
}
/**设置当前对话阶段 */
public static TurnToStage(value: E_TalkStage, force: boolean = false) {
if (GameManager._curStage == value && !force) return;
GameManager._curStage = value;
Utils.sendInnerMsg(InnerMsgCode.UI_TalkStageUp, {})
}
//region 已用对话轮次
private static _srouceCnt: number = 0;
/**获取已用对话轮次 */
public static get srouceCnt(): number {
return GameManager._srouceCnt;
}
/**设置已用对话轮次 */
public static set srouceCnt(value: number) {
GameManager._srouceCnt = value;
}
//region 心动次数
private static _xindongCishu: number = 0;
/**获取心动次数 */
public static get xindongCishu(): number {
return GameManager._xindongCishu;
}
/**设置心动次数 */
public static set xindongCishu(value: number) {
GameManager._xindongCishu = value;
}
//region npc固定话术喜欢次数
private static _npcFixTalkCountXihuan: number = 0;
/**获取npc固定话术喜欢次数 */
public static get npcFixTalkCountXihuan(): number {
return GameManager._npcFixTalkCountXihuan;
}
/**设置npc固定话术喜欢次数 */
public static set npcFixTalkCountXihuan(value: number) {
GameManager._npcFixTalkCountXihuan = value;
}
//region npc固定话术讨厌次数
private static _npcFixTalkCountTaoyan: number = 0;
/**获取npc固定话术讨厌次数 */
public static get npcFixTalkCountTaoyan(): number {
return GameManager._npcFixTalkCountTaoyan;
}
/**设置npc固定话术讨厌次数 */
public static set npcFixTalkCountTaoyan(value: number) {
GameManager._npcFixTalkCountTaoyan = value;
}
//region 结束关卡
/**结束关卡 */
public static EndGame() {
GameManager.I.disconnectSocket();
GameManager.ClearStepScore()
GameManager.ClearTalkRecord()
GameManager.CurLevelId = ""
GameManager.RecordId = ""
GameManager.CurLevelData = null
GameManager.CurNpcTalkData = null
GameManager._npcTalkDataAry = []
GameManager.srouceCnt = 0
GameManager.xindongCishu = 0
GameManager.npcFixTalkCountXihuan = 0
GameManager.npcFixTalkCountTaoyan = 0
GameManager._curStage = E_TalkStage.prologue
}
//region 重新开始关卡
/**重新开始关卡 */
public static RestartGame() {
if (GameManager.CurLevelId == "") {
return
}
GameManager._restartGameStep1()
}
//重开步骤1 刷新用户数据
private static _restartGameStep1() {
HttpUnit.ins.getUserData((userData) => {
GameManager._restartGameStep2()
})
}
//重开步骤2 刷新关卡数据
private static _restartGameStep2() {
HttpUnit.ins.getLevelList((levelList) => {
if (levelList) {
GameManager.SetLevelCfg(levelList)
GameManager._restartGameStep3()
}
})
}
//重开步骤3 判断条件
private static _restartGameStep3() {
if (HttpUnit.GetXiangqinTickets() <= 0) {
SubManager.ShowPrompt("今日相亲次数已用完");
return;
}
let level_id = GameManager.CurLevelId
HttpUnit.ins.levelStart({level_id:level_id}, (data) => {
GameManager.EndGame()
GameManager.CurLevelId = level_id
GameManager.CurLevelData = data.level
GameManager.RecordId = data.record_id
GameManager.I.connetSorcket(data.record_id) //连接socket
Utils.sendInnerMsg(InnerMsgCode.UI_ResartGame, {})
})
}
//region 可领取的私家珍藏列表
private static _zhencangCanget: any[] = []
/**可领取的私家珍藏列表 */
static get zhencangCanget() {
return this._zhencangCanget
}
/**刷新可领取的私家珍藏列表 */
static refreshZhencangCanget() {
HttpUnit.ins.getZhencangList({limit:10, page:1, type:0}, (data) => {
if (data) {
this._zhencangCanget = data.data || []
Utils.sendInnerMsg(InnerMsgCode.Data_ZhencangUp, {})
}
})
}
}
@@ -0,0 +1,282 @@
import { _decorator, isValid, Node, Sprite, Toggle, tween, UIOpacity, UITransform, Vec3, view } 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 { tj_huiyi } from './tj_huiyi';
import GameRootUI from '../../Main/Common/GameRootUI';
import { tj_zhencang } from './tj_zhencang';
import { tj_jilu } from './tj_jilu';
import HttpUnit from '../../Main/Common/HttpUnit';
const { ccclass, property } = _decorator;
/**宠物主界面页签类型 */
export enum TujianPageType {
None, //未知
huiyi, //心动回忆
zhencang, //私房珍藏
jilu, //相遇记录
}
//心动回忆界面
@ccclass('Tujian_UI')
export class Tujian_UI extends li_BaseView {
private _nodeTab: any = {};
private _data;
private _pageType: TujianPageType = TujianPageType.huiyi;
private tgHuiyi: Toggle = null!;//回忆
private tgZhencang: Toggle = null!;//珍藏
private tgJilu: Toggle = null!;//记录
private _btmHuiyi?: tj_huiyi;
private _btmZhencang?: tj_zhencang;
private _btmJilu?: tj_jilu;
/**缩放图片信息 */
private bigPicInfo = {
hyItem: null, //回忆item
npcPic: null, //npc图片
origScale: Vec3.ZERO, //原始缩放
}
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
Utils.parseNode(this.node, this._nodeTab)
this.tgHuiyi = this._nodeTab.tjPage1.getComponent(Toggle)
this.tgZhencang = this._nodeTab.tjPage2.getComponent(Toggle)
this.tgJilu = this._nodeTab.tjPage3.getComponent(Toggle)
}
openUIDataCT(data: any): void {
this._data = data
}
registerListenner() {
Utils.addInnerEL(InnerMsgCode.UI_Tj_huiyi_Pic, this, this.resiveHuiyiPic)
Utils.addInnerEL(InnerMsgCode.UI_Tj_huiyi_Lv, this, this.resiveHuiyiLv)
Utils.addInnerEL(InnerMsgCode.Data_Redpoint, this, this.resiveZhencangRedpoint)
}
start() {
GButton.BandClick(this._nodeTab.mask, ()=>{
this.onClose();
}, this, 0, null, null, false);
GButton.BandClick(this._nodeTab.btnBack, ()=>{
this.onClose();
}, this);
GButton.RemoveAndBandClick(this._nodeTab.tjPage1,()=>{
this.changePageType(TujianPageType.huiyi);
},this)
GButton.RemoveAndBandClick(this._nodeTab.tjPage2,()=>{
this.changePageType(TujianPageType.zhencang);
},this)
GButton.RemoveAndBandClick(this._nodeTab.tjPage3,()=>{
this.changePageType(TujianPageType.jilu);
},this)
//回忆
GButton.BandClick(this._nodeTab.btnBPBack, ()=>{
this.doHideBigPic();
}, this);
this._nodeTab.BigPicUI.active = false;
this.changePageType(TujianPageType.huiyi, true);
this.refreshRedpointHuiyi();
this.refreshRedpointZhencang();
this.refreshRedpointJilu();
}
update(deltaTime: number) {
}
/**回忆显示大图 */
resiveHuiyiPic(data: any) {
this.doShowBigPic(data);
}
/**前往回忆对应关卡 */
resiveHuiyiLv(data: any) {
this.onClose();
}
resiveZhencangRedpoint(data: any) {
this.refreshRedpointHuiyi();
this.refreshRedpointZhencang();
this.refreshRedpointJilu();
}
//region 切换页面
changePageType(type: TujianPageType, isFroce: boolean = false) {
if (this._pageType == type && !isFroce) {
return
}
//页签改变了,先隐藏所有节点
if (this._pageType != type) {
if(this._btmHuiyi) this._btmHuiyi.node.active = false;
if(this._btmZhencang) this._btmZhencang.node.active = false;
if(this._btmJilu) this._btmJilu.node.active = false;
}
this._pageType = type;
if (type == TujianPageType.huiyi) {//回忆
this.tgHuiyi.isChecked = true;
if (this._btmHuiyi) {
this._btmHuiyi.node.active = true;
} else {
ResManager.I.loadSubpackagePrefab("UI/StartUI/TJ_Huiyi", (res:Node)=>{
if (isValid(this._nodeTab.MidNode)) {
this._nodeTab.MidNode.addChild(res)
this._btmHuiyi = res.getComponent(tj_huiyi)
if (this._pageType == TujianPageType.huiyi) {
this._btmHuiyi.node.active = true;
} else {
this._btmHuiyi.node.active = false;
}
}
})
}
} else if (type == TujianPageType.zhencang) { //珍藏
this.tgZhencang.isChecked = true;
if (this._btmZhencang) {
this._btmZhencang.node.active = true;
} else {
ResManager.I.loadSubpackagePrefab("UI/StartUI/TJ_Zhencang", (res:Node)=>{
if (isValid(this._nodeTab.MidNode)) {
this._nodeTab.MidNode.addChild(res)
this._btmZhencang = res.getComponent(tj_zhencang)
if (this._pageType == TujianPageType.zhencang) {
this._btmZhencang.node.active = true;
} else {
this._btmZhencang.node.active = false;
}
}
})
}
} else if (type == TujianPageType.jilu) { //记录
this.tgJilu.isChecked = true;
if (this._btmJilu) {
this._btmJilu.node.active = true;
} else {
ResManager.I.loadSubpackagePrefab("UI/StartUI/TJ_Jilu", (res:Node)=>{
if (isValid(this._nodeTab.MidNode)) {
this._nodeTab.MidNode.addChild(res)
this._btmJilu = res.getComponent(tj_jilu)
if (this._pageType == TujianPageType.jilu) {
this._btmJilu.node.active = true;
} else {
this._btmJilu.node.active = false;
}
}
})
}
}
}
/**显示大图 */
doShowBigPic(data:any) {
if (!data.hyItem) {
return
}
let npcPic:Node = data.hyItem.npcPic;
this.bigPicInfo.hyItem = data.hyItem;
this.bigPicInfo.npcPic = npcPic;
this.bigPicInfo.origScale = npcPic.scale.clone();
let wpos = new Vec3(0,0,0);
npcPic.getWorldPosition(wpos);
let BigPicRoot:Node = this._nodeTab.BigPicRoot;
let npos = BigPicRoot.getComponent(UITransform).convertToNodeSpaceAR(wpos);
npcPic.setParent(BigPicRoot);
npcPic.setPosition(npos);
let ttime = 0.3;
GameRootUI.DisableOper(ttime+0.1)
//放大图片
let s = 1
let windowSize = view.getVisibleSize(); // 获取窗口大小
let picTf:UITransform = npcPic.getComponent(UITransform);
if (picTf.height < windowSize.height) {
s = windowSize.height / picTf.height;
}
tween((npcPic))
.to(ttime, { scale: new Vec3(s, s, s), position: new Vec3(0, 0, 0) }, { easing: 'quadOut' })
.start();
//显示UI
this._nodeTab.BigPicUI.active = true;
Utils.setString(this._nodeTab.labBPTalk, data.talk);
let bigPicUIOpa:UIOpacity = this._nodeTab.BigPicUI.getComponent(UIOpacity)
bigPicUIOpa.opacity = 0;
tween(bigPicUIOpa)
.delay(ttime*0.7)
.to(ttime*0.3, { opacity: 255 }, { easing: 'quadOut' })
.start();
}
/**隐藏大图 */
doHideBigPic() {
if (!this.bigPicInfo.hyItem) return;
let npcPic = this.bigPicInfo.npcPic
let wpos = new Vec3(0,0,0);
this.bigPicInfo.hyItem.picRoot.getWorldPosition(wpos);
let npos = this._nodeTab.BigPicRoot.getComponent(UITransform).convertToNodeSpaceAR(wpos);
// npcPic.setParent(this.bigPicInfo.hyItem.picRoot);
// npcPic.setPosition(npos);
let ttime = 0.3;
GameRootUI.DisableOper(ttime+0.1)
tween((npcPic))
.to(ttime, { scale: this.bigPicInfo.origScale, position: npos }, { easing: 'quadOut' })
.call(() => {
npcPic.setParent(this.bigPicInfo.hyItem.picRoot);
npcPic.setPosition(new Vec3(0,0,0));
this.bigPicInfo.hyItem = null;
this.bigPicInfo.npcPic = null;
})
.start();
let bigPicUIOpa:UIOpacity = this._nodeTab.BigPicUI.getComponent(UIOpacity)
tween(bigPicUIOpa)
.to(ttime*0.3, { opacity: 0 }, { easing: 'quadOut' })
.call(() => {
this._nodeTab.BigPicUI.active = false;
})
.start();
}
// 刷新红点 回忆
refreshRedpointHuiyi() {
let isshow = HttpUnit.IsHaveHuiyiRedpoint()
this._nodeTab.rp_1.active = isshow;
}
// 刷新红点 珍藏
refreshRedpointZhencang() {
let isshow = HttpUnit.IsHaveZhencangRedpoint()
this._nodeTab.rp_2.active = isshow;
}
// 刷新红点 记录
refreshRedpointJilu() {
let isshow = false
this._nodeTab.rp_3.active = isshow;
}
}