调整视图层代码模板,使自定义初始化界面逻辑在GameComponent.start生命周期中编写,方便在使用oops.gui.openAsync时获取到ecs实体对象

This commit is contained in:
dgflash
2022-07-28 09:50:32 +08:00
parent ab531429e8
commit 7a33e422f4
4 changed files with 8 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ const { ccclass, property } = _decorator;
@ecs.register('<%Name%>', false)
export class <%Name%>Comp extends CCComp {
/** 视图层逻辑代码分离演示 */
onLoad() {
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}

View File

@@ -12,7 +12,7 @@ export class <%Name%>Comp extends CCVMParentComp {
data: any = {};
/** 视图层逻辑代码分离演示 */
onLoad() {
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
}

View File

@@ -460,7 +460,9 @@
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": false,
"_editableMaterial": null
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null
},
{
"__type__": "cc.FogInfo",

View File

@@ -5,8 +5,8 @@
* @LastEditTime: 2022-07-22 17:09:30
*/
import { resLoader } from "../../../../../extensions/oops-plugin-framework/assets/core/common/loader/ResLoader";
import { AsyncQueue, NextFunction } from "../../../../../extensions/oops-plugin-framework/assets/libs/collection/AsyncQueue";
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { AsyncQueue, NextFunction } from "../../../../../extensions/oops-plugin-framework/assets/libs/collection/AsyncQueue";
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { config } from "../../common/config/Config";
import { UIID } from "../../common/config/GameUIConfig";
@@ -42,9 +42,6 @@ export class InitResSystem extends ecs.ComblockSystem implements ecs.IEntityEnte
/** 加载自定义内容(可选) */
private loadCustom(queue: AsyncQueue) {
queue.push(async (next: NextFunction, params: any, args: any) => {
// 设置渠道号
// if (config.query.channelId) SDKPlatform.setChannelId(config.query.channelId);
// 加载多语言对应字体
resLoader.load("language/font/" + oops.language.current, next);
});
@@ -56,16 +53,15 @@ export class InitResSystem extends ecs.ComblockSystem implements ecs.IEntityEnte
// 设置默认语言
let lan = oops.storage.get("language");
if (lan == null) {
// lan = SDKPlatform.getLanguage();
lan = "zh";
oops.storage.set("language", lan!);
oops.storage.set("language", lan);
}
// 设置语言包路径
oops.language.setAssetsPath(config.game.languagePathJson, config.game.languagePathTexture);
// 加载语言包资源
oops.language.setLanguage(lan!, next);
oops.language.setLanguage(lan, next);
});
}