重置配置表

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-06 02:25:02 +08:00
parent e8f8cb3ce9
commit e24dded990
154 changed files with 1214 additions and 26044 deletions

View File

@@ -16,16 +16,11 @@ import axios from "../../extensions/ngame/assets/plugins/axios.js";
import GBattleModeManager from "./battle/GBattleModeManager";
import { GLayer, UIConfig } from "./ui/UIConfig";
import JLoaderSystem from "../../extensions/ngame/assets/ngame/system/JLoaderSystem";
import { TableGRole } from "../resources/config/ts/TableGRole";
import { sp } from "cc";
import { TableGRoleAttack } from "../resources/config/ts/TableGRoleAttack";
import { SpriteFrame } from "cc";
import { TableGRoleAttackBullet } from "../resources/config/ts/TableGRoleAttackBullet";
import { TableGRoleAttackEffect } from "../resources/config/ts/TableGRoleAttackEffect";
import { TableGRoleSkill } from "../resources/config/ts/TableGRoleSkill";
import { TableGRoleSkillEffect } from "../resources/config/ts/TableGRoleSkillEffect";
import { TableGMap } from "../resources/config/ts/TableGMap";
import Loading from "../../extensions/ngame/assets/ngame/util/Loading";
import { TB, Tables } from "../resources/config/data/schema";
import { JsonAsset } from "cc";
let IP = "kyu.jisol.cn";
@@ -104,37 +99,33 @@ export abstract class JNGSyncProtoBase<T> extends JNSyncFrameProtoComponent<T>{
}
export var TD:Tables = null;
//读写config
export class JNGConfig extends SystemBase{
static loading = "JNGConfig";
//配置JSON加载
jsons:JsonLoad[] = [
{name:TableGRole.TableName}, //角色
{name:TableGRoleAttack.TableName}, //角色攻击
{name:TableGRoleAttackBullet.TableName}, //角色攻击子弹
{name:TableGRoleAttackEffect.TableName}, //角色攻击特效
{name:TableGRoleSkill.TableName}, //角色技能
{name:TableGRoleSkillEffect.TableName}, //角色技能特效
{name:TableGMap.TableName}, //游戏地图
].map((table) => {
return {
name:table.name,
bundle:"resources",
path:"config/game/"
}
});
async onInit(): Promise<any> {
app.loading.setCurrent(JNGConfig.loading);
for (const key in this.jsons) {
const load = this.jsons[key];
let json2 = resources.getDirWithPath("config/json/",JsonAsset).map((info) => {
let args = info.path.split("/");
return {
name:args[args.length - 1],
bundle:"resources",
path:"config/json/"
}
})
for (const key in json2) {
const load = json2[key];
await JsonUtil.load(load);
}
TD = new Tables((file) => JsonUtil.get(file))
console.log(TD);
app.loading.ok(JNGConfig.loading);
}
@@ -146,10 +137,11 @@ export class JLoaderBattle extends JLoaderSystem{
static loading = "JLoaderBattle";
static loadingInit = "JLoaderBattle_Init";
skData:{[id:number]:sp.SkeletonData} = {}; //角色Spine
bullets:{[id:number]:SpriteFrame} = {}; //子弹
effects:{[id:number]:sp.SkeletonData} = {}; //Spine特效
maps:{[id:number]:SpriteFrame[]} = {}; //地图
roleSpine:{[id:number]:sp.SkeletonData} = {}; //角色Spine
roleResImage:{[id:number]:SpriteFrame} = {}; //角色战斗素材图片
roleResSpine:{[id:number]:sp.SkeletonData} = {}; //角色战斗素材Spine
effects:{[id:number]:sp.SkeletonData} = {}; //Spine特效
maps:{[id:number]:SpriteFrame[]} = {}; //地图
async onInit(): Promise<any> {
@@ -162,43 +154,33 @@ export class JLoaderBattle extends JLoaderSystem{
app.loading.setCurrent(JLoaderBattle.loadingInit);
//将配置表的角色都读取出来
for (const info of Object.values(TableGRole.getAllConfig())) {
this.skData[info.id] = await (new Promise(r => {
for (const info of TD.TbGRole.getDataMap().values()) {
this.roleSpine[info.id] = await (new Promise(r => {
this.bundle.load(info.spine,sp.SkeletonData,(err,data) => {
r(data);
})
}))
}
//将所有子弹读取出来
for (const info of Object.values(TableGRoleAttackBullet.getAllConfig())) {
this.bullets[info.id] = await (new Promise(r => {
this.bundle.load(info.bulletSrc,SpriteFrame,(err,data) => {
r(data);
})
}))
}
//攻击特效读取
for (const info of Object.values(TableGRoleAttackEffect.getAllConfig())) {
this.effects[info.id] = await (new Promise(r => {
this.bundle.load(info.spine,sp.SkeletonData,(err,data) => {
r(data);
})
}))
}
//技能特效读取
for (const info of Object.values(TableGRoleSkillEffect.getAllConfig())) {
this.effects[info.id] = await (new Promise(r => {
this.bundle.load(info.spine,sp.SkeletonData,(err,data) => {
r(data);
})
}))
//读取角色战斗素材
for(const info of TD.TbGRoleBattleRes.getDataMap().values()){
if(info.resType == "Spine"){
this.roleResSpine[info.id] = await (new Promise(r => {
this.bundle.load(info.resSrc,sp.SkeletonData,(err,data) => {
r(data);
})
}))
}else{
this.roleResImage[info.id] = await (new Promise(r => {
this.bundle.load(info.resSrc,SpriteFrame,(err,data) => {
r(data);
})
}))
}
}
//读取地图
for (const info of Object.values(TableGMap.getAllConfig())) {
for (const info of TD.TbGMap.getDataMap().values()) {
this.maps[info.id] = await (Promise.all(["1","2","3"].map(index => `map${index}`).map(key => {
return new Promise<SpriteFrame>(r => {
@@ -234,5 +216,5 @@ export const app = {
[JNGConfig.loading]:{title:"加载配置文件"},
[JLoaderBattle.loading]:{title:"加载战斗资源"},
[JLoaderBattle.loadingInit]:{title:"初始化战斗资源"},
})
}),
}