假期修改
This commit is contained in:
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { MapViewScene } from "./view/MapViewScene";
|
||||
import { CSkill } from "../skills/CSkill";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -18,6 +18,7 @@ export class MapSkillComp extends CCComp {
|
||||
oops.message.on("monster_load", this.doMonsterLoad, this);
|
||||
oops.message.on("hero_load", this.doHeroLoad, this);
|
||||
oops.message.on("do_use_skill", this.doSkill, this);
|
||||
oops.message.on("do_use_item", this.useItem, this);
|
||||
}
|
||||
doSkill(event: string, args: any){
|
||||
this.addCSkill(args.uuid);
|
||||
@@ -26,14 +27,7 @@ export class MapSkillComp extends CCComp {
|
||||
|
||||
}
|
||||
addCSkill(uuid:number=1001,args:any=null){
|
||||
let csk =ecs.getEntity<CSkill>(CSkill);
|
||||
let scale = 1
|
||||
let pos = v3(BoxSet.CSKILL_X*-scale,BoxSet.CSKILL_Y)
|
||||
if(args){
|
||||
pos = v3(args.x,args.y)
|
||||
scale = args.scale
|
||||
}
|
||||
csk.load(pos,scale,uuid);
|
||||
|
||||
}
|
||||
doMonsterLoad(){
|
||||
const light = instantiate(this.light);
|
||||
@@ -45,6 +39,18 @@ export class MapSkillComp extends CCComp {
|
||||
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||
this.node.addChild(light);
|
||||
}
|
||||
useItem(event: string, args: any){
|
||||
console.log("useItem");
|
||||
if(smc.items[args.uuid].hp > 0){ //buff加血
|
||||
smc.Role.RoleView.add_hp(smc.items[args.uuid].hp)
|
||||
}
|
||||
if(smc.items[args.uuid].atk > 0){ //buff加攻击
|
||||
smc.Role.RoleView.add_atk(smc.items[args.uuid].atk,smc.items[args.uuid].sd)
|
||||
}
|
||||
if(smc.items[args.uuid].shield > 0){ //buff护盾
|
||||
smc.Role.RoleView.add_shield(smc.items[args.uuid].shield,smc.items[args.uuid].sd)
|
||||
}
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
|
||||
Reference in New Issue
Block a user