chore: 清理未使用的组件文件及更新预制体引用
- 删除多个未使用的组件文件及其meta文件,包括HeroAttrsSystem.ts、TalComp.ts、MGetComp.ts、HInfoComp.ts、SCDSystem.ts、HeroSkills.ts、MissionCardComp.ts、MissionGetsComp.ts、TalSet.ts、CardSet.ts - 新增SCastSystem.ts组件文件 - 更新角色控制器预制体结构,修复节点引用问题 - 移除无效的组件绑定,优化界面节点层次结构
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.50",
|
|
||||||
"importer": "prefab",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "d63b992b-cdaf-4e5a-8472-866c0038857a",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"syncNodeName": "get"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
"ver": "4.0.24",
|
"ver": "4.0.24",
|
||||||
"importer": "typescript",
|
"importer": "typescript",
|
||||||
"imported": true,
|
"imported": true,
|
||||||
"uuid": "7ddd121f-1918-4eed-ad9b-ebaa2fe5b606",
|
"uuid": "ed36ef97-521c-4570-ba81-b6ec2e6b6eeb",
|
||||||
"files": [],
|
"files": [],
|
||||||
"subMetas": {},
|
"subMetas": {},
|
||||||
"userData": {}
|
"userData": {}
|
||||||
@@ -99,13 +99,9 @@ export class HInfoComp extends CCComp {
|
|||||||
this.type_node.getComponent(Label).string=HTypeName[HeroInfo[uuid].type]
|
this.type_node.getComponent(Label).string=HTypeName[HeroInfo[uuid].type]
|
||||||
this.ap_node.getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString()
|
this.ap_node.getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString()
|
||||||
this.hp_node.getChildByName("num").getComponent(Label).string=HeroInfo[uuid].hp.toString()
|
this.hp_node.getChildByName("num").getComponent(Label).string=HeroInfo[uuid].hp.toString()
|
||||||
this.def_node.getChildByName("num").getComponent(Label).string=HeroInfo[uuid].def.toString()
|
|
||||||
this.mp_node.getChildByName("num").getComponent(Label).string=HeroInfo[uuid].mp.toString()
|
|
||||||
let bar_num=getPreAttr(uuid)
|
let bar_num=getPreAttr(uuid)
|
||||||
this.ap_node.getChildByName("bar").getComponent(ProgressBar).progress=bar_num.ap
|
this.ap_node.getChildByName("bar").getComponent(ProgressBar).progress=bar_num.ap
|
||||||
this.hp_node.getChildByName("bar").getComponent(ProgressBar).progress=bar_num.hp
|
this.hp_node.getChildByName("bar").getComponent(ProgressBar).progress=bar_num.hp
|
||||||
this.def_node.getChildByName("bar").getComponent(ProgressBar).progress=bar_num.def
|
|
||||||
this.mp_node.getChildByName("bar").getComponent(ProgressBar).progress=bar_num.mp
|
|
||||||
|
|
||||||
// 更新技能图标
|
// 更新技能图标
|
||||||
this.updateSkillIcon(this.skill1_node, skill1.icon);
|
this.updateSkillIcon(this.skill1_node, skill1.icon);
|
||||||
@@ -255,7 +251,6 @@ export class HInfoComp extends CCComp {
|
|||||||
|
|
||||||
// 更新数据
|
// 更新数据
|
||||||
this.h_uuid = nextHero;
|
this.h_uuid = nextHero;
|
||||||
smc.updateFihgtHero(nextHero)
|
|
||||||
this.update_data(nextHero);
|
this.update_data(nextHero);
|
||||||
// 执行平滑移动动画
|
// 执行平滑移动动画
|
||||||
this.moveHeroesRight();
|
this.moveHeroesRight();
|
||||||
@@ -275,7 +270,6 @@ export class HInfoComp extends CCComp {
|
|||||||
|
|
||||||
// 更新数据
|
// 更新数据
|
||||||
this.h_uuid = prevHero;
|
this.h_uuid = prevHero;
|
||||||
smc.updateFihgtHero(prevHero)
|
|
||||||
this.update_data(prevHero);
|
this.update_data(prevHero);
|
||||||
// 执行平滑移动动画
|
// 执行平滑移动动画
|
||||||
this.moveHeroesLeft();
|
this.moveHeroesLeft();
|
||||||
@@ -304,11 +298,7 @@ export class HInfoComp extends CCComp {
|
|||||||
this.show_lock()
|
this.show_lock()
|
||||||
this.close_buy()
|
this.close_buy()
|
||||||
}
|
}
|
||||||
start_mission() {
|
|
||||||
mLogger.log(this.debugMode, 'HInfoComp', "start_mission")
|
|
||||||
oops.message.dispatchEvent(GameEvent.MissionStart, {})
|
|
||||||
this.node.active=false;
|
|
||||||
}
|
|
||||||
moveHeroesLeft() {
|
moveHeroesLeft() {
|
||||||
// 取消前一个待处理的异步操作
|
// 取消前一个待处理的异步操作
|
||||||
if (this.moveTimeoutId !== null) {
|
if (this.moveTimeoutId !== null) {
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
import { _decorator, Node, 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/** 视图层对象 */
|
|
||||||
@ccclass('MGetsCompComp')
|
|
||||||
@ecs.register('MGetsComp', false)
|
|
||||||
export class MGetsCompComp extends CCComp {
|
|
||||||
get_uuid:number=0;
|
|
||||||
get_num:number=0;
|
|
||||||
start() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
onDestroy() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
||||||
reset() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,14 +6,8 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
|||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { CardType, FightSet, CardKind } from "../common/config/GameSet";
|
import { CardType, FightSet, CardKind } from "../common/config/GameSet";
|
||||||
import { getCardOptions, ICardInfo } from "../common/config/CardSet";
|
|
||||||
import { TalComp } from "../hero/TalComp";
|
|
||||||
import { HeroSkillsComp } from "../hero/HeroSkills";
|
|
||||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||||
import { BuffConf } from "../common/config/SkillSet";
|
|
||||||
import { BType } from "../common/config/HeroAttrs";
|
|
||||||
import { AttrCards, PotionCards } from "../common/config/AttrSet";
|
|
||||||
import { AttrsType } from "../common/config/HeroAttrs";
|
|
||||||
|
|
||||||
import { HeroMasterComp } from "../hero/HeroMasterComp";
|
import { HeroMasterComp } from "../hero/HeroMasterComp";
|
||||||
|
|
||||||
@@ -49,10 +43,10 @@ export class MissionCardComp extends CCComp {
|
|||||||
@property(Node)
|
@property(Node)
|
||||||
noStop: Node = null!
|
noStop: Node = null!
|
||||||
|
|
||||||
card1_data: ICardInfo = null!
|
// card1_data: ICardInfo = null!
|
||||||
card2_data: ICardInfo = null!
|
// card2_data: ICardInfo = null!
|
||||||
card3_data: ICardInfo = null!
|
// card3_data: ICardInfo = null!
|
||||||
card4_data: ICardInfo = null!
|
// card4_data: ICardInfo = null!
|
||||||
|
|
||||||
// 当前卡片类型 (用于特殊获取模式)
|
// 当前卡片类型 (用于特殊获取模式)
|
||||||
curCardType: CardType | null = null;
|
curCardType: CardType | null = null;
|
||||||
@@ -271,22 +265,22 @@ export class MissionCardComp extends CCComp {
|
|||||||
|
|
||||||
// 使用 CardSet 的 getCardOptions 获取卡牌
|
// 使用 CardSet 的 getCardOptions 获取卡牌
|
||||||
// 这里我们要获取 4 张卡牌
|
// 这里我们要获取 4 张卡牌
|
||||||
const options = getCardOptions(level, 4, [], forcedType, preferredAttrs);
|
// const options = getCardOptions(level, 4, [], forcedType, preferredAttrs);
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 获取到的卡牌选项: ${JSON.stringify(options)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 获取到的卡牌选项: ${JSON.stringify(options)}`);
|
||||||
// 更新卡片数据
|
// // 更新卡片数据
|
||||||
if (options.length > 0) this.updateCardData(1, options[0]);
|
// if (options.length > 0) this.updateCardData(1, options[0]);
|
||||||
if (options.length > 1) this.updateCardData(2, options[1]);
|
// if (options.length > 1) this.updateCardData(2, options[1]);
|
||||||
if (options.length > 2) this.updateCardData(3, options[2]);
|
// if (options.length > 2) this.updateCardData(3, options[2]);
|
||||||
if (options.length > 3) this.updateCardData(4, options[3]);
|
// if (options.length > 3) this.updateCardData(4, options[3]);
|
||||||
|
|
||||||
// 如果获取不足4张,隐藏多余的卡片节点 (UI可能需要处理空数据)
|
// // 如果获取不足4张,隐藏多余的卡片节点 (UI可能需要处理空数据)
|
||||||
if (options.length < 4 && this.card4) this.card4.active = false;
|
// if (options.length < 4 && this.card4) this.card4.active = false;
|
||||||
if (options.length < 3 && this.card3) this.card3.active = false;
|
// if (options.length < 3 && this.card3) this.card3.active = false;
|
||||||
if (options.length < 2 && this.card2) this.card2.active = false;
|
// if (options.length < 2 && this.card2) this.card2.active = false;
|
||||||
if (options.length < 1 && this.card1) this.card1.active = false;
|
// if (options.length < 1 && this.card1) this.card1.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCardInfo(card:Node, data: ICardInfo){
|
updateCardInfo(card:Node, data: any){
|
||||||
if(!card) return
|
if(!card) return
|
||||||
card.active = true;
|
card.active = true;
|
||||||
// 隐藏选中状态
|
// 隐藏选中状态
|
||||||
@@ -405,7 +399,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCardData(index: number, data: ICardInfo) {
|
updateCardData(index: number, data: any) {
|
||||||
// 使用动态属性访问
|
// 使用动态属性访问
|
||||||
(this as any)[`card${index}_data`] = data;
|
(this as any)[`card${index}_data`] = data;
|
||||||
this.updateCardInfo((this as any)[`card${index}`], data);
|
this.updateCardInfo((this as any)[`card${index}`], data);
|
||||||
@@ -418,7 +412,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
if (this.hasSelected) return;
|
if (this.hasSelected) return;
|
||||||
|
|
||||||
// 动态获取数据和节点
|
// 动态获取数据和节点
|
||||||
let selectedData: ICardInfo = (this as any)[`card${_index}_data`];
|
let selectedData: any;
|
||||||
let selectedCardNode: Node | null = (this as any)[`card${_index}`];
|
let selectedCardNode: Node | null = (this as any)[`card${_index}`];
|
||||||
|
|
||||||
if (selectedData && selectedCardNode) {
|
if (selectedData && selectedCardNode) {
|
||||||
@@ -446,126 +440,126 @@ export class MissionCardComp extends CCComp {
|
|||||||
.to(0.1, { scale: new Vec3(1.1, 1.1, 1.1) })
|
.to(0.1, { scale: new Vec3(1.1, 1.1, 1.1) })
|
||||||
.to(0.1, { scale: new Vec3(1, 1, 1) })
|
.to(0.1, { scale: new Vec3(1, 1, 1) })
|
||||||
.delay(0.5)
|
.delay(0.5)
|
||||||
.call(() => {
|
// .call(() => {
|
||||||
// 使用 HeroMasterComp 查找主角实体
|
// // 使用 HeroMasterComp 查找主角实体
|
||||||
// @ts-ignore
|
// // @ts-ignore
|
||||||
const entities = ecs.query(ecs.allOf(HeroMasterComp));
|
// const entities = ecs.query(ecs.allOf(HeroMasterComp));
|
||||||
let role = entities.length > 0 ? entities[0] : null;
|
// let role = entities.length > 0 ? entities[0] : null;
|
||||||
|
|
||||||
if (!role) {
|
// if (!role) {
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 未找到挂载 HeroMasterComp 的主角实体`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 未找到挂载 HeroMasterComp 的主角实体`);
|
||||||
} else {
|
// } else {
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 成功定位主角实体: ${role.eid}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 成功定位主角实体: ${role.eid}`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (role) {
|
// if (role) {
|
||||||
switch (selectedData.type) {
|
// switch (selectedData.type) {
|
||||||
case CardType.Talent:
|
// case CardType.Talent:
|
||||||
smc.addTalentRecord(selectedData.uuid);
|
// smc.addTalentRecord(selectedData.uuid);
|
||||||
// 直接调用 TalComp 添加天赋
|
// // 直接调用 TalComp 添加天赋
|
||||||
const talComp = role.get(TalComp);
|
// const talComp = role.get(TalComp);
|
||||||
if (talComp) {
|
// if (talComp) {
|
||||||
const beforeCount = Object.keys(talComp.Tals).length;
|
// const beforeCount = Object.keys(talComp.Tals).length;
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Talent Before: Count=${beforeCount}, Tals=${JSON.stringify(talComp.Tals)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Talent Before: Count=${beforeCount}, Tals=${JSON.stringify(talComp.Tals)}`);
|
||||||
talComp.addTal(selectedData.uuid);
|
// talComp.addTal(selectedData.uuid);
|
||||||
const afterCount = Object.keys(talComp.Tals).length;
|
// const afterCount = Object.keys(talComp.Tals).length;
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Talent After: Count=${afterCount}, Added=${selectedData.uuid}, Tals=${JSON.stringify(talComp.Tals)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Talent After: Count=${afterCount}, Added=${selectedData.uuid}, Tals=${JSON.stringify(talComp.Tals)}`);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case CardType.Skill:
|
// case CardType.Skill:
|
||||||
smc.addSkillRecord(selectedData.uuid);
|
// smc.addSkillRecord(selectedData.uuid);
|
||||||
// 直接调用 HeroSkillsComp 添加技能
|
// // 直接调用 HeroSkillsComp 添加技能
|
||||||
const skillComp = role.get(HeroSkillsComp);
|
// const skillComp = role.get(HeroSkillsComp);
|
||||||
if (skillComp) {
|
// if (skillComp) {
|
||||||
const beforeCount = Object.keys(skillComp.skills).length;
|
// const beforeCount = Object.keys(skillComp.skills).length;
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Skill Before: Count=${beforeCount}, Skills=${JSON.stringify(skillComp.skills)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Skill Before: Count=${beforeCount}, Skills=${JSON.stringify(skillComp.skills)}`);
|
||||||
skillComp.addSkill(selectedData.uuid);
|
// skillComp.addSkill(selectedData.uuid);
|
||||||
const afterCount = Object.keys(skillComp.skills).length;
|
// const afterCount = Object.keys(skillComp.skills).length;
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Skill After: Count=${afterCount}, Added=${selectedData.uuid}, Skills=${JSON.stringify(skillComp.skills)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Skill After: Count=${afterCount}, Added=${selectedData.uuid}, Skills=${JSON.stringify(skillComp.skills)}`);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case CardType.Partner:
|
// case CardType.Partner:
|
||||||
// 伙伴是召唤新实体,依然适合用事件,或者直接调用 summon 方法
|
// // 伙伴是召唤新实体,依然适合用事件,或者直接调用 summon 方法
|
||||||
oops.message.dispatchEvent(GameEvent.CallFriend, { uuid: selectedData.uuid });
|
// oops.message.dispatchEvent(GameEvent.CallFriend, { uuid: selectedData.uuid });
|
||||||
break;
|
// break;
|
||||||
case CardType.Potion:
|
// case CardType.Potion:
|
||||||
// 药水直接作用于 HeroAttrsComp
|
// // 药水直接作用于 HeroAttrsComp
|
||||||
const attrsComp = role.get(HeroAttrsComp);
|
// const attrsComp = role.get(HeroAttrsComp);
|
||||||
if (attrsComp) {
|
// if (attrsComp) {
|
||||||
const potion = PotionCards[selectedData.uuid];
|
// const potion = PotionCards[selectedData.uuid];
|
||||||
if (potion) {
|
// if (potion) {
|
||||||
const beforeVal = attrsComp.Attrs[potion.attr] || 0;
|
// const beforeVal = attrsComp.Attrs[potion.attr] || 0;
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Potion Before: Attr[${potion.attr}]=${beforeVal}, Attrs=${JSON.stringify(attrsComp.Attrs)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Potion Before: Attr[${potion.attr}]=${beforeVal}, Attrs=${JSON.stringify(attrsComp.Attrs)}`);
|
||||||
|
|
||||||
const buffConf: BuffConf = {
|
// const buffConf: BuffConf = {
|
||||||
buff: potion.attr,
|
// buff: potion.attr,
|
||||||
value: potion.value,
|
// value: potion.value,
|
||||||
BType: BType.RATIO,
|
// BType: BType.RATIO,
|
||||||
time: potion.duration,
|
// time: potion.duration,
|
||||||
chance: 1,
|
// chance: 1,
|
||||||
};
|
// };
|
||||||
attrsComp.addBuff(buffConf);
|
// attrsComp.addBuff(buffConf);
|
||||||
smc.updateHeroInfo(attrsComp);
|
// smc.updateHeroInfo(attrsComp);
|
||||||
|
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Potion Applied: ${potion.desc}, Value=${potion.value}, Attrs=${JSON.stringify(attrsComp.Attrs)}`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Potion Applied: ${potion.desc}, Value=${potion.value}, Attrs=${JSON.stringify(attrsComp.Attrs)}`);
|
||||||
oops.gui.toast(potion.desc);
|
// oops.gui.toast(potion.desc);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case CardType.Attr:
|
// case CardType.Attr:
|
||||||
// 属性卡:使用 addBuff 添加永久属性加成
|
// // 属性卡:使用 addBuff 添加永久属性加成
|
||||||
const attrCard = AttrCards[selectedData.uuid];
|
// const attrCard = AttrCards[selectedData.uuid];
|
||||||
if (attrCard) {
|
// if (attrCard) {
|
||||||
const attrsComp = role.get(HeroAttrsComp);
|
// const attrsComp = role.get(HeroAttrsComp);
|
||||||
if (attrsComp) {
|
// if (attrsComp) {
|
||||||
// 记录变更前状态
|
// // 记录变更前状态
|
||||||
const roleBefore = attrsComp.Attrs[attrCard.attr] || 0;
|
// const roleBefore = attrsComp.Attrs[attrCard.attr] || 0;
|
||||||
|
|
||||||
// 根据属性类型决定 Buff 类型
|
// // 根据属性类型决定 Buff 类型
|
||||||
// 如果属性本身是 RATIO 型(如暴击率),AttrCards 中的值(如2)应该作为 VALUE 添加(因为 recalculateSingleAttr 会把 VALUE 和 RATIO 相加)
|
// // 如果属性本身是 RATIO 型(如暴击率),AttrCards 中的值(如2)应该作为 VALUE 添加(因为 recalculateSingleAttr 会把 VALUE 和 RATIO 相加)
|
||||||
// 但如果属性本身是 VALUE 型(如攻击力),AttrCards 中的值是直接加数值,也应该作为 VALUE 添加
|
// // 但如果属性本身是 VALUE 型(如攻击力),AttrCards 中的值是直接加数值,也应该作为 VALUE 添加
|
||||||
// 结论:无论属性类型如何,AttrCards 中的配置都是"增加的点数",所以统一使用 BType.VALUE
|
// // 结论:无论属性类型如何,AttrCards 中的配置都是"增加的点数",所以统一使用 BType.VALUE
|
||||||
// 修正:虽然 AttrsType 定义了属性本身的类型,但在 addBuff 中,BType.VALUE 表示"加法叠加",BType.RATIO 表示"乘法叠加"
|
// // 修正:虽然 AttrsType 定义了属性本身的类型,但在 addBuff 中,BType.VALUE 表示"加法叠加",BType.RATIO 表示"乘法叠加"
|
||||||
// 对于数值型属性(如攻击力):BType.VALUE 是 +10,BType.RATIO 是 +10%
|
// // 对于数值型属性(如攻击力):BType.VALUE 是 +10,BType.RATIO 是 +10%
|
||||||
// 对于百分比型属性(如暴击率):BType.VALUE 是 +2(%),BType.RATIO 是 +2%(即 *1.02,通常不这么用)
|
// // 对于百分比型属性(如暴击率):BType.VALUE 是 +2(%),BType.RATIO 是 +2%(即 *1.02,通常不这么用)
|
||||||
// 所以,AttrCards 配置的值应当被视为"绝对值增量",对应 BType.VALUE
|
// // 所以,AttrCards 配置的值应当被视为"绝对值增量",对应 BType.VALUE
|
||||||
|
|
||||||
// 构造永久 Buff (time: 0)
|
// // 构造永久 Buff (time: 0)
|
||||||
const buffConf: BuffConf = {
|
// const buffConf: BuffConf = {
|
||||||
buff: attrCard.attr,
|
// buff: attrCard.attr,
|
||||||
value: attrCard.value,
|
// value: attrCard.value,
|
||||||
BType: BType.RATIO, // 始终使用 VALUE 类型,代表数值/点数叠加
|
// BType: BType.RATIO, // 始终使用 VALUE 类型,代表数值/点数叠加
|
||||||
time: 0,
|
// time: 0,
|
||||||
chance: 1,
|
// chance: 1,
|
||||||
};
|
// };
|
||||||
|
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Adding Buff: Attr=${attrCard.attr}, Val=${attrCard.value}, Type=VALUE`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Adding Buff: Attr=${attrCard.attr}, Val=${attrCard.value}, Type=VALUE`);
|
||||||
attrsComp.addBuff(buffConf);
|
// attrsComp.addBuff(buffConf);
|
||||||
// addBuff 内部会自动调用 recalculateSingleAttr 和 updateHeroInfo
|
// // addBuff 内部会自动调用 recalculateSingleAttr 和 updateHeroInfo
|
||||||
|
|
||||||
const roleAfter = attrsComp.Attrs[attrCard.attr] || 0;
|
// const roleAfter = attrsComp.Attrs[attrCard.attr] || 0;
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Attr After: Hero=${roleAfter} (Change: ${roleAfter - roleBefore})`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] Attr After: Hero=${roleAfter} (Change: ${roleAfter - roleBefore})`);
|
||||||
|
|
||||||
oops.gui.toast(attrCard.desc);
|
// oops.gui.toast(attrCard.desc);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
mLogger.warn(this.debugMode, 'MissionCard', `[MissionCard] 未找到属性卡配置: UUID=${selectedData.uuid}`);
|
// mLogger.warn(this.debugMode, 'MissionCard', `[MissionCard] 未找到属性卡配置: UUID=${selectedData.uuid}`);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 主角实体无效,无法应用卡牌效果`);
|
// mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 主角实体无效,无法应用卡牌效果`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 记录已获取的卡牌
|
// // 记录已获取的卡牌
|
||||||
oops.message.dispatchEvent(GameEvent.UpdateMissionGet, {
|
// oops.message.dispatchEvent(GameEvent.UpdateMissionGet, {
|
||||||
uuid: selectedData.uuid,
|
// uuid: selectedData.uuid,
|
||||||
icon: selectedData.icon,
|
// icon: selectedData.icon,
|
||||||
kind: selectedData.kind
|
// kind: selectedData.kind
|
||||||
});
|
// });
|
||||||
|
|
||||||
this.close();
|
// this.close();
|
||||||
})
|
// })
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export class MissionHomeComp extends CCComp {
|
|||||||
|
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
||||||
this.on(GameEvent.MissionStart,this.mission_start,this)
|
|
||||||
}
|
}
|
||||||
/** 视图层逻辑代码分离演示 */
|
/** 视图层逻辑代码分离演示 */
|
||||||
start() {
|
start() {
|
||||||
@@ -29,15 +28,17 @@ export class MissionHomeComp extends CCComp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_mission() {
|
||||||
|
mLogger.log(this.debugMode, 'MissionHomeComp', "start_mission")
|
||||||
|
oops.message.dispatchEvent(GameEvent.MissionStart, {})
|
||||||
|
this.node.active=false;
|
||||||
|
}
|
||||||
|
|
||||||
mission_end(){
|
mission_end(){
|
||||||
mLogger.log(this.debugMode, 'MissionHomeComp', "[MissionHomeComp]=>mission_end")
|
mLogger.log(this.debugMode, 'MissionHomeComp', "[MissionHomeComp]=>mission_end")
|
||||||
this.home_active()
|
this.home_active()
|
||||||
}
|
}
|
||||||
mission_start(){
|
|
||||||
this.node.active=false
|
|
||||||
}
|
|
||||||
home_active(){
|
home_active(){
|
||||||
this.uodate_data()
|
this.uodate_data()
|
||||||
this.node.active=true
|
this.node.active=true
|
||||||
|
|||||||
Reference in New Issue
Block a user