mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-05-19 16:54:22 +00:00
兼容kunpo-ecs的实体配置
This commit is contained in:
parent
654dd405b9
commit
b152bfdae3
@ -17,6 +17,7 @@ import { debug, log } from "../tool/log";
|
|||||||
import { Time } from "../tool/Time";
|
import { Time } from "../tool/Time";
|
||||||
import { PropsHelper } from "../ui/PropsHelper";
|
import { PropsHelper } from "../ui/PropsHelper";
|
||||||
import { CocosAdapter } from "./CocosAdapter";
|
import { CocosAdapter } from "./CocosAdapter";
|
||||||
|
const _global = (globalThis || window || global) as any;
|
||||||
const { property } = _decorator;
|
const { property } = _decorator;
|
||||||
export abstract class CocosEntry extends Component {
|
export abstract class CocosEntry extends Component {
|
||||||
@property({ displayName: "uiConfig", type: JsonAsset, tooltip: "编辑器导出的UI配置, 可不设置, 之后通过 PropsHelper.setConfig 手动设置" }) uiConfig: JsonAsset = null;
|
@property({ displayName: "uiConfig", type: JsonAsset, tooltip: "编辑器导出的UI配置, 可不设置, 之后通过 PropsHelper.setConfig 手动设置" }) uiConfig: JsonAsset = null;
|
||||||
@ -48,7 +49,10 @@ export abstract class CocosEntry extends Component {
|
|||||||
director.addPersistRootNode(this.node);
|
director.addPersistRootNode(this.node);
|
||||||
this.node.setSiblingIndex(this.node.children.length - 1);
|
this.node.setSiblingIndex(this.node.children.length - 1);
|
||||||
PropsHelper.setConfig(this.uiConfig?.json);
|
PropsHelper.setConfig(this.uiConfig?.json);
|
||||||
this.ecConfig && ECManager.registerEntityConfig(this.ecConfig.json);
|
let ecsMaps = _global["getKunpoRegisterECSMaps"]?.();
|
||||||
|
if (this.ecConfig && (!ecsMaps || ecsMaps.size <= 0)) {
|
||||||
|
ECManager.registerEntityConfig(this.ecConfig.json);
|
||||||
|
}
|
||||||
this.initPlatform();
|
this.initPlatform();
|
||||||
this.initEvent();
|
this.initEvent();
|
||||||
this.initTime();
|
this.initTime();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user