优化了 飘字和名称修改

This commit is contained in:
2025-01-21 22:54:44 +08:00
parent 34039c3ca7
commit 2893050463
10 changed files with 3580 additions and 1160 deletions

View File

@@ -20,7 +20,7 @@ export class TooltipCom extends CCComp {
stype:number = 1; // 1:减少生命值2增加生命值3技能图标
value:string = "";
s_uuid:number = 1001;
alive_time:number = 0.2;
alive_time:number = 0.3;
skill_name_time=0.5;
scale:number = 1;
start() {
@@ -29,68 +29,41 @@ export class TooltipCom extends CCComp {
this.node.setSiblingIndex(1);
this.node.getChildByName("loss_life").getChildByName("hp").getComponent(Label).string = this.value;
this.node.getChildByName("loss_life").active=true;
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y+40), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
this.scheduleOnce(()=>{
this.ent.destroy()
},0.5)
break
case 2:
this.node.setSiblingIndex(1);
this.node.getChildByName("add_life").getChildByName("hp").getComponent(Label).string = this.value;
this.node.getChildByName("add_life").active=true;
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y+40), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
this.scheduleOnce(()=>{
this.ent.destroy()
},0.5)
break
case 4:
this.node.setSiblingIndex(2);
this.node.getChildByName("bloss").getChildByName("hp").getComponent(Label).string = this.value;
this.node.getChildByName("bloss").active=true;
this.scheduleOnce(()=>{
this.ent.destroy()
},0.5)
break
case 3:
this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = "<"+SkillSet[this.s_uuid].name+">";
this.node.getChildByName("skill").active=true;
this.node.setPosition(v3(this.node.position.x,this.node.position.y+60))
// this.alive_time = 2
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
this.node.setPosition(v3(this.node.position.x,this.node.position.y+30))
this.scheduleOnce(()=>{
this.ent.destroy()
},0.5)
break
case 4:
this.node.setSiblingIndex(1);
this.node.getChildByName("bloss").getChildByName("hp").getComponent(Label).string = this.value;
this.node.getChildByName("bloss").active=true;
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y+40), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
break
case 5:
this.node.getChildByName("uskill").getChildByName("name").getComponent(Label).string = this.value;
this.node.getChildByName("uskill").active=true;
this.node.setPosition(v3(this.node.position.x,this.node.position.y+60))
// this.alive_time = 2
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
this.node.setPosition(v3(this.node.position.x,this.node.position.y+30))
this.scheduleOnce(()=>{
this.ent.destroy()
},0.5)
break
}
console.log("TooltipView start:",this.node.getSiblingIndex());
@@ -98,10 +71,21 @@ export class TooltipCom extends CCComp {
}
update(deltaTime: number) {
}
do_up(){
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y+60), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
}
to_destroy() {
this.ent.destroy()
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();

View File

@@ -9,7 +9,7 @@ import { smc } from '../common/SingletonModuleComp';
import { HeroInfo } from '../common/config/heroSet';
import { oops } from 'db://oops-framework/core/Oops';
const { ccclass, property } = _decorator;
//这是召唤技能
@ccclass('ZhanCom')
export class ZhanCom extends Component {
base:SkillCom = null