修复bug和ui调整,下一步,达到特定等级才激活技能
This commit is contained in:
@@ -20,6 +20,7 @@ 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)
|
||||
@@ -38,6 +39,7 @@ export class BarCompComp extends CCComp {
|
||||
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
|
||||
@@ -62,9 +64,12 @@ 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(){
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SkillSet } from "../common/config/SkillSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { MissionEvent } from "../common/config/MissionEvent";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -24,6 +25,7 @@ export class EquipSkillComp extends CCComp {
|
||||
onLoad() {
|
||||
this.on(GameEvent.UseSkillCard, this.get_skill, this);
|
||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
this.on(GameEvent.MasterCalled,this.master_called,this)
|
||||
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)
|
||||
@@ -32,6 +34,14 @@ export class EquipSkillComp extends CCComp {
|
||||
start(){
|
||||
this.fight_ready()
|
||||
}
|
||||
private master_called(e:any,data:any){
|
||||
console.log("[EquipSkillComp]: master_called",data)
|
||||
let hero=HeroInfo[data.uuid]
|
||||
if(hero.skills.length>0){
|
||||
this.get_skill(null,{slot:"skill1",uuid:hero.skills[1]})
|
||||
this.get_skill(null,{slot:"skill2",uuid:hero.skills[2]})
|
||||
}
|
||||
}
|
||||
skill_stone_up(e:GameEvent,data:any){
|
||||
console.log("[EquipSkillComp]: skill_stone_up",data)
|
||||
smc.vmdata.mission_data.skill_stone+=data
|
||||
|
||||
@@ -14,10 +14,10 @@ export class EquipsComp extends Component {
|
||||
armor:any=null
|
||||
accessory:any=null
|
||||
boxs:Node=null
|
||||
attrs:any={
|
||||
hero_buff:getBuffNum(),
|
||||
enemy_buff:getBuffNum(),
|
||||
}
|
||||
// attrs:any={
|
||||
// hero_buff:getBuffNum(),
|
||||
// enemy_buff:getBuffNum(),
|
||||
// }
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
onLoad() {
|
||||
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
@@ -28,6 +28,7 @@ export class EquipsComp extends Component {
|
||||
|
||||
}
|
||||
hero_lv_up(e:GameEvent,data:any){
|
||||
console.log("[EquipsComp]:hero_lv_up",data)
|
||||
switch(data.lv){
|
||||
case FightSet.WEAPON_LV:
|
||||
this.show_equip_get("weapon")
|
||||
@@ -83,7 +84,6 @@ export class EquipsComp extends Component {
|
||||
type:"accessory",
|
||||
level:0,
|
||||
}
|
||||
this.count_attrs()
|
||||
}
|
||||
equip_add(e:GameEvent,data:any){
|
||||
console.log("equip_add",data)
|
||||
@@ -159,100 +159,100 @@ export class EquipsComp extends Component {
|
||||
|
||||
|
||||
}
|
||||
count_attrs(){
|
||||
// 重置所有属性
|
||||
this.reset_attrs();
|
||||
console.log("[EquipsComp]:重置后的属性", this.attrs);
|
||||
// count_attrs(){
|
||||
// // 重置所有属性
|
||||
// this.reset_attrs();
|
||||
// console.log("[EquipsComp]:重置后的属性", this.attrs);
|
||||
|
||||
// 获取所有装备的属性
|
||||
let weapon_buffs = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.buff || [] : [];
|
||||
let armor_buffs = this.armor.uuid ? EquipInfo[this.armor.uuid]?.buff || [] : [];
|
||||
let accessory_buffs = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.buff || [] : [];
|
||||
let weapon_special_attr = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.special_attr : [];
|
||||
let armor_special_attr = this.armor.uuid ? EquipInfo[this.armor.uuid]?.special_attr : [];
|
||||
let accessory_special_attr = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.special_attr : [];
|
||||
// // 获取所有装备的属性
|
||||
// let weapon_buffs = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.buff || [] : [];
|
||||
// let armor_buffs = this.armor.uuid ? EquipInfo[this.armor.uuid]?.buff || [] : [];
|
||||
// let accessory_buffs = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.buff || [] : [];
|
||||
// let weapon_special_attr = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.special_attr : [];
|
||||
// let armor_special_attr = this.armor.uuid ? EquipInfo[this.armor.uuid]?.special_attr : [];
|
||||
// let accessory_special_attr = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.special_attr : [];
|
||||
|
||||
console.log("[EquipsComp]:weapon_special_attr", weapon_special_attr);
|
||||
console.log("[EquipsComp]:armor_special_attr", armor_special_attr);
|
||||
console.log("[EquipsComp]:accessory_special_attr", accessory_special_attr);
|
||||
console.log("[EquipsComp]:weapon_buffs", weapon_buffs);
|
||||
console.log("[EquipsComp]:防具属性", armor_buffs);
|
||||
console.log("[EquipsComp]:饰品属性", accessory_buffs);
|
||||
const all_special_attr=[...weapon_special_attr,...armor_special_attr,...accessory_special_attr]
|
||||
// console.log("[EquipsComp]:weapon_special_attr", weapon_special_attr);
|
||||
// console.log("[EquipsComp]:armor_special_attr", armor_special_attr);
|
||||
// console.log("[EquipsComp]:accessory_special_attr", accessory_special_attr);
|
||||
// console.log("[EquipsComp]:weapon_buffs", weapon_buffs);
|
||||
// console.log("[EquipsComp]:防具属性", armor_buffs);
|
||||
// console.log("[EquipsComp]:饰品属性", accessory_buffs);
|
||||
// const all_special_attr=[...weapon_special_attr,...armor_special_attr,...accessory_special_attr]
|
||||
|
||||
let equip_special_attr=this.count_equip_special_attr(all_special_attr)
|
||||
oops.message.dispatchEvent(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,equip_special_attr)
|
||||
// let equip_special_attr=this.count_equip_special_attr(all_special_attr)
|
||||
// oops.message.dispatchEvent(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,equip_special_attr)
|
||||
|
||||
// 合并所有装备属性
|
||||
const allBuff = [...weapon_buffs, ...armor_buffs, ...accessory_buffs];
|
||||
console.log("[EquipsComp]:合并后的所有属性", allBuff);
|
||||
// 计算每个目标的属性加成
|
||||
allBuff.forEach(attr => {
|
||||
const target = attr.target || EquipAttrTarget.HERO;
|
||||
let targetKey = null;
|
||||
// 根据目标类型获取对应的key
|
||||
switch (target) {
|
||||
case EquipAttrTarget.HERO:
|
||||
targetKey = 'hero_buff';
|
||||
break;
|
||||
}
|
||||
this.add_attr(targetKey,attr)
|
||||
});
|
||||
// // 合并所有装备属性
|
||||
// const allBuff = [...weapon_buffs, ...armor_buffs, ...accessory_buffs];
|
||||
// console.log("[EquipsComp]:合并后的所有属性", allBuff);
|
||||
// // 计算每个目标的属性加成
|
||||
// allBuff.forEach(attr => {
|
||||
// const target = attr.target || EquipAttrTarget.HERO;
|
||||
// let targetKey = null;
|
||||
// // 根据目标类型获取对应的key
|
||||
// switch (target) {
|
||||
// case EquipAttrTarget.HERO:
|
||||
// targetKey = 'hero_buff';
|
||||
// break;
|
||||
// }
|
||||
// this.add_attr(targetKey,attr)
|
||||
// });
|
||||
|
||||
console.log("[EquipsComp]:debuff buff attrs ", this.attrs);
|
||||
oops.message.dispatchEvent(GameEvent.EquipChange, this.attrs);
|
||||
}
|
||||
// console.log("[EquipsComp]:debuff buff attrs ", this.attrs);
|
||||
// oops.message.dispatchEvent(GameEvent.EquipChange, this.attrs);
|
||||
// }
|
||||
|
||||
count_equip_special_attr(all_special_attr:any[]){
|
||||
//特殊属性附加 - 直接使用枚举值作为属性名
|
||||
let equip_special_attr = {
|
||||
[EquipSpecialAttr.ICE]: 0,
|
||||
[EquipSpecialAttr.FIRE]: 0,
|
||||
[EquipSpecialAttr.WIND]: 0,
|
||||
[EquipSpecialAttr.ATK_ADD_GLOD]: 0,
|
||||
[EquipSpecialAttr.ATK_ADD_MASTER_ATK]: 0,
|
||||
[EquipSpecialAttr.ATK_ADD_MASTER_HP]: 0,
|
||||
[EquipSpecialAttr.DOUBLE_ATKED]: 0,
|
||||
[EquipSpecialAttr.ATKED_ADD_SKILL_STONE]: 0,
|
||||
[EquipSpecialAttr.ATK_ADD_VALUE]: 0,
|
||||
};
|
||||
// count_equip_special_attr(all_special_attr:any[]){
|
||||
// //特殊属性附加 - 直接使用枚举值作为属性名
|
||||
// let equip_special_attr = {
|
||||
// [EquipSpecialAttr.ICE]: 0,
|
||||
// [EquipSpecialAttr.FIRE]: 0,
|
||||
// [EquipSpecialAttr.WIND]: 0,
|
||||
// [EquipSpecialAttr.ATK_ADD_GLOD]: 0,
|
||||
// [EquipSpecialAttr.ATK_ADD_MASTER_ATK]: 0,
|
||||
// [EquipSpecialAttr.ATK_ADD_MASTER_HP]: 0,
|
||||
// [EquipSpecialAttr.DOUBLE_ATKED]: 0,
|
||||
// [EquipSpecialAttr.ATKED_ADD_SKILL_STONE]: 0,
|
||||
// [EquipSpecialAttr.ATK_ADD_VALUE]: 0,
|
||||
// };
|
||||
|
||||
console.log("[EquipsComp]:all_special_attr",all_special_attr)
|
||||
// console.log("[EquipsComp]:all_special_attr",all_special_attr)
|
||||
|
||||
// 直接使用枚举值累加属性
|
||||
all_special_attr.forEach(special_attr => {
|
||||
if (special_attr && equip_special_attr.hasOwnProperty(special_attr.special_attr)) {
|
||||
equip_special_attr[special_attr.special_attr] += special_attr.special_attr_value;
|
||||
}
|
||||
});
|
||||
// // 直接使用枚举值累加属性
|
||||
// all_special_attr.forEach(special_attr => {
|
||||
// if (special_attr && equip_special_attr.hasOwnProperty(special_attr.special_attr)) {
|
||||
// equip_special_attr[special_attr.special_attr] += special_attr.special_attr_value;
|
||||
// }
|
||||
// });
|
||||
|
||||
console.log("[EquipsComp]:equip_special_attr",equip_special_attr)
|
||||
return equip_special_attr
|
||||
}
|
||||
// console.log("[EquipsComp]:equip_special_attr",equip_special_attr)
|
||||
// return equip_special_attr
|
||||
// }
|
||||
|
||||
|
||||
add_attr(targetKey:string,attr:any){
|
||||
if(targetKey){
|
||||
this.attrs[targetKey][BuffAttr[attr.type]] += attr.value;
|
||||
}
|
||||
}
|
||||
// add_attr(targetKey:string,attr:any){
|
||||
// if(targetKey){
|
||||
// this.attrs[targetKey][BuffAttr[attr.type]] += attr.value;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// 重置所有属性为0
|
||||
private reset_attrs() {
|
||||
// 创建新的属性对象
|
||||
const newAttrs = {
|
||||
hero_buff: getBuffNum(),
|
||||
enemy_buff: getBuffNum(),
|
||||
};
|
||||
// const newAttrs = {
|
||||
// hero_buff: getBuffNum(),
|
||||
// enemy_buff: getBuffNum(),
|
||||
// };
|
||||
|
||||
// 替换整个 attrs 对象
|
||||
this.attrs = newAttrs;
|
||||
// // 替换整个 attrs 对象
|
||||
// this.attrs = newAttrs;
|
||||
|
||||
console.log("重置属性", {
|
||||
hero_buff: this.attrs.hero_buff,
|
||||
enemy_buff: this.attrs.enemy_buff,
|
||||
});
|
||||
// console.log("重置属性", {
|
||||
// hero_buff: this.attrs.hero_buff,
|
||||
// enemy_buff: this.attrs.enemy_buff,
|
||||
// });
|
||||
}
|
||||
|
||||
equip_remove(e:GameEvent,data:any){
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { MSCardComp } from "./MSCardComp";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
|
||||
/** MSCard 模块 */
|
||||
@ecs.register(`MSCard`)
|
||||
export class MSCard extends ecs.Entity {
|
||||
|
||||
|
||||
/** 实始添加的数据层组件 */
|
||||
protected init() {
|
||||
// this.addComponents<ecs.Comp>();
|
||||
}
|
||||
load(uuid:number=1001,parent:any,zone:number=0) {
|
||||
var path = "game/gui/MSCard";
|
||||
var icon_path = "game/heros/cards"
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
console.log("load_hcard",prefab)
|
||||
var node = instantiate(prefab);
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
|
||||
});
|
||||
|
||||
node.getChildByName("name").getComponent(Label).string = SkillSet[uuid].name
|
||||
|
||||
node.parent = parent
|
||||
var msc = node.getComponent(MSCardComp)!;
|
||||
msc.s_uuid= uuid
|
||||
msc.update_data()
|
||||
if(zone==1) {msc.is_update=true }else{msc.is_update=false}
|
||||
if(zone==2) {msc.is_select=true}else{msc.is_select=false}
|
||||
this.add(msc)
|
||||
}
|
||||
/** 模块资源释放 */
|
||||
destroy() {
|
||||
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b808913f-7dc0-4dbf-9e74-12b5338a39ee",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import { _decorator, Label } 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 { smc } from "../common/SingletonModuleComp";
|
||||
import { MissionHomeComp } from "./MissionHomeComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { SChipComp } from "../hero/SChipComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MSCardComp')
|
||||
@ecs.register('MSCardComp', false)
|
||||
export class MSCardComp extends CCComp {
|
||||
mhc:MissionHomeComp
|
||||
s_uuid: number = 0;
|
||||
is_update: boolean = false;
|
||||
is_select: boolean = false;
|
||||
is_selected: boolean = false;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
oops.message.on(GameEvent.MSSelected, this.update_select, this);
|
||||
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
|
||||
this.change()
|
||||
}
|
||||
change_set(){
|
||||
this.is_update=!this.is_update
|
||||
this.is_select=!this.is_select
|
||||
this.change()
|
||||
}
|
||||
change(){
|
||||
if(this.is_update){
|
||||
this.node.getChildByName("update").active=true
|
||||
}else{
|
||||
this.node.getChildByName("update").active=false
|
||||
}
|
||||
|
||||
if(this.is_select){
|
||||
this.node.getChildByName("set").active=true
|
||||
this.update_select()
|
||||
}else{
|
||||
this.node.getChildByName("set").active=false
|
||||
}
|
||||
}
|
||||
update_data(){
|
||||
|
||||
}
|
||||
select(){
|
||||
smc.mission.mskill=this.s_uuid
|
||||
|
||||
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
|
||||
}
|
||||
update_select(){
|
||||
console.log("update_select",smc.mission.mskill,this.s_uuid)
|
||||
if(smc.mission.mskill ==this.s_uuid){
|
||||
this.node.getChildByName("set").getChildByName("btn").active=false
|
||||
}else{
|
||||
this.node.getChildByName("set").getChildByName("btn").active=true
|
||||
}
|
||||
}
|
||||
update_lv(){
|
||||
|
||||
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
|
||||
for(let i=0;i<mscards.length;i++){
|
||||
mscards[i].MSCardComp.update_data()
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f7a30834-31c8-405a-9f9d-70555981d611",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user