稍微改了点

This commit is contained in:
2025-07-25 09:55:08 +08:00
parent a5a0c26e8f
commit 0ba25c1cac
11 changed files with 32118 additions and 20509 deletions

View File

@@ -20,14 +20,12 @@ export class BarCompComp extends CCComp {
hero:HeroViewComp = null;
friend:HeroViewComp = null;
boss:HeroViewComp = null;
update_count:number=0
/** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.on(GameEvent.FightReady,this.readay,this)
this.on(GameEvent.MasterCalled,this.master_called,this)
this.on(GameEvent.APChange,this.ap_change,this)
this.on(GameEvent.CanUpdateLv,this.show_uplv_button,this)
this.on(GameEvent.UseEnhancement,this.hide_uplv_button,this)
}
start() {
@@ -38,8 +36,6 @@ export class BarCompComp extends CCComp {
private readay(){
this.node.getChildByName("bar").active = true
this.node.getChildByName("bar").getChildByName("more").active=false
this.node.getChildByName("bar").getChildByName("uplv").active=false
this.update_count=0
}
private master_called(e:any,data:any){
this.node.getChildByName("bar").active = true
@@ -63,15 +59,7 @@ export class BarCompComp extends CCComp {
}
}
show_uplv_button(){
this.update_count++
this.node.getChildByName("bar").getChildByName("uplv").active=true
}
hide_uplv_button(){
this.update_count--
if(this.update_count > 0) return
this.node.getChildByName("bar").getChildByName("uplv").active=false
}
show_master_more(){
let barNode = this.node.getChildByName("bar");
let node = barNode.getChildByName("more");

View File

@@ -2,7 +2,7 @@ import { _decorator, resources, Sprite, SpriteAtlas ,Node, ProgressBar, tween, v
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 { SkillSet } from "../common/config/SkillSet";
import { CdType, SkillSet } from "../common/config/SkillSet";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "db://oops-framework/core/Oops";
import { MissionEvent } from "../common/config/MissionEvent";
@@ -19,7 +19,6 @@ export class EquipSkillComp extends CCComp {
boxs:Node=null
skill1_cd_bar_progress:any=null
skill2_cd_bar_progress:any=null
skill3_cd_bar_progress:any=null
/** 视图层逻辑代码分离演示 */
onLoad() {
this.on(GameEvent.UseSkillCard, this.get_skill, this);
@@ -28,6 +27,7 @@ export class EquipSkillComp extends CCComp {
this.boxs=this.node.getChildByName("boxs")
this.skill1_cd_bar_progress=this.boxs.getChildByName("skill1").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
this.skill2_cd_bar_progress=this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd").active=false
}
start(){
this.fight_ready()
@@ -118,7 +118,7 @@ export class EquipSkillComp extends CCComp {
}
get_skill(e:GameEvent,data:any){
console.log("get_skill",data)
// console.log("get_skill",data)
switch(data.slot){
case "skill1":
this.skill1.uuid=data.uuid
@@ -128,6 +128,9 @@ export class EquipSkillComp extends CCComp {
this.skill1.cd_time=SkillSet[data.uuid].cd
let icon1 = this.boxs.getChildByName("skill1").getChildByName("icon")
icon1.active=true
if(SkillSet[data.uuid].CdType!=CdType.cd){
icon1.getChildByName("cd").active=false
}
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon1.getChildByName("skill").getComponent(Sprite);

View File

@@ -26,12 +26,15 @@ export class MissionComp extends CCComp {
normal_max_wave:number = 10;
is_fight:boolean = false;
enhancements:any=[0,0,0,0,0]
update_count:number = 0;
onLoad(){
this.on(GameEvent.MissionStart,this.mission_start,this)
this.on(GameEvent.FightEnd,this.fight_end,this)
this.on(GameEvent.MissionEnd,this.mission_end,this)
// this.on(GameEvent.CardsClose,this.after_used_skill_card,this)
this.on(GameEvent.WaveUpdate,this.on_mon_wave_update,this)
this.on(GameEvent.CanUpdateLv,this.show_uplv_button,this)
this.on(GameEvent.UseEnhancement,this.hide_uplv_button,this)
}
@@ -47,6 +50,7 @@ export class MissionComp extends CCComp {
}
}
private on_mon_wave_update(){
smc.vmdata.mission_data.current_wave++
let wave=smc.vmdata.mission_data.current_wave
@@ -69,6 +73,15 @@ export class MissionComp extends CCComp {
to_ready(){
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:true})
}
show_uplv_button(){
this.update_count++
this.node.getChildByName("uplv").active=true
}
hide_uplv_button(){
this.update_count--
if(this.update_count > 0) return
this.node.getChildByName("uplv").active=false
}
to_uplv(){
oops.message.dispatchEvent(GameEvent.EnhancementSelect)
}
@@ -107,6 +120,7 @@ export class MissionComp extends CCComp {
smc.vmdata.mission_data = JSON.parse(JSON.stringify(MissionData));
smc.vmdata.hero = JSON.parse(JSON.stringify(VmInfo));
smc.vmdata.boss = JSON.parse(JSON.stringify(VmInfo));
this.update_count=0
this.GlodAddTimer=new Timer(smc.vmdata.mission_data.refrsh_time)
smc.enhancements=defaultEnhancements()
console.log("局内数据初始化",smc.enhancements,defaultEnhancements())