init
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "e277acb1-7003-49b2-8420-2b5051281ce3",
|
||||
"files": [
|
||||
".jpg",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "e277acb1-7003-49b2-8420-2b5051281ce3@6c48a",
|
||||
"displayName": "kukla_0_cg",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "e277acb1-7003-49b2-8420-2b5051281ce3",
|
||||
"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": "e277acb1-7003-49b2-8420-2b5051281ce3@f9941",
|
||||
"displayName": "kukla_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": "e277acb1-7003-49b2-8420-2b5051281ce3@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": false,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "e277acb1-7003-49b2-8420-2b5051281ce3@6c48a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,456 @@
|
||||
import { _decorator, AssetManager, assetManager, Component, Node, director, Prefab, resources, Sprite, SpriteFrame, Texture2D, v2, SpriteAtlas, ImageAsset, instantiate, AudioClip, Asset, JsonAsset, Material } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ResManager')
|
||||
export default class ResManager {
|
||||
private static _I: ResManager = null;
|
||||
public static get I(): ResManager {
|
||||
if (!ResManager._I) {
|
||||
ResManager._I = new ResManager();
|
||||
}
|
||||
return ResManager._I;
|
||||
}
|
||||
|
||||
|
||||
/**切换场景 */
|
||||
enterScene(i_sceneName: string) {
|
||||
director.loadScene(i_sceneName, () => { });
|
||||
}
|
||||
|
||||
|
||||
/** 场景-跳转到主界面场景*/
|
||||
goMainScene() {
|
||||
this.enterScene('MainScene');
|
||||
}
|
||||
|
||||
/** 场景-跳转到游戏场景*/
|
||||
goGameScene() {
|
||||
this.enterScene('GameScene');
|
||||
}
|
||||
|
||||
/** 场景-跳转到自定义场景*/
|
||||
goCustomScene(sceneName:string) {
|
||||
this.enterScene(sceneName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// /**加载bundle */
|
||||
// loadBundle(bundleName, cb?) {
|
||||
// let bundle = assetManager.getBundle(bundleName)
|
||||
// if (bundle) { cb && cb(bundle); return; }
|
||||
// assetManager.loadBundle(bundleName, (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
// if (!err) {
|
||||
// cb && cb(_bundle);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
/**移除bundle */
|
||||
removeBundle(bundleName) {
|
||||
let bundle = assetManager.getBundle(bundleName);
|
||||
if (bundle) {
|
||||
bundle.releaseAll();
|
||||
assetManager.removeBundle(bundle);
|
||||
}
|
||||
}
|
||||
/**预加载bundle中的PB*/
|
||||
preLoadSubpackagePrefab(url: string, cb) {
|
||||
let bundle = assetManager.getBundle("PB");
|
||||
if (bundle){
|
||||
bundle.preload(url, Prefab, (err, res) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
cb && cb();
|
||||
});
|
||||
} else {
|
||||
assetManager.loadBundle("PB", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.preLoadSubpackagePrefab(url, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**预加载bundle中的文件*/
|
||||
preLoadSubpackageFile(url: string, pkgName: string, ftype, succCB, failCB) {
|
||||
let bundle = assetManager.getBundle(pkgName);
|
||||
if (bundle){
|
||||
bundle.preload(url, ftype, (err, res) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
failCB && failCB(err);
|
||||
return
|
||||
}
|
||||
succCB && succCB();
|
||||
});
|
||||
} else {
|
||||
assetManager.loadBundle(pkgName, (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
failCB && failCB(err);
|
||||
return
|
||||
}
|
||||
this.preLoadSubpackageFile(url, pkgName, ftype, succCB, failCB);
|
||||
});
|
||||
}
|
||||
}
|
||||
/** 加载bundle中的PB*/
|
||||
loadSubpackagePrefab(url: string, cb) {
|
||||
let bundle = assetManager.getBundle("PB");
|
||||
if (bundle){
|
||||
bundle.load(url, Prefab, (err, res: Prefab) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
let cc_N = instantiate(res);
|
||||
cb && cb(cc_N);
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle("PB", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.loadSubpackagePrefab(url, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**获取pb节点 */
|
||||
getPrefab(path: string, cb: Function, target: Node) {
|
||||
this.loadSubpackagePrefab(path, (pb: Prefab) => {
|
||||
if (target && !target.isValid) {
|
||||
pb.destroy()
|
||||
return;
|
||||
}
|
||||
pb['path'] = path;
|
||||
cb && cb(pb);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** 加载bundle中的PB*/
|
||||
loadSubpackage3DModel(url: string, cb) {
|
||||
let bundle = assetManager.getBundle("Model3D");
|
||||
if (bundle){
|
||||
bundle.load(url, Prefab, (err, res: Prefab) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
let cc_N = instantiate(res);
|
||||
cb && cb(cc_N);
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle("Model3D", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.loadSubpackage3DModel(url, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 改变图片--bundle资源 sprite-frame类型的图片*/
|
||||
changeBundleSpriteFrame(spt: Sprite, url: string, packageName: string, cb: Function = null) {
|
||||
if (!spt || !url) return;
|
||||
let bundle = assetManager.getBundle(packageName);
|
||||
if (bundle){
|
||||
bundle.load(url + "/spriteFrame", SpriteFrame, (err, res: SpriteFrame) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
if (!spt.isValid) {
|
||||
return;
|
||||
}
|
||||
spt.spriteFrame = res;
|
||||
cb && cb(res);
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle(packageName, (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.changeBundleSpriteFrame(spt, url, packageName, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
/** 改变图片--bundle资源 texture类型的图片*/
|
||||
changeBundleTexture(spt: Sprite, url: string, packageName: string, cb: Function = null) {
|
||||
if (!spt || !url) return;
|
||||
let bundle = assetManager.getBundle(packageName);
|
||||
if (bundle){
|
||||
bundle.load(url + "/texture", Texture2D, (err, res: Texture2D) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
if (!spt.isValid) {
|
||||
return;
|
||||
}
|
||||
let spriteFrame = new SpriteFrame()
|
||||
spriteFrame.texture = res
|
||||
spt.spriteFrame = spriteFrame;
|
||||
cb && cb(res);
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle(packageName, (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.changeBundleTexture(spt, url, packageName, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 加载bundle中的音频文件*/
|
||||
getBundleAudio(url: string, cb) {
|
||||
let bundle = assetManager.getBundle("Audio");
|
||||
if (bundle){
|
||||
bundle.load(url, AudioClip, (err, res: AudioClip) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
cb && cb(res);
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle("Audio", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.getBundleAudio(url, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 加载bundle中的配置表*/
|
||||
loadSubpackageDataTable(url: string, cb) {
|
||||
let bundle = assetManager.getBundle("DataTable");
|
||||
if (bundle){
|
||||
bundle.load(url, JsonAsset, (err, res: JsonAsset) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
cb && cb(res);
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle("DataTable", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.loadSubpackagePrefab(url, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/** 加载远程资源*/
|
||||
loadRemoteAudio(url: string, cb: Function = null) {
|
||||
assetManager.loadRemote<AudioClip>(url, (err, res: AudioClip) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return
|
||||
}
|
||||
cb && cb(res);
|
||||
})
|
||||
}
|
||||
|
||||
/** 加载远程资源*/
|
||||
// private loadRemoteRes1(url1: string, suffix: string = 'png', cb) {
|
||||
// let tempStrArr: Array<string> = url1.split(".");
|
||||
// let aimStr = url1;
|
||||
// if (tempStrArr.length > 1) {
|
||||
// aimStr = tempStrArr[0];
|
||||
// }
|
||||
// let url: string = `http://tk3h5.hgwl710.com/Fish/DEV/TS/Res/`;
|
||||
// url += aimStr + '.' + suffix;
|
||||
// if (url1.includes("://")) { url = url1 }
|
||||
// assetManager.loadRemote<ImageAsset>(url, { cacheEnabled: true }, (err, res: ImageAsset) => {
|
||||
// if (!err) {
|
||||
// const spriteFrame = new SpriteFrame();
|
||||
// const texture = new Texture2D();
|
||||
// texture.image = res;
|
||||
// spriteFrame.texture = texture;
|
||||
// cb && cb(spriteFrame);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取远程图片资源并设置
|
||||
* @param spt 要设置的节点
|
||||
* @param url url地址
|
||||
* @param suffix 图片后缀名
|
||||
* @param cb 回调函数
|
||||
*/
|
||||
changeRemoteSpriteFrame(spt: Sprite, url: string, suffix: string = 'png', cb: Function = null) {
|
||||
if (!spt || !url) return;
|
||||
assetManager.loadRemote<ImageAsset>(url, {ext: '.'+suffix}, (err, res: ImageAsset) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
if (!spt.isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const spriteFrame = new SpriteFrame();
|
||||
const texture = new Texture2D();
|
||||
texture.image = res;
|
||||
spriteFrame.texture = texture;
|
||||
|
||||
spt.spriteFrame = spriteFrame;
|
||||
cb && cb(res);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/** 加载resources里的PB path:不带后缀*/
|
||||
private loadResourcePrefab(path: string, cb) {
|
||||
resources.load(path, Prefab, (err, res: Prefab) => {
|
||||
if (!err) {
|
||||
cb && cb(res);
|
||||
} else {
|
||||
// loader.rlease(path);
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 加载resources里的图片*/
|
||||
private loadResourceRes(path: string, cb) {
|
||||
resources.load(path, ImageAsset, (err, res: ImageAsset) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
cb && cb(res);
|
||||
})
|
||||
}
|
||||
/** 加载resources里图集里的图片*/
|
||||
// 加载 SpriteAtlas(图集),并且获取其中的一个 SpriteFrame
|
||||
// 注意 atlas 资源文件(plist)通常会和一个同名的图片文件(png)放在一个目录下, 所以需要在第二个参数指定资源类型
|
||||
private loadResourceAtlas(sptName: string, path: string, cb) {
|
||||
resources.load(path, SpriteAtlas, (err, res: SpriteAtlas) => {
|
||||
const frame = res.getSpriteFrame(sptName);
|
||||
if (!err) {
|
||||
cb && cb(frame);
|
||||
} else {
|
||||
// loader.release(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 改变图片--resources里sprite-frame类型的图片*/
|
||||
changeResourceSpriteFrame(spt: Sprite, path: string, cb: Function = null) {
|
||||
if (!spt || !path) return;
|
||||
resources.load(path + "/spriteFrame", SpriteFrame, (err, res: SpriteFrame) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
if (!spt.isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
spt.spriteFrame = res;
|
||||
cb && cb(res);
|
||||
})
|
||||
}
|
||||
/** 改变图片--resources里texture类型的图片*/
|
||||
changeResourceTexture(spt: Sprite, path: string, cb: Function = null) {
|
||||
if (!spt || !path) return;
|
||||
resources.load(path + "/texture", Texture2D, (err, res: Texture2D) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
if (!spt.isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
let spriteFrame = new SpriteFrame()
|
||||
spriteFrame.texture = res
|
||||
spt.spriteFrame = spriteFrame;
|
||||
cb && cb(res);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//设置图片置灰
|
||||
SetGray(spt: Sprite, isGray: boolean) {
|
||||
//cc.assetManager.builtins.getBuiltin("material", "builtin-" + name)
|
||||
if (isGray) {
|
||||
let bundle = assetManager.getBundle("Materials");
|
||||
if (bundle){
|
||||
bundle.load("ui_sprite_gray", Material, (err, res: Material) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
// spt.setSharedMaterial(res, 0)
|
||||
spt.customMaterial = res
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle("Materials", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.SetGray(spt, isGray);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// spt.setSharedMaterial(null, 0)
|
||||
spt.customMaterial = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**设置图片模糊*/
|
||||
SetBlur(spt: Sprite, isBule: boolean) {
|
||||
if (isBule) {
|
||||
let bundle = assetManager.getBundle("Materials");
|
||||
if (bundle){
|
||||
bundle.load("mohu", Material, (err, res: Material) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
// spt.setSharedMaterial(res, 0)
|
||||
spt.customMaterial = res
|
||||
console.log("设置图片模糊!")
|
||||
});
|
||||
}else{
|
||||
assetManager.loadBundle("Materials", (err: Error, _bundle: AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
this.SetGray(spt, isBule);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// spt.setSharedMaterial(null, 0)
|
||||
spt.customMaterial = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "096b97ad-8ffd-4565-89aa-f6c563b08aa7",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "956e1653-d431-4cce-9c66-e37294824362",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "956e1653-d431-4cce-9c66-e37294824362@6c48a",
|
||||
"displayName": "lofy_disgust",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "956e1653-d431-4cce-9c66-e37294824362",
|
||||
"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": "956e1653-d431-4cce-9c66-e37294824362@f9941",
|
||||
"displayName": "lofy_disgust",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -27.5,
|
||||
"offsetY": -27.5,
|
||||
"trimX": 0,
|
||||
"trimY": 55,
|
||||
"width": 870,
|
||||
"height": 1134,
|
||||
"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": [
|
||||
-435,
|
||||
-567,
|
||||
0,
|
||||
435,
|
||||
-567,
|
||||
0,
|
||||
-435,
|
||||
567,
|
||||
0,
|
||||
435,
|
||||
567,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1134,
|
||||
870,
|
||||
1134,
|
||||
0,
|
||||
0,
|
||||
870,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
0.9405405405405406,
|
||||
0,
|
||||
0,
|
||||
0.9537426408746846,
|
||||
0.9405405405405406,
|
||||
0.9537426408746846
|
||||
],
|
||||
"minPos": [
|
||||
-435,
|
||||
-567,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
435,
|
||||
567,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "956e1653-d431-4cce-9c66-e37294824362@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "956e1653-d431-4cce-9c66-e37294824362@6c48a"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 924 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "a101917f-1a18-4119-83c3-4319ac3412cc",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "a101917f-1a18-4119-83c3-4319ac3412cc@6c48a",
|
||||
"displayName": "metis_default",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "a101917f-1a18-4119-83c3-4319ac3412cc",
|
||||
"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": "a101917f-1a18-4119-83c3-4319ac3412cc@f9941",
|
||||
"displayName": "metis_default",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": -13,
|
||||
"trimX": 0,
|
||||
"trimY": 26,
|
||||
"width": 800,
|
||||
"height": 1003,
|
||||
"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": [
|
||||
-400,
|
||||
-501.5,
|
||||
0,
|
||||
400,
|
||||
-501.5,
|
||||
0,
|
||||
-400,
|
||||
501.5,
|
||||
0,
|
||||
400,
|
||||
501.5,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1003,
|
||||
800,
|
||||
1003,
|
||||
0,
|
||||
0,
|
||||
800,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0.9747327502429544,
|
||||
1,
|
||||
0.9747327502429544
|
||||
],
|
||||
"minPos": [
|
||||
-400,
|
||||
-501.5,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
400,
|
||||
501.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "a101917f-1a18-4119-83c3-4319ac3412cc@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "a101917f-1a18-4119-83c3-4319ac3412cc@6c48a"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
@@ -0,0 +1,552 @@
|
||||
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, { E_TalkStage, E_TalkStatusType } from '../../Main/Manager/GameManager';
|
||||
import { I_LevelConfig } from '../../Main/Config/CommonConfig';
|
||||
import SubManager from '../SubManager';
|
||||
import { ByteDanceSDK } from '../../Main/Channel/bdSDK';
|
||||
import GlobalValue from '../../Main/Common/GlobalValue';
|
||||
import PlayerDataManager from '../../Main/Manager/PlayerDataManager';
|
||||
import { E_AD_TARGET } from './TalkAdDialog';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//主界面
|
||||
@ccclass('Start_UI')
|
||||
export class Start_UI extends li_BaseView {
|
||||
@property(ScrollViewList)
|
||||
private Level_List: ScrollViewList = null
|
||||
@property(Prefab)
|
||||
private Level_Item: Prefab = null
|
||||
private itemClone: any = null
|
||||
|
||||
private _nodeTab: any = {};
|
||||
private _data;
|
||||
private levelData: I_LevelConfig[] = []; //关卡数据
|
||||
private curLevelIdx: number = 0; //当前关卡Idx
|
||||
|
||||
private lvUnlockId: string = ""; //解锁关卡id
|
||||
|
||||
//----重写父类接口---------------------------------------
|
||||
onLoadCT() {
|
||||
this.registerListenner();
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
this.itemClone = instantiate(this.Level_Item)
|
||||
this.Level_List.setTemplateItem(this.itemClone)
|
||||
Utils.setString(this._nodeTab.labNpcName, "")
|
||||
Utils.setString(this._nodeTab.labNpcTalk, "")
|
||||
}
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data
|
||||
}
|
||||
|
||||
|
||||
registerListenner() {
|
||||
Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
|
||||
Utils.addInnerEL(InnerMsgCode.UI_Talk_Back, this, this.resiveTalkBack)
|
||||
Utils.addInnerEL(InnerMsgCode.UI_BD_Sidebar, this, this.resiveBDSidebar)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
|
||||
GButton.BandClick(this._nodeTab.btnStart, this.onStartClick, this, 10002);
|
||||
GButton.BandClick(this._nodeTab.btnAddTZCount, this.onAddTZClick, this);
|
||||
GButton.BandClick(this._nodeTab.tzCountNode, this.onAddTZClick, this);
|
||||
GButton.BandClick(this._nodeTab.btnSetting, this.onSettingClick, this);
|
||||
GButton.BandClick(this._nodeTab.btnBDSidebar, this.onBDSidebarClick, this);
|
||||
GButton.BandClick(this._nodeTab.btnGM, this.onGMClick, this);
|
||||
|
||||
SDKManager.register_video_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("视频广告回调", tag)
|
||||
if (tag == 1) {
|
||||
// 加次数
|
||||
HttpUnit.ins.setUserAd({type:1}, (data) => {
|
||||
SubManager.ShowPrompt("观看视频成功,获得相亲次数")
|
||||
this.refreshXiangqinTicket()
|
||||
})
|
||||
} else if (tag == 2) {
|
||||
// 解锁关卡
|
||||
HttpUnit.ins.levelUnlock({level_id: this.lvUnlockId}, (data) => {
|
||||
// SubManager.ShowPrompt("关卡解锁成功")
|
||||
this.refreshLevelList()
|
||||
this.enterLevelAfterUnlock()
|
||||
})
|
||||
}
|
||||
})
|
||||
SDKManager.register_share_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("分享回调", tag)
|
||||
if (tag == 1) {
|
||||
// 加次数
|
||||
HttpUnit.ins.setUserShare({type:1}, (data) => {
|
||||
SubManager.ShowPrompt("分享成功,获得相亲次数")
|
||||
this.refreshXiangqinTicket()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
AudioManager.I.PlayMusic(1, true) //背景乐
|
||||
GameRootUI.InitDisableOperUI(false)
|
||||
GameRootUI.InitCrossUI(false)
|
||||
this.setUIVisible(true)
|
||||
|
||||
//设置按钮
|
||||
if (GlobalValue.GMSwtitch) {
|
||||
this._nodeTab.btnSetting.active = true
|
||||
this._nodeTab.btnGM.active = true
|
||||
} else {
|
||||
this._nodeTab.btnSetting.active = false
|
||||
this._nodeTab.btnGM.active = false
|
||||
}
|
||||
|
||||
//抖音侧边栏
|
||||
this._nodeTab.btnBDSidebar.active = false
|
||||
if (SDKManager.isByteDance()) {
|
||||
this.refreshBdSidebarUI()
|
||||
ByteDanceSDK.CheckSidebarState((state) =>{
|
||||
if (state == true) {
|
||||
this.refreshBdSidebarUI()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//判断玩家权限是否已获取
|
||||
if (!HttpUnit.IsLogin()) {
|
||||
HttpUnit.ins.login((loginData) => {
|
||||
console.log("主界面: 获取授权并登录成功!")
|
||||
this.userInited()
|
||||
})
|
||||
} else {
|
||||
this.userInited()
|
||||
}
|
||||
|
||||
//判断是否需要显示引导
|
||||
this.resetGuide()
|
||||
this.checkGuide()
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//GM界面关闭消息
|
||||
resiveGMClose(data) {
|
||||
Utils.Log("收到GM界面关闭消息")
|
||||
}
|
||||
|
||||
//退出聊天消息
|
||||
resiveTalkBack(data) {
|
||||
Utils.Log("收到退出聊天消息")
|
||||
AudioManager.I.PlayMusic(1, true) //背景乐
|
||||
this.setUIVisible(true)
|
||||
this.refreshLevelList()
|
||||
HttpUnit.ins.getUserData((userData) => {
|
||||
this.refreshXiangqinTicket()
|
||||
})
|
||||
}
|
||||
|
||||
//抖音侧边栏消息
|
||||
resiveBDSidebar(data) {
|
||||
this.refreshBdSidebarUI()
|
||||
}
|
||||
|
||||
|
||||
//增加相亲次数
|
||||
private doAddXiangqinCnt(add:number = 1) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//显示主界面UI
|
||||
setUIVisible(vis: boolean) {
|
||||
this._nodeTab.UIRoot.active = vis
|
||||
}
|
||||
|
||||
//刷新抖音侧边栏按钮显示状态
|
||||
refreshBdSidebarUI() {
|
||||
if (!SDKManager.isByteDance()) {
|
||||
//不是抖音平台,不显示
|
||||
this._nodeTab.btnBDSidebar.active = false
|
||||
return
|
||||
}
|
||||
|
||||
let stage = ByteDanceSDK.SidebarState
|
||||
if (stage == 1) {
|
||||
//前往
|
||||
this._nodeTab.btnBDSidebar.active = true
|
||||
// Utils.setString(this._nodeTab.labBDSidebar, "前往抖音侧边栏")
|
||||
} else if (stage == 2) {
|
||||
//从侧边栏返回
|
||||
this._nodeTab.btnBDSidebar.active = false
|
||||
// Utils.setString(this._nodeTab.labBDSidebar, "领取抖音侧边栏")
|
||||
} else {
|
||||
//版本不支持
|
||||
this._nodeTab.btnBDSidebar.active = false
|
||||
}
|
||||
}
|
||||
|
||||
//刷新玩家信息完毕
|
||||
userInited() {
|
||||
this.refreshSdkUI()
|
||||
this.refreshLevelList()
|
||||
this.refreshXiangqinTicket()
|
||||
}
|
||||
|
||||
//刷新剩余相亲次数
|
||||
private refreshXiangqinTicket() {
|
||||
let xqnum = HttpUnit.GetXiangqinTickets()
|
||||
// let xqmax = HttpUnit.GetXiangqinMaxTickets()
|
||||
Utils.setString(this._nodeTab.labTZCount, xqnum + "")
|
||||
Utils.setString(this._nodeTab.labBtnTZCount, "" + xqnum)
|
||||
}
|
||||
|
||||
//刷新关卡列表
|
||||
private refreshLevelList() {
|
||||
HttpUnit.ins.getLevelList((levelList) => {
|
||||
if (levelList) {
|
||||
GameManager.SetLevelCfg(levelList)
|
||||
this.levelData = levelList
|
||||
this.levelData.unshift({} as any) //在最前面插入一个占位数据,用于数组排版显示
|
||||
this.Level_List.numItems = this.levelData.length
|
||||
if (this.curLevelIdx < 1) {
|
||||
this.curLevelIdx = 1
|
||||
for (let i = 1; i < this.levelData.length; i++) {
|
||||
if (this.levelData[i].is_unlock == true) {
|
||||
if (this.curLevelIdx < i) {
|
||||
this.curLevelIdx = i
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (this.curLevelIdx > 2) {
|
||||
this.Level_List.scrollTo(this.curLevelIdx-2)
|
||||
}
|
||||
}
|
||||
this.changeLevel(this.curLevelIdx, true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//刷新SDK相关的UI
|
||||
refreshSdkUI() {
|
||||
console.log("主界面:刷新SDK相关的UI...")
|
||||
SDKManager.getUserInfo((data) => {
|
||||
//头像
|
||||
let spt = this._nodeTab.headIcon.getComponent(Sprite)
|
||||
ResManager.I.changeRemoteSpriteFrame(spt, data.avatarUrl)
|
||||
//名字
|
||||
let nickName = this._nodeTab.nickName.getComponent(Label)
|
||||
nickName.string = data.nickName
|
||||
console.log("主界面 设置头像和名字:", data.avatarUrl, data.nickName)
|
||||
})
|
||||
//刷新id
|
||||
let id = HttpUnit.GetID()
|
||||
Utils.setString(this._nodeTab.userId, `ID:${id}`)
|
||||
}
|
||||
|
||||
|
||||
//关卡列表渲染
|
||||
onRenderItemList(node: any, idx: number) {
|
||||
if(!isValid(node)) {return}
|
||||
if (!node.inited) {
|
||||
node.inited = true;
|
||||
Utils.parseNode(node);
|
||||
}
|
||||
|
||||
GButton.RemoveClick(node)
|
||||
|
||||
//第一个是占位用的
|
||||
if (idx == 0) {
|
||||
node.l_rotateN.active = false
|
||||
node.zhanweiNode.active = true
|
||||
return
|
||||
}
|
||||
|
||||
node.l_rotateN.active = true
|
||||
node.zhanweiNode.active = false
|
||||
let data = this.levelData[idx]
|
||||
//头像
|
||||
let headPath = `headLevel/${data.icon}`
|
||||
ResManager.I.changeBundleSpriteFrame(node.head1.getComponent(Sprite), headPath, "Raw")
|
||||
//解锁状态
|
||||
node.lockNode.active = data.is_unlock ? false : true
|
||||
node.unlockNode.active = data.is_unlock ? true : false
|
||||
if (data.is_unlock) {
|
||||
//分数
|
||||
Utils.setString(node.labScore, data.score)
|
||||
//星级
|
||||
if (data.star == 3) {
|
||||
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_11", "Zhujiemian")
|
||||
} else if (data.star == 2) {
|
||||
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_10", "Zhujiemian")
|
||||
} else if (data.star == 1) {
|
||||
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_9", "Zhujiemian")
|
||||
} else {
|
||||
ResManager.I.changeBundleSpriteFrame(node.l_xingji.getComponent(Sprite), "zjm_8", "Zhujiemian")
|
||||
}
|
||||
//满星效果
|
||||
node.l_manxing.active = data.star == 3 ? true : false
|
||||
if (data.star == 3) {
|
||||
ResManager.I.changeBundleSpriteFrame(node.l_bg.getComponent(Sprite), "zjm_6", "Zhujiemian")
|
||||
} else {
|
||||
ResManager.I.changeBundleSpriteFrame(node.l_bg.getComponent(Sprite), "zjm_5", "Zhujiemian")
|
||||
}
|
||||
}
|
||||
GButton.BandClick(node, ()=>{
|
||||
this.changeLevel(idx)
|
||||
}, this)
|
||||
}
|
||||
|
||||
|
||||
//切换关卡
|
||||
changeLevel(idx:number, force:boolean = false) {
|
||||
if (this.curLevelIdx == idx && !force) {
|
||||
return
|
||||
}
|
||||
this.curLevelIdx = idx
|
||||
let data = this.levelData[idx]
|
||||
//名字
|
||||
Utils.setString(this._nodeTab.labNpcName, data.characterName)
|
||||
//介绍
|
||||
Utils.setString(this._nodeTab.labNpcTalk, data.description)
|
||||
//是否解锁
|
||||
if (data.is_unlock) {
|
||||
Utils.setString(this._nodeTab.labStart1, "游戏开始")
|
||||
Utils.setString(this._nodeTab.labStart2, "GAME\nSTART")
|
||||
} else {
|
||||
Utils.setString(this._nodeTab.labStart1, "解锁关卡")
|
||||
Utils.setString(this._nodeTab.labStart2, "UNLOCK\nGAME")
|
||||
}
|
||||
|
||||
let bgPath = `bg/${data.bgImage}`
|
||||
let rolePath = `role/${data.characterFullLengthPortrait}`
|
||||
Utils.sendInnerMsg(InnerMsgCode.SceneLayerBgUp, {bgPath:bgPath, rolePath:rolePath})
|
||||
}
|
||||
|
||||
|
||||
//region 开始游戏
|
||||
onStartClick() {
|
||||
Utils.Log("点击开始游戏");
|
||||
|
||||
this.finishGuide()
|
||||
|
||||
if (this.curLevelIdx == 0) {
|
||||
console.error("当前关卡为0,此关卡是占位用的")
|
||||
return
|
||||
}
|
||||
|
||||
let data = this.levelData[this.curLevelIdx]
|
||||
let level_id = data.id
|
||||
GameManager.EndGame()
|
||||
|
||||
//未解锁
|
||||
if (data.is_unlock != true) {
|
||||
if (HttpUnit.GetXiangqinTickets() <= 0) {
|
||||
SubManager.ShowPrompt("今日相亲次数已耗尽,无法提前解锁更多关卡");
|
||||
} else {
|
||||
this.lvUnlockId = level_id
|
||||
SubManager.ShowCommonAdDialog({
|
||||
content: "关卡未解锁,需要通过本关卡的前置关卡,或观看广告提前解锁关卡,并消耗 1 点相亲次数进入关卡",
|
||||
strAd: "观看广告",
|
||||
strLeft: "返回",
|
||||
adCallback: () => {
|
||||
SDKManager.show_reward_video_ad(this.node.uuid, 2)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//检测存档
|
||||
if (GlobalValue.LvHuancun && data.record_id && data.record_id != "") {
|
||||
HttpUnit.ins.getTalkStage({record_id: data.record_id}, (_data) => {
|
||||
if (_data) {
|
||||
if (_data.level.status == E_TalkStatusType.talking) {
|
||||
this._continueLevel(level_id, _data)
|
||||
} else {
|
||||
this._startNewLevel(level_id)
|
||||
}
|
||||
} else {
|
||||
this._startNewLevel(level_id)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
SubManager.ShowConfirm({
|
||||
content: `确认消耗 1 点“相亲次数” 开始与【${data.name}】相亲吗?`,
|
||||
strYes: "确认",
|
||||
strNo: "返回",
|
||||
yesCallback: () => {
|
||||
this._startNewLevel(level_id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
//开始新关卡
|
||||
private _startNewLevel(level_id) {
|
||||
|
||||
if (HttpUnit.GetXiangqinTickets() <= 0) {
|
||||
SubManager.ShowPrompt("今日相亲次数已用完");
|
||||
return;
|
||||
}
|
||||
|
||||
GameManager.CurLevelId = level_id
|
||||
HttpUnit.ins.levelStart({level_id:level_id}, (data) => {
|
||||
GameManager.CurLevelData = data.level
|
||||
GameManager.RecordId = data.record_id
|
||||
GameManager.I.connetSorcket(data.record_id) //连接socket
|
||||
this.setUIVisible(false)
|
||||
AudioManager.I.StopMusic() //停止背景音乐,进去后播放当前关卡音乐
|
||||
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
|
||||
})
|
||||
}
|
||||
//region 继续关卡存档
|
||||
private _continueLevel(level_id, data) {
|
||||
SubManager.ShowConfirm({
|
||||
content: "检测到进行中的记录,是否继续?",
|
||||
strYes: "继续",
|
||||
strNo: "重新开始",
|
||||
yesCallback: () => {
|
||||
//继续对话
|
||||
let lvCfg = this.levelData[this.curLevelIdx]
|
||||
let t_xindong = 0
|
||||
let t_xihuan = 0
|
||||
let t_taoyan = 0
|
||||
|
||||
//聊天记录
|
||||
GameManager.AddTalkRecord({talk:lvCfg.prologueMessage, isMe:false})
|
||||
let msg = data.messages || []
|
||||
for (let i = 0; i < msg.length; i++) {
|
||||
let m = msg[i]
|
||||
GameManager.AddStepScore(m.ai_score) //记录本次分数
|
||||
GameManager.AddTalkRecord({talk:m.user_input, isMe:true})
|
||||
GameManager.AddTalkRecord({talk:m.ai_response, isMe:false})
|
||||
if (m.judgement == 0) {
|
||||
t_xindong++
|
||||
t_xihuan++
|
||||
} else if (m.judgement == 2) {
|
||||
t_taoyan++
|
||||
}
|
||||
}
|
||||
|
||||
GameManager.CurLevelId = level_id
|
||||
GameManager.CurLevelData = data.level
|
||||
GameManager.RecordId = data.record_id
|
||||
GameManager.srouceCnt = data.level.current_cnt
|
||||
GameManager.xindongCishu = t_xindong
|
||||
GameManager.npcFixTalkCountXihuan = t_xihuan
|
||||
GameManager.npcFixTalkCountTaoyan = t_taoyan
|
||||
GameManager.TurnToStage(E_TalkStage.myTalk)
|
||||
GameManager.I.connetSorcket(data.record_id) //连接socket
|
||||
this.setUIVisible(false)
|
||||
AudioManager.I.StopMusic() //停止背景音乐,进去后播放当前关卡音乐
|
||||
ViewManager.I.openBundlesView("UI/StartUI/Talk_UI")
|
||||
},
|
||||
noCallback: () => {
|
||||
//重新开始
|
||||
this._startNewLevel(level_id)
|
||||
}
|
||||
})
|
||||
}
|
||||
/**手动解锁关卡后进入 */
|
||||
enterLevelAfterUnlock() {
|
||||
this._startNewLevel(this.lvUnlockId)
|
||||
this.lvUnlockId = ""
|
||||
}
|
||||
|
||||
//增加相亲次数
|
||||
onAddTZClick() {
|
||||
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
|
||||
type: E_AD_TARGET.xiangqin, //加相亲次数
|
||||
content: GlobalValue.XiangQinAdTipsStr,
|
||||
adCallback: ()=>{
|
||||
SDKManager.show_reward_video_ad(this.node.uuid, 1)
|
||||
},
|
||||
shareCallback: ()=>{
|
||||
SDKManager.show_reward_share(this.node.uuid, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//设置
|
||||
onSettingClick() {
|
||||
ViewManager.I.openBundlesView("UI/StartUI/Setting_UI")
|
||||
}
|
||||
|
||||
//gm
|
||||
onGMClick() {
|
||||
ViewManager.I.openBundlesView("UI/GM_UI")
|
||||
}
|
||||
|
||||
//点击抖音侧边栏按钮
|
||||
onBDSidebarClick() {
|
||||
if (!SDKManager.isByteDance()) {
|
||||
//不是抖音平台
|
||||
return
|
||||
}
|
||||
|
||||
ViewManager.I.openBundlesView("UI/StartUI/BDSidebar_UI")
|
||||
}
|
||||
|
||||
|
||||
//region 引导相关
|
||||
private _guideInterval: number = 0.5 //引导间隔
|
||||
//重置引导节点显示
|
||||
private resetGuide() {
|
||||
this._nodeTab.guideStep1.active = false
|
||||
this._nodeTab.guideStep2.active = false
|
||||
this._nodeTab.guideHandNode.active = false
|
||||
this._nodeTab.btnStart.parent = this._nodeTab.startParent1
|
||||
}
|
||||
//检查引导
|
||||
private checkGuide() {
|
||||
if (PlayerDataManager.I.GuideMainFinished) {
|
||||
return
|
||||
}
|
||||
this.doGuideStep1()
|
||||
}
|
||||
//引导步骤1 显示介绍弹窗
|
||||
private doGuideStep1() {
|
||||
GameRootUI.DisableOper(this._guideInterval)
|
||||
this.scheduleOnce(() => {
|
||||
this._nodeTab.guideStep1.active = true
|
||||
GButton.RemoveAndBandClick(this._nodeTab.btnGs1Ok, this.onGuide1OkClick, this);
|
||||
},this._guideInterval)
|
||||
|
||||
}
|
||||
//引导步骤2 显示手
|
||||
private doGuideStep2() {
|
||||
GameRootUI.DisableOper(this._guideInterval)
|
||||
this.scheduleOnce(() => {
|
||||
this._nodeTab.guideStep2.active = true
|
||||
this._nodeTab.guideHandNode.active = true
|
||||
this._nodeTab.btnStart.parent = this._nodeTab.startParent2
|
||||
},this._guideInterval)
|
||||
}
|
||||
//引导完成
|
||||
private finishGuide() {
|
||||
if (PlayerDataManager.I.GuideMainFinished) {
|
||||
return
|
||||
}
|
||||
PlayerDataManager.I.SetGuideMainFinish(true)
|
||||
this.resetGuide()
|
||||
}
|
||||
|
||||
onGuide1OkClick() {
|
||||
this._nodeTab.guideStep1.active = false
|
||||
this.doGuideStep2()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "c566bf67-f451-4eb3-988d-f1c9d4f557a9",
|
||||
"files": [
|
||||
".jpg",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "c566bf67-f451-4eb3-988d-f1c9d4f557a9@6c48a",
|
||||
"displayName": "danyu_stage_bg",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "c566bf67-f451-4eb3-988d-f1c9d4f557a9",
|
||||
"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": "c566bf67-f451-4eb3-988d-f1c9d4f557a9@f9941",
|
||||
"displayName": "danyu_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": "c566bf67-f451-4eb3-988d-f1c9d4f557a9@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": false,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "c566bf67-f451-4eb3-988d-f1c9d4f557a9@6c48a"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,11 @@
|
||||
|
||||
//消息枚举
|
||||
export enum InnerMsgCode {
|
||||
GM_UI_Close, //关闭GM界面
|
||||
SceneLayerBgUp, //刷新场景背景图
|
||||
UI_Talk_Back, //从聊天界面返回
|
||||
UI_BD_Sidebar, //抖音侧边栏状态刷新
|
||||
|
||||
Data_UserInfo_Up, //用户信息更新
|
||||
Data_NpcTalkBack, //NPC对话返回
|
||||
}
|
||||
Reference in New Issue
Block a user