ui添加
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator, resources, Sprite, SpriteAtlas ,Node, ProgressBar, tween, v3, Label} from "cc";
|
||||
import { _decorator, resources, Sprite, SpriteAtlas ,Node, ProgressBar, tween, v3, Label, Animation} 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";
|
||||
@@ -19,6 +19,7 @@ export class EquipSkillComp extends CCComp {
|
||||
boxs:Node=null
|
||||
skill1_cd_bar_progress:any=null
|
||||
skill2_cd_bar_progress:any=null
|
||||
max_show:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
onLoad() {
|
||||
this.on(GameEvent.UseSkillCard, this.get_skill, this);
|
||||
@@ -88,12 +89,23 @@ export class EquipSkillComp extends CCComp {
|
||||
}
|
||||
this.skill1_cd_bar_progress.progress=(1-this.skill1.cd_time/cd)
|
||||
}
|
||||
if(this.skill2.uuid!=0&&smc.vmdata.hero.power>=smc.vmdata.hero.power_max){
|
||||
this.do_skill2()
|
||||
smc.vmdata.hero.power=0
|
||||
if(this.skill2.uuid!=0&&smc.vmdata.hero.power>=smc.vmdata.hero.power_max&&!this.max_show){
|
||||
this.show_max()
|
||||
this.max_show=true
|
||||
}
|
||||
|
||||
}
|
||||
show_max(){
|
||||
|
||||
this.boxs.getChildByName("skill2").getChildByName("light").active=true
|
||||
this.boxs.getChildByName("skill2").getComponent(Animation).play()
|
||||
}
|
||||
hide_max(){
|
||||
this.max_show=false
|
||||
this.boxs.getChildByName("skill2").getChildByName("light").active=false
|
||||
this.boxs.getChildByName("skill2").setScale(1,1,1)
|
||||
this.boxs.getChildByName("skill2").getComponent(Animation).stop()
|
||||
}
|
||||
do_skill1(){
|
||||
console.log("do_skill1")
|
||||
this.skill1.cd_time=0
|
||||
@@ -104,11 +116,14 @@ export class EquipSkillComp extends CCComp {
|
||||
}
|
||||
|
||||
do_skill2(){
|
||||
if(smc.vmdata.hero.power<smc.vmdata.hero.power_max) return
|
||||
console.log("do_skill2")
|
||||
tween(this.boxs.getChildByName("skill2")).to(0.1, {scale:v3(1.2,1.2,1)},{onComplete:()=>{
|
||||
tween(this.boxs.getChildByName("skill2")).to(0.1, {scale:v3(1.5,1.5,1)},{onComplete:()=>{
|
||||
tween(this.boxs.getChildByName("skill2")).to(0.2, {scale:v3(1,1,1)}).start()
|
||||
}}).start()
|
||||
this.do_skill(this.skill2.uuid)
|
||||
smc.vmdata.hero.power=0
|
||||
this.hide_max()
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user