属性弹窗++

This commit is contained in:
2025-06-26 10:49:08 +08:00
parent 862777a9c7
commit d31c495a54
7 changed files with 13616 additions and 3918 deletions

View File

@@ -1,6 +1,8 @@
import { _decorator, Label, Node, ProgressBar } from "cc";
import { _decorator, Label, Node, ProgressBar, tween, v3 } 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 { ButtonTouchLong } from "../../../../extensions/oops-plugin-framework/assets/libs/gui/button/ButtonTouchLong";
import { EnhancedButtonTouchLong } from "../common/EnhancedButtonTouchLong";
import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";
import { HeroModelComp } from "../hero/HeroModelComp";
@@ -13,50 +15,70 @@ 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)
this.on(GameEvent.FriendCalled,this.friend_called,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()
this.node.getChildByName("bar").active = true
this.node.getChildByName("fbar").active = false
this.node.getChildByName("bar").getChildByName("more").active=false
this.node.getChildByName("fbar").getChildByName("more").active=false
}
private friend_called(){
this.node.getChildByName("fbar").active=true
}
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
}
show_master_more(){
let barNode = this.node.getChildByName("bar");
let node = barNode.getChildByName("more");
node.active = true;
node.setScale(v3(1, 0, 1));
console.log("[barcomp]:show_master_more",node)
// 使用缓动动画放大和移动
tween(node).to(0.2, {scale:v3(1,1,1)}).start()
}
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
}
hide_master_more(){
let barNode = this.node.getChildByName("bar");
let node = barNode.getChildByName("more");
console.log("[barcomp]:hide_master_more",node)
// 使用缓动动画放大和移动
tween(node).to(0.2, {scale:v3(1,0,1)}).start()
node.active = false;
}
show_friend_more(){
let barNode = this.node.getChildByName("fbar");
let node = barNode.getChildByName("more");
node.active = true;
node.setScale(v3(1, 0, 1));
console.log("[barcomp]:show_friend_more",node)
// 使用缓动动画放大和移动
tween(node).to(0.2, {scale:v3(1,1,1)}).start()
}
hide_friend_more(){
let barNode = this.node.getChildByName("fbar");
let node = barNode.getChildByName("more");
console.log("[barcomp]:hide_friend_more",node)
// 使用缓动动画放大和移动
tween(node).to(0.2, {scale:v3(1,0,1)}).start()
node.active = false;
}
update_bar(){
if(!this.get_hero()) return
}
/** 全局消息逻辑处理 */
@@ -71,4 +93,6 @@ export class BarCompComp extends CCComp {
reset() {
this.node.destroy();
}
}