This commit is contained in:
2025-06-11 16:54:50 +08:00
parent 4096922e61
commit d06d8fe910
10 changed files with 295 additions and 141 deletions

View File

@@ -16,36 +16,48 @@ export class EquipsComp extends Component {
boxs:Node=null
attrs:any={
hero:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
},
ally:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
},
enemy:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
},
friend:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
}
/** 视图层逻辑代码分离演示 */
@@ -63,13 +75,13 @@ export class EquipsComp extends Component {
this.boxs.getChildByName("armor").getChildByName("icon").active=false
this.boxs.getChildByName("accessory").getChildByName("icon").active=false
this.weapon={
uuid:2001,
uuid:0,
name:"weapon",
type:"weapon",
level:0,
}
this.armor={
uuid:2002,
uuid:0,
name:"armor",
type:"armor",
level:0,
@@ -105,6 +117,7 @@ export class EquipsComp extends Component {
this.accessory.level=data.level
this.show_accessory(data.uuid)
}
this.count_attrs()
}
show_weapon(uuid:number){
let icon = this.node.getChildByName("boxs").getChildByName("weapon").getChildByName("icon")
@@ -154,27 +167,37 @@ export class EquipsComp extends Component {
if (targetKey) {
switch (attr.type) {
case EquipAttr.ATK:
this.attrs[targetKey].ap += attr.value;
break;
case EquipAttr.HP:
this.attrs[targetKey].hp += attr.value;
this.attrs[targetKey].ATK += attr.value;
break;
case EquipAttr.ATK_COUNT:
this.attrs[targetKey].atk_count += attr.value;
this.attrs[targetKey].ATK_COUNT += attr.value;
break;
case EquipAttr.ATK_SPEED:
this.attrs[targetKey].atk_speed += attr.value;
case EquipAttr.ATK_CD:
this.attrs[targetKey].ATK_CD += attr.value;
break;
case EquipAttr.HP:
this.attrs[targetKey].HP += attr.value;
break;
case EquipAttr.DEF:
this.attrs[targetKey].DEF += attr.value;
break;
case EquipAttr.SKILL_DMG:
this.attrs[targetKey].skill_dmg += attr.value;
this.attrs[targetKey].SKILL_DMG += attr.value;
break;
case EquipAttr.SKILL_SPEED:
this.attrs[targetKey].skill_cd += attr.value;
case EquipAttr.SKILL_CD:
this.attrs[targetKey].SKILL_CD += attr.value;
break;
case EquipAttr.CARD_EFFECT:
this.attrs[targetKey].CARD_EFFECT += attr.value;
break;
case EquipAttr.CARD_COUNT:
this.attrs[targetKey].CARD_COUNT += attr.value;
break;
}
}
});
console.log("count_attrs",this.attrs)
oops.message.dispatchEvent(GameEvent.EquipChange,this.attrs)
}
// 重置所有属性为0

View File

@@ -5,40 +5,51 @@ const { ccclass, property } = _decorator;
@ccclass('FightConComp')
export class FightConComp extends Component {
attrs:any={
hero:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
},
ally:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
},
enemy:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
},
friend:{
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
}
hero:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
ally:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
enemy:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
friend:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
onLoad(){
// console.log("fight con start")
oops.message.on(GameEvent.EquipChange,this.equip_change,this)
@@ -46,19 +57,22 @@ export class FightConComp extends Component {
}
equip_change(e:GameEvent,equip:any){
this.attrs.hero=equip.hero
this.attrs.ally=equip.ally
this.attrs.enemy=equip.enemy
this.attrs.friend=equip.friend
this.hero=equip.hero
this.ally=equip.ally
this.enemy=equip.enemy
this.friend=equip.friend
}
fight_ready(e:GameEvent){
this.attrs.hero=this.attrs.ally=this.attrs.enemy=this.attrs.friend={
ap:0,
hp:0,
atk_count:0,
atk_speed:0,
skill_dmg:0,
skill_cd:0,
this.hero=this.ally=this.enemy=this.friend={
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
}