crt 改为crit

This commit is contained in:
2025-06-24 21:08:46 +08:00
parent 4ef2855e49
commit 766c1f8176
12 changed files with 11211 additions and 7154 deletions

View 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('BarBossCompComp')
@ecs.register('BarBossComp', false)
export class BarBossCompComp 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();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "fad26a63-4765-435a-bab6-daf8fa8476e1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,6 +1,11 @@
import { _decorator } from "cc";
import { _decorator, Label, Node, ProgressBar } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";
import { HeroModelComp } from "../hero/HeroModelComp";
import { MasterModelComp } from "../hero/MasterModel";
import { FriendModelComp } from "../hero/FriendModel";
const { ccclass, property } = _decorator;
@@ -8,12 +13,56 @@ const { ccclass, property } = _decorator;
@ccclass('BarCompComp')
@ecs.register('BarComp', false)
export class BarCompComp extends CCComp {
hero_bar:Node = null;
friend_bar:Node = null;
boss_bar:Node = null;
hero:HeroViewComp = null;
friend:HeroViewComp = null;
boss:HeroViewComp = null;
/** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.on(GameEvent.FightReady,this.readay,this)
}
start() {
this.hero_bar = this.node.getChildByName("bar");
this.friend_bar = this.node.getChildByName("fbar");
this.boss_bar = this.node.getChildByName("bar");
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
private readay(){
this.hero_bar.active = this.get_hero()
this.friend_bar.active = this.get_friend()
}
private get_hero(){
let heros = ecs.query(ecs.allOf(MasterModelComp))
if(heros.length > 0){
this.hero = heros[0].get(HeroViewComp)
return true
}else{
this.hero = null
return false
}
}
private get_friend(){
let friend = ecs.query(ecs.allOf(FriendModelComp))
if(friend.length > 0){
this.friend = friend[0].get(HeroViewComp)
return true
}else{
this.friend = null
return false
}
}
update_bar(){
if(!this.get_hero()) return
let hp_bar = this.hero_bar.getChildByName("hp").getChildByName("bar").getComponent(ProgressBar)
let ap_bar = this.hero_bar.getChildByName("ap").getChildByName("val").getComponent(Label)
let ap =this.hero.ap+"("+this.hero.ap_ur+")"
hp_bar.progress = this.hero.hp/this.hero.hp_max
ap_bar.string = ap.toString()
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {

View File

@@ -138,7 +138,7 @@ export class MissionHeroCompComp extends CCComp {
}
get_info_and_remove(fight_pos:number,uuid:number){
let info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false}
let info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false}
let heros=ecs.query(ecs.allOf(FriendModelComp))
if(heros.length>0){
let hero = heros[0]
@@ -146,11 +146,11 @@ export class MissionHeroCompComp extends CCComp {
info.ap=hv.ap
info.hp=hv.hp_max
info.lv=hv.lv
info.crt=hv.crt
info.crt_d=hv.crt_d
info.crit=hv.crit
info.crit_d=hv.crit_d
info.dod=hv.dod
info.dod_no=hv.dod_no
info.crt_no=hv.crt_no
info.crit_no=hv.crit_no
hero.destroy()
return info