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()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -311,6 +311,7 @@ export class MissionComp extends CCComp {
|
||||
oops.message.dispatchEvent(GameEvent.LuckCardUsed,card)
|
||||
}
|
||||
show_lucky_gold(card:any){
|
||||
this.node.getChildByName("luckybox").getComponent(Animation).play("luckyopen")
|
||||
var path = "game/gui/lcard";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
@@ -319,11 +320,14 @@ export class MissionComp extends CCComp {
|
||||
node.parent = this.node
|
||||
node.setPosition(v3(this.node.getChildByName("luckybox").position.x,this.node.getChildByName("luckybox").position.y));
|
||||
let height=this.node.getComponent(UITransform).height
|
||||
tween(node) .to(0.5, {
|
||||
tween(node) .to(1, {
|
||||
scale: v3(1,1,1),
|
||||
position: v3(0, height-300),
|
||||
}, {easing:"backOut"})
|
||||
.start();
|
||||
.start();
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("luckybox").getComponent(Animation).play("lucky")
|
||||
},1)
|
||||
}
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
|
||||
|
||||
Reference in New Issue
Block a user