dd
This commit is contained in:
34
assets/script/game/hero/Aheros/Module-001.ts
Normal file
34
assets/script/game/hero/Aheros/Module-001.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
|
||||
/** Module_001 模块 */
|
||||
@ecs.register(`Module_001`)
|
||||
export class Module_001 extends ecs.Entity {
|
||||
/** ---------- 数据层 ---------- */
|
||||
// Module_001Model!: Module_001ModelComp;
|
||||
|
||||
/** ---------- 业务层 ---------- */
|
||||
// Module_001Bll!: Module_001BllComp;
|
||||
|
||||
/** ---------- 视图层 ---------- */
|
||||
// Module_001View!: Module_001ViewComp;
|
||||
|
||||
/** 实始添加的数据层组件 */
|
||||
protected init() {
|
||||
// this.addComponents<ecs.Comp>();
|
||||
}
|
||||
|
||||
/** 模块资源释放 */
|
||||
destroy() {
|
||||
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/** Module_001 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
|
||||
export class EcsModule_001System extends ecs.System {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// this.add(new ecs.ComblockSystem());
|
||||
}
|
||||
}
|
||||
9
assets/script/game/hero/Aheros/Module-001.ts.meta
Normal file
9
assets/script/game/hero/Aheros/Module-001.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f3b2b36f-bb80-4a29-9ff9-99b0d95dfd64",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
24
assets/script/game/hero/Aheros/ModuleBll.ts
Normal file
24
assets/script/game/hero/Aheros/ModuleBll.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
|
||||
/** 业务层对象 */
|
||||
@ecs.register('ModuleBll')
|
||||
export class ModuleBllComp extends ecs.Comp {
|
||||
/** 业务层组件移除时,重置所有数据为默认值 */
|
||||
reset() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** 业务层业务逻辑处理对象 */
|
||||
export class ModuleBllSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(ModuleBllComp);
|
||||
}
|
||||
|
||||
entityEnter(e: ecs.Entity): void {
|
||||
// 注:自定义业务逻辑
|
||||
|
||||
|
||||
e.remove(ModuleBllComp);
|
||||
}
|
||||
}
|
||||
9
assets/script/game/hero/Aheros/ModuleBll.ts.meta
Normal file
9
assets/script/game/hero/Aheros/ModuleBll.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "14d41483-d32e-4fd4-8942-ef879316a4bc",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
26
assets/script/game/hero/Aheros/ModuleModel.ts
Normal file
26
assets/script/game/hero/Aheros/ModuleModel.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { VM } from "../../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
|
||||
|
||||
/** 数据层对象 */
|
||||
@ecs.register('ModuleModel')
|
||||
export class ModuleModelComp extends ecs.Comp {
|
||||
/** 提供 MVVM 组件使用的数据 */
|
||||
private vm: any = {};
|
||||
|
||||
/** 显示数据添加到 MVVM 框架中监视 */
|
||||
vmAdd() {
|
||||
VM.add(this.vm, "ModuleModel");
|
||||
}
|
||||
|
||||
/** 显示数据从 MVVM 框架中移除 */
|
||||
vmRemove() {
|
||||
VM.remove("ModuleModel");
|
||||
}
|
||||
|
||||
/** 数据层组件移除时,重置所有数据为默认值 */
|
||||
reset() {
|
||||
for (var key in this.vm) {
|
||||
delete this.vm[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
9
assets/script/game/hero/Aheros/ModuleModel.ts.meta
Normal file
9
assets/script/game/hero/Aheros/ModuleModel.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f90b89ec-548a-42cd-87c0-a65863491af3",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
23
assets/script/game/hero/Aheros/ModuleTable.ts
Normal file
23
assets/script/game/hero/Aheros/ModuleTable.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { JsonUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/JsonUtil";
|
||||
|
||||
/** 策划 Excel 导出的 Json 静态数据 */
|
||||
export class ModuleTable {
|
||||
static TableName: string = "配置表文件名";
|
||||
|
||||
/** 静态表中一条数据 */
|
||||
private data: any;
|
||||
|
||||
init(id: number) {
|
||||
var table = JsonUtil.get(ModuleTable.TableName);
|
||||
this.data = table[id];
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 数据唯一编号 */
|
||||
id: number = 0;
|
||||
|
||||
/** 数据 */
|
||||
// get test(): number {
|
||||
// return this.data.test;
|
||||
// }
|
||||
}
|
||||
9
assets/script/game/hero/Aheros/ModuleTable.ts.meta
Normal file
9
assets/script/game/hero/Aheros/ModuleTable.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "60c52974-9781-4174-80c1-ee4aff34a504",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
29
assets/script/game/hero/Aheros/ModuleView.ts
Normal file
29
assets/script/game/hero/Aheros/ModuleView.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { _decorator } from "cc";
|
||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('ModuleViewComp')
|
||||
@ecs.register('ModuleView', false)
|
||||
export class ModuleViewComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
}
|
||||
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/hero/Aheros/ModuleView.ts.meta
Normal file
9
assets/script/game/hero/Aheros/ModuleView.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "3d3a257d-5259-434a-bfa3-6af80203fad2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user