This commit is contained in:
2025-07-17 17:18:21 +08:00
commit 1ffc1b5cf0
5309 changed files with 1150310 additions and 0 deletions
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0de067a9-405c-4873-9739-33ab47d6a809",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0de067a9-405c-4873-9739-33ab47d6a809@6c48a",
"displayName": "munuonuo_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0de067a9-405c-4873-9739-33ab47d6a809",
"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": "0de067a9-405c-4873-9739-33ab47d6a809@f9941",
"displayName": "munuonuo_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -14,
"offsetY": -2.5,
"trimX": 85,
"trimY": 5,
"width": 727,
"height": 1184,
"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": [
-363.5,
-592,
0,
363.5,
-592,
0,
-363.5,
592,
0,
363.5,
592,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
85,
1184,
812,
1184,
85,
0,
812,
0
],
"nuv": [
0.0918918918918919,
0,
0.8778378378378379,
0,
0.0918918918918919,
0.9957947855340622,
0.8778378378378379,
0.9957947855340622
],
"minPos": [
-363.5,
-592,
0
],
"maxPos": [
363.5,
592,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "0de067a9-405c-4873-9739-33ab47d6a809@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "0de067a9-405c-4873-9739-33ab47d6a809@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "7c55e9cf-4257-4509-aab7-705379a6a314",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "7c55e9cf-4257-4509-aab7-705379a6a314@6c48a",
"displayName": "kukla_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "7c55e9cf-4257-4509-aab7-705379a6a314",
"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": "7c55e9cf-4257-4509-aab7-705379a6a314@f9941",
"displayName": "kukla_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 19.5,
"offsetY": -24,
"trimX": 39,
"trimY": 48,
"width": 761,
"height": 981,
"rawWidth": 800,
"rawHeight": 1029,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-380.5,
-490.5,
0,
380.5,
-490.5,
0,
-380.5,
490.5,
0,
380.5,
490.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
39,
981,
800,
981,
39,
0,
800,
0
],
"nuv": [
0.04875,
0,
1,
0,
0.04875,
0.9533527696793003,
1,
0.9533527696793003
],
"minPos": [
-380.5,
-490.5,
0
],
"maxPos": [
380.5,
490.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "7c55e9cf-4257-4509-aab7-705379a6a314@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "7c55e9cf-4257-4509-aab7-705379a6a314@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "8cb1966e-a484-4ccd-ad4d-fa99d00f1863",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "8cb1966e-a484-4ccd-ad4d-fa99d00f1863@6c48a",
"displayName": "lingyun_0_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "8cb1966e-a484-4ccd-ad4d-fa99d00f1863",
"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": "8cb1966e-a484-4ccd-ad4d-fa99d00f1863@f9941",
"displayName": "lingyun_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": "8cb1966e-a484-4ccd-ad4d-fa99d00f1863@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "8cb1966e-a484-4ccd-ad4d-fa99d00f1863@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "8ee9bfd1-62cf-4fbe-9482-9c0c3e1540a8",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "8ee9bfd1-62cf-4fbe-9482-9c0c3e1540a8@6c48a",
"displayName": "zeiterin_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "8ee9bfd1-62cf-4fbe-9482-9c0c3e1540a8",
"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": "8ee9bfd1-62cf-4fbe-9482-9c0c3e1540a8@f9941",
"displayName": "zeiterin_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -17,
"offsetY": -2,
"trimX": 4,
"trimY": 4,
"width": 883,
"height": 1185,
"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": [
-441.5,
-592.5,
0,
441.5,
-592.5,
0,
-441.5,
592.5,
0,
441.5,
592.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
4,
1185,
887,
1185,
4,
0,
887,
0
],
"nuv": [
0.004324324324324324,
0,
0.9589189189189189,
0,
0.004324324324324324,
0.9966358284272497,
0.9589189189189189,
0.9966358284272497
],
"minPos": [
-441.5,
-592.5,
0
],
"maxPos": [
441.5,
592.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "8ee9bfd1-62cf-4fbe-9482-9c0c3e1540a8@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "8ee9bfd1-62cf-4fbe-9482-9c0c3e1540a8@6c48a"
}
}
@@ -0,0 +1,302 @@
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';
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.btnSetting, this.onSettingClick, this);
GButton.BandClick(this._nodeTab.btnBDSidebar, this.onBDSidebarClick, this);
AudioManager.I.PlayMusic(1, true) //背景乐
GameRootUI.InitDisableOperUI(false)
GameRootUI.InitCrossUI(false)
this.setUIVisible(true)
//设置按钮
if (GlobalValue.GMSwtitch) {
this._nodeTab.btnSetting.active = true
} else {
this._nodeTab.btnSetting.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()
}
}
update(deltaTime: number) {
}
//GM界面关闭消息
resiveGMClose(data) {
Utils.Log("收到GM界面关闭消息")
}
//退出聊天消息
resiveTalkBack(data) {
Utils.Log("收到退出聊天消息")
this.setUIVisible(true)
this.refreshLevelList()
}
//抖音侧边栏消息
resiveBDSidebar(data) {
this.refreshBdSidebarUI()
}
//显示主界面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()
}
//刷新关卡列表
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
}
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);
}
//第一个是占位用的
if (idx == 0) {
node.l_rotateN.active = false
return
}
node.l_rotateN.active = true
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.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]
//名字
Utils.setString(this._nodeTab.labNpcName, data.characterName)
//介绍
Utils.setString(this._nodeTab.labNpcTalk, data.description)
let bgPath = data.bgImage
let rolePath = data.characterFullLengthPortrait
Utils.sendInnerMsg(InnerMsgCode.SceneLayerBgUp, {bgPath:bgPath, rolePath:rolePath})
}
//开始游戏
onStartClick() {
Utils.Log("点击开始游戏");
if (this.curLevelIdx == 0) {
console.error("当前关卡为0,此关卡是占位用的")
return
}
let data = this.levelData[this.curLevelIdx]
//未解锁
if (data.is_unlock != true) {
SubManager.ShowPrompt("关卡未解锁")
return
}
// if (HttpUnit.GetTalkTickets() <= 0) {
// SubManager.ShowPrompt("今日对话次数已用完");
// return;
// }
let level_id = data.id
GameManager.CurLevelId = level_id
GameManager.ClearStepScore()
GameManager.ClearTalkRecord()
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")
})
}
//设置
onSettingClick() {
ViewManager.I.openBundlesView("UI/StartUI/Setting_UI")
}
//点击抖音侧边栏按钮
onBDSidebarClick() {
if (!SDKManager.isByteDance()) {
//不是抖音平台
return
}
ViewManager.I.openBundlesView("UI/StartUI/BDSidebar_UI")
}
}
@@ -0,0 +1,11 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "a470f82d-ad6a-47cb-8ff8-d4178fc894ec",
"files": [],
"subMetas": {},
"userData": {
"isBundle": true
}
}
@@ -0,0 +1,527 @@
import { _decorator, sys } from "cc";
import { SDKManager } from "../Channel/SDKManager";
import GlobalValue from "./GlobalValue";
import { I_UserInfo } from "../Config/CommonConfig";
import SubManager from "../../Sub/SubManager";
const { ccclass, property } = _decorator;
/**
* http通讯
*/
@ccclass
export default class HttpUnit {
// static readonly ServerHttpHost = "https://bls.vip.hnhxzkj.com/";
static readonly ServerHttpHost = "https://xqmnyx.vip.hnhxzkj.com/api/";
static PlayerToken = ""; //登录时获取的token
static LoginState = 0; //登录状态 0未登录 1登录中 2已登录
static UserInfo:I_UserInfo = null; //用户数据
//后台设置
//ad_chat_times:看广告加聊天次数 register_chat_times:注册赠送聊天次数
//reset_day_ad:每日重置看广告次数 reset_day_share:每日重置分享次数 share_chat_times:分享可加聊天次数
//ad_tickets_times:看广告可加相亲次数 share_tickets_times:分享可加相亲次数
static SerSetting:any = {};
//单例
private static I: HttpUnit;
public static get ins(): HttpUnit {
if (this.I == null) {
this.I = new HttpUnit();
}
return this.I;
}
public constructor() {
}
public jsonToQueryString(json: any) {
var str = '';
if (typeof json == "object") {
str = "?";
for (var k in json) {
if (str != "?") {
str += "&";
}
str += k + "=" + json[k];
}
}
return str;
}
private objectToFormData(obj: Object): FormData {
const formData = new FormData();
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const value = obj[key];
if (Array.isArray(value)) {
for (const item of value) {
formData.append(key, item);
}
} else {
formData.append(key, value);
}
}
}
return formData;
}
private async quest(xhr: XMLHttpRequest, method: "GET" | "POST" | "PUT" = "GET", data: Object, formData: boolean = false) {
return new Promise((resolve, reason) => {
xhr.onreadystatechange = () => {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
// console.log("[Http] 返回", xhr.response);
resolve(JSON.parse(xhr.response));
} else {
reason(xhr.status)
}
}
};
xhr.onerror = (error) => {
console.error("http request onerror");
SubManager.ShowPrompt("网络错误,请检查网络连接");
reason(error)
};
xhr.ontimeout = (e) => {
console.error("http request timeout");
SubManager.ShowPrompt("网络错误,请检查网络连接");
reason(e)
}
//根据POST和GET方式,选择是否发送msg数据
if (formData) {
xhr.send(this.objectToFormData(data));
} else {
if (method == 'POST') {
xhr.send(JSON.stringify(data));
} else if (method == 'PUT') {
xhr.send(JSON.stringify(data));
} else {
xhr.send();
}
}
});
}
/**是否已登录成功 */
public static IsLogin(): boolean {
return HttpUnit.LoginState == 2;
}
/**获取心动最大次数 */
public static GetXindongMaxCount() {
return 5;
}
/**获取最大相亲次数 */
public static GetXiangqinMaxTickets() {
//每天重置相亲次数
let num1 = HttpUnit.SerSetting.reset_game_day_match ? HttpUnit.SerSetting.reset_game_day_match.value : 5;
num1 = parseInt(num1) || 0;
//看广告加的相亲次数
let num2 = HttpUnit.SerSetting.ad_tickets_times ? HttpUnit.SerSetting.ad_tickets_times.value : 3;
num2 = parseInt(num2) || 0;
//分享加的相亲次数
let num3 = HttpUnit.SerSetting.share_tickets_times ? HttpUnit.SerSetting.share_tickets_times.value : 3;
num3 = parseInt(num3) || 0;
return num1 + num2 + num3;
}
/**获取可相亲次数 */
public static GetXiangqinTickets() {
if (!HttpUnit.UserInfo) {
return 0
}
let num = HttpUnit.UserInfo.ticket || 0;
return num;
}
/**获取可分享次数 - 相亲次数 */
public static GetXiangqinShareNum() {
//测试代码
if (GlobalValue.GMSwtitch) {
return 10
}
if (!HttpUnit.UserInfo) {
return 0
}
let num = HttpUnit.UserInfo.game_share_num || 0;
return num;
}
/**获取可看广告次数 - 相亲次数 */
public static GetXiangqinAdNum() {
//测试代码
if (GlobalValue.GMSwtitch) {
return 10
}
if (!HttpUnit.UserInfo) {
return 0
}
let num = HttpUnit.UserInfo.game_ad_num || 0;
return num;
}
/**获取可分享次数 - 聊天次数 */
public static GetTalkShareNum() {
//测试代码
if (GlobalValue.GMSwtitch) {
return 10
}
if (!HttpUnit.UserInfo) {
return 0
}
let num = HttpUnit.UserInfo.level_share_num || 0;
return num;
}
/**获取可看广告次数 - 聊天次数 */
public static GetTalkAdNum() {
//测试代码
if (GlobalValue.GMSwtitch) {
return 10
}
if (!HttpUnit.UserInfo) {
return 0
}
let num = HttpUnit.UserInfo.level_ad_num || 0;
return num;
}
/**获取看广告增加的聊天次数 */
public static GetTalkAdAddNum() {
let num = HttpUnit.SerSetting.ad_chat_times ? HttpUnit.SerSetting.ad_chat_times.value : 0;
num = parseInt(num) || 0;
return num;
}
/**获取分享增加的聊天次数 */
public static GetTalkShareAddNum() {
let num = HttpUnit.SerSetting.share_chat_times ? HttpUnit.SerSetting.share_chat_times.value : 0;
num = parseInt(num) || 0;
return num;
}
/**获取看广告增加的相亲次数 */
public static GetXiangqinAdAddNum() {
let num = HttpUnit.SerSetting.ad_tickets_times ? HttpUnit.SerSetting.ad_tickets_times.value : 0;
num = parseInt(num) || 0;
return num;
}
/**获取分享增加的相亲次数 */
public static GetXiangqinShareAddNum() {
let num = HttpUnit.SerSetting.share_tickets_times ? HttpUnit.SerSetting.share_tickets_times.value : 0;
num = parseInt(num) || 0;
return num;
}
/**获取昵称 */
public static GetNickName() {
if (!HttpUnit.UserInfo) {
return "游客"
}
let num = HttpUnit.UserInfo.nickname || "游客";
return num;
}
/**获取ID */
public static GetID() {
if (!HttpUnit.UserInfo) {
return 0
}
let num = HttpUnit.UserInfo.id || 0;
return num;
}
//region 登录
private loginCB: Function = null;
public login(cb: Function = null) {
this.loginCB = cb;
SDKManager.login((_loginData) => {
console.log("SDK登录成功", _loginData)
SDKManager.getUserInfo((userInfo) => {
console.log("SDK获取用户信息成功", userInfo)
// let serparam = {
// platform: _loginData.platform,
// code: _loginData.code,
// user_info: {nickName:userInfo.nickName, avatarUrl:userInfo.avatarUrl}
// }
_loginData.nickname = userInfo.nickName;
_loginData.avatar = userInfo.avatarUrl;
if (GlobalValue.IsTest) {
console.log("登录测试环境")
this.loginSer({platform:0, code:12345}, this.initData.bind(this))
} else {
if (_loginData.code == null) {
// let uuid = sys.localStorage.getItem('uuid');
// if (!uuid) {
// uuid = Date.now(); //当前时间戳
// sys.localStorage.setItem('uuid', uuid);
// }
// _loginData.code = uuid;
_loginData.platform = 0
_loginData.code = 123451
}
console.log("登录正式环境 loginData.code: ", _loginData)
this.loginSer(_loginData, this.initData.bind(this))
}
})
})
}
private initData(playerData) {
playerData = playerData || {};
this.loginCB && this.loginCB(playerData);
}
//登录服务器
private async loginSer(msg, cb: Function = null) {
let data: any = await HttpUnit.ins.api("login", msg, "POST", true);
console.log("login:", msg, data)
if (data && data.code == 1) {
HttpUnit.PlayerToken = data.data.token
HttpUnit.LoginState = 2
console.log("HttpUnit.PlayerToken:", HttpUnit.PlayerToken)
//获取玩家信息
// this.getUserInfo(cb);
HttpUnit.UserInfo = data.data.user_info;
//获取配置信息
this.getCommSetting();
cb && cb(data.data.user_info);
}else{
console.log("登陆失败:"+ data);
cb && cb(null);
}
}
//获取关卡列表数据
public async getLevelList(cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/levels", {}, "POST", true);
console.log("关卡数据:", data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("获取关卡数据失败:"+ data);
cb && cb(null);
}
}
/**开始关卡*/
public async levelStart(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/start", msg, "POST", true);
console.log("开始新关卡:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("开始关卡失败:"+ data);
cb && cb(null);
}
}
/**推进关卡*/
public async sendUserTalk(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/propel", msg, "POST", true);
console.log("推进关卡:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("推进关卡失败:"+ data);
cb && cb(null);
}
}
/**结束关卡*/
public async sendLevelFinish(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/end", msg, "POST", true);
console.log("结束关卡:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("结束关卡失败:"+ data);
cb && cb(null);
}
}
/**增加次数,更新关卡*/
public async addTalkCnt(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/update", msg, "POST", true);
console.log("更新关卡:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("更新关卡失败:"+ data);
cb && cb(null);
}
}
/**获取AI语音*/
public async getAIVoice(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/voice", msg, "POST", true);
console.log("获取AI语音:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("获取AI语音失败:"+ data);
cb && cb(null);
}
}
/**获取当前聊天状态*/
public async getTalkStage(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/status", msg, "POST", true);
console.log("获取当前聊天状态:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("获取当前聊天状态失败:"+ data);
cb && cb(null);
}
}
//非三星通关时继续关卡
public async sendGameContinue(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("game/continue", msg, "POST", true);
console.log("非三星通关时继续关卡:", data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("非三星通关时继续关卡失败:"+ data);
cb && cb(null);
}
}
//重新获取用户信息
public async getUserData(cb: Function = null) {
let data: any = await HttpUnit.ins.api("user/info", {}, "GET", true);
console.log("重新获取用户信息数据:", data)
if (data && data.code == 1) {
HttpUnit.UserInfo = data.data;
cb && cb(data.data);
}else{
console.log("重新获取用户信息数据失败:"+ data);
cb && cb(null);
}
}
//用户看广告
public async setUserAd(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("user/ad", msg, "POST", true);
console.log("看广告数据:", data)
if (data && data.code == 1) {
HttpUnit.UserInfo = data.data;
cb && cb(data.data);
}else{
console.log("看广告数据失败:"+ data);
cb && cb(null);
}
}
//用户分享
public async setUserShare(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("user/share", msg, "POST", true);
console.log("用户分享数据:", data)
if (data && data.code == 1) {
HttpUnit.UserInfo = data.data;
cb && cb(data.data);
}else{
console.log("用户分享数据失败:"+ data);
cb && cb(null);
}
}
//获取常用配置
public async getCommSetting(cb: Function = null) {
let data: any = await HttpUnit.ins.api("user/setting", {}, "GET", true);
console.log("获取常用配置数据:", data)
if (data && data.code == 1) {
HttpUnit.SerSetting = {};
for (let i = 0; i < data.data.length; i++) {
let item = data.data[i];
HttpUnit.SerSetting[item.key] = item;
}
cb && cb();
}else{
console.log("获取常用配置数据失败:"+ data);
cb && cb(null);
}
}
//看广告解锁关卡
public async levelUnlock(msg:any, cb: Function = null) {
let data: any = await HttpUnit.ins.api("user/unlock_level", msg, "POST", true);
console.log("看广告解锁关卡:", msg, data)
if (data && data.code == 1) {
cb && cb(data.data);
}else{
console.log("看广告解锁关卡失败:"+ data);
cb && cb(null);
}
}
public async api(path: string, data: any, method: "GET" | "POST" | "PUT" = "GET", bLock: boolean = false, isFormData: boolean = false) {
let url = HttpUnit.ServerHttpHost + path;
// console.log("[Http] 请求Url:",url, " 方式:", method, " Authorization:", GlobalValue.PlayerToken, " 数据:", JSON.stringify(data) );
bLock && this.lock();
var xhr = new XMLHttpRequest();
xhr.timeout = 10000;
// xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// if (cc.sys.isNative) {
// xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// }
// xhr.setRequestHeader('authorization', Config.TOKEN);
//发送数据
if (method == 'GET') {
url = url + encodeURI(this.jsonToQueryString(data));
xhr.open(method, url, true);
if (sys.isNative) {
xhr.setRequestHeader("Accept-Encoding", "gzip,deflate");
xhr.setRequestHeader("content-type", "text/html;charset=utf-8");
}
} else {
xhr.open(method, url, true);
xhr.setRequestHeader("Content-type", "application/json");
}
xhr.setRequestHeader('Authorization', "Bearer " + HttpUnit.PlayerToken);
let self = this;
return new Promise((resolve, reason) => {
self.quest(xhr, method, data, isFormData).then(value => {
bLock && self.unlock();
resolve(value);
}).catch(err => {
bLock && self.unlock();
resolve(null);
});
});
}
/**
* 发送请求
* @param url 接口地址
* @param data 消息字符串 (json格式)
* @param method 请求方式
* @param bLock 是否锁定屏幕
* @param formData 是否formData
* @returns
*/
public async send(url: string, data: any, method: "GET" | "POST" | "PUT" = "GET", bLock: boolean = false, formData: boolean = false) {
// console.log("[Http] 请求Url:",url, " 方式:", method, " 数据:", data);
bLock && this.lock();
var xhr = new XMLHttpRequest();
xhr.timeout = 10000;
if (method == 'GET') {
url = url + encodeURI(this.jsonToQueryString(data));
xhr.open(method, url, true);
if (sys.isNative) {
xhr.setRequestHeader("Accept-Encoding", "gzip,deflate");
xhr.setRequestHeader("content-type", "text/html;charset=utf-8");
}
} else {
xhr.open(method, url, true);
xhr.setRequestHeader("Content-type", "application/json");
}
let self = this;
return new Promise((resolve, reason) => {
self.quest(xhr, method, data, formData).then(value => {
bLock && self.unlock();
resolve(value);
}).catch(err => {
bLock && self.unlock();
resolve(null);
});
});
}
/**解锁屏幕 */
private unlock() {
// LockScreenUI.ins.unShowloading();
// Config.loading.hide2();
}
/**锁屏 */
private lock() {
// Config.loading.show2();
// LockScreenUI.ins.Showloading('网络加载中请稍后...');
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "9305843b-6fae-4ec7-90ba-dc91d584fc8d",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "9305843b-6fae-4ec7-90ba-dc91d584fc8d@6c48a",
"displayName": "xinfu_stage_bg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "9305843b-6fae-4ec7-90ba-dc91d584fc8d",
"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": "9305843b-6fae-4ec7-90ba-dc91d584fc8d@f9941",
"displayName": "xinfu_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": "9305843b-6fae-4ec7-90ba-dc91d584fc8d@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "9305843b-6fae-4ec7-90ba-dc91d584fc8d@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "7c23b9b9-81ab-406f-9f4b-8178a441f43d",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "7c23b9b9-81ab-406f-9f4b-8178a441f43d@6c48a",
"displayName": "gisela_laugh",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "7c23b9b9-81ab-406f-9f4b-8178a441f43d",
"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": "7c23b9b9-81ab-406f-9f4b-8178a441f43d@f9941",
"displayName": "gisela_laugh",
"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": "7c23b9b9-81ab-406f-9f4b-8178a441f43d@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "7c23b9b9-81ab-406f-9f4b-8178a441f43d@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "32abe364-27a4-4db6-83f3-30b04197b3a5",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "32abe364-27a4-4db6-83f3-30b04197b3a5@6c48a",
"displayName": "blackmoon_nightgod_0_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "32abe364-27a4-4db6-83f3-30b04197b3a5",
"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": "32abe364-27a4-4db6-83f3-30b04197b3a5@f9941",
"displayName": "blackmoon_nightgod_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": "32abe364-27a4-4db6-83f3-30b04197b3a5@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "32abe364-27a4-4db6-83f3-30b04197b3a5@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 796 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "b7bd13c9-46a9-487a-bf87-3053dd2dbd46",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "b7bd13c9-46a9-487a-bf87-3053dd2dbd46@6c48a",
"displayName": "greta_2_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "b7bd13c9-46a9-487a-bf87-3053dd2dbd46",
"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": "b7bd13c9-46a9-487a-bf87-3053dd2dbd46@f9941",
"displayName": "greta_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": "b7bd13c9-46a9-487a-bf87-3053dd2dbd46@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "b7bd13c9-46a9-487a-bf87-3053dd2dbd46@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB