This commit is contained in:
2024-08-15 20:07:21 +08:00
parent a050207f54
commit c67a149620
10 changed files with 574 additions and 467 deletions

View File

@@ -5,6 +5,7 @@ import { data } from "../data/data";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { CardSet } from "../common/config/CardSet";
import { HeroCard } from "./HeroCard";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -30,19 +31,35 @@ export class HeroCardViewComp extends CCComp {
if(this.ent.eid != args.eid){
this.no_active()
}
}
do_active(){
}
do_active(){
// console.log(this.node.getChildByName("active"),this.node.getChildByName("use"), this.node.getChildByName("bag"))
let active = this.node.getChildByName("active")
let use = this.node.getChildByName("use")
let bag = this.node.getChildByName("bag")
active.active = !active.active
use.active = !use.active
bag.active = !bag.active
}
no_active(){
// this.node.getChildByName("active").active=false;
// this.node.getChildByName("use").active=false;
// this.node.getChildByName("bag").active=false;
let active = this.node.getChildByName("active")
let use = this.node.getChildByName("use")
let bag = this.node.getChildByName("bag")
active.active = false
use.active = false
bag.active = false
}
doit(){
// this.do_active()
console.log("doit",this.ent)
smc.vm_data.cards.eid = this.ent.eid;
this.do_active()
let hero_cards = ecs.query(ecs.allOf(HeroCardViewComp))
hero_cards.forEach(element => {
if(element.eid != this.ent.eid)
element.get(HeroCardViewComp).no_active()
});
// console.log("doit",hero_cards)
// oops.message.dispatchEvent("active_card_eid",{eid:this.ent.eid})
}

View File

@@ -247,7 +247,7 @@ export class MonsterViewComp extends CCComp {
load_skill(skill_name){
// console.log("load_skill");
let skill = ecs.getEntity<Skill>(Skill);
let pos = v3(0,0)
let pos = v3(0,30)
let speed =150
let scale = this.camp
let range = 80

View File

@@ -32,7 +32,9 @@ export class Skill extends ecs.Entity {
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = parent;
node.setScale(scale,1)
node.setPosition(pos)
var sv = node.getComponent(SkillCom)!;
sv.speed = speed;
sv.range = range;

View File

@@ -20,6 +20,7 @@ export class SkillCom extends CCComp {
atk:number = 10;
is_destroy:boolean = false;
start() {
this.node.active=true
let collider = this.getComponent(Collider2D);
if (collider) {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);