dd
This commit is contained in:
29
assets/script/game/Role/Talent.ts
Normal file
29
assets/script/game/Role/Talent.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { instantiate, Prefab, Vec3 ,Node} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { TalentComp } from "./TalentComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
/** Talent 模块 */
|
||||
@ecs.register(`Talent`)
|
||||
export class Talent extends ecs.Entity {
|
||||
/** ---------- 数据层 ---------- */
|
||||
|
||||
TalentView!: TalentComp
|
||||
|
||||
destroy(): void {
|
||||
this.remove(TalentComp);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,parent:Node) {
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
var path = "game/heros/role";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent = parent;
|
||||
node.setScale(node.scale.x, node.scale.y, node.scale.z);
|
||||
node.setPosition(pos)
|
||||
}
|
||||
}
|
||||
9
assets/script/game/Role/Talent.ts.meta
Normal file
9
assets/script/game/Role/Talent.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "da2ee9b0-de45-487a-8c6b-f3ab67f8ff88",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
29
assets/script/game/Role/TalentComp.ts
Normal file
29
assets/script/game/Role/TalentComp.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('TalentComp')
|
||||
@ecs.register('TalentView', false)
|
||||
export class TalentComp 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/Role/TalentComp.ts.meta
Normal file
9
assets/script/game/Role/TalentComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "91d25bbb-9b90-479f-8e1b-b5624ee56aae",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user