feat: 新增卡牌自定义图标功能,优化图标加载逻辑
1. 为所有卡牌配置添加icon字段,支持自定义指定图集内的图标 2. 重构列表组件与卡片组件的图标获取逻辑,优先使用自定义图标 3. 更新预加载的图集资源从ui3改为ui6,适配新图标图集 4. 调整弹窗预制体尺寸与图集引用,适配新的图标资源系统
This commit is contained in:
@@ -181,9 +181,9 @@ export class EquipListComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
// 图标(取第一个 field 词条的图标)
|
||||
// 图标(优先用卡牌自定义 icon,否则取第一个 field 词条图标)
|
||||
if (this.icon_node && fields.length > 0) {
|
||||
const iconId = FieldSkillSet[fields[0]]?.icon || "";
|
||||
const iconId = this.cardData.icon || FieldSkillSet[fields[0]]?.icon || "";
|
||||
this.updateIcon(this.icon_node, iconId);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,10 +218,12 @@ export class ItemListComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
// 图标:装备取第一个 field 词条图标,商品取技能图标
|
||||
// 图标:优先用卡牌自定义 icon,装备取第一个 field 词条图标,商品取技能图标
|
||||
if (this.icon_node) {
|
||||
let iconId = "";
|
||||
if (isEquip) {
|
||||
if (this.cardData.icon) {
|
||||
iconId = this.cardData.icon;
|
||||
} else if (isEquip) {
|
||||
const fields = this.cardData.field || [];
|
||||
if (fields.length > 0) {
|
||||
iconId = FieldSkillSet[fields[0]]?.icon || "";
|
||||
|
||||
@@ -346,9 +346,10 @@ export class SCardComp extends CCComp {
|
||||
return skillCard?.info || skill?.info || this.cardData.info || "";
|
||||
}
|
||||
|
||||
/** 获取技能图标 id:驻场技能取 FieldSkillSet.icon,其余取 SkillSet.icon */
|
||||
/** 获取技能图标 id:优先用卡牌自定义 icon,驻场技能取 FieldSkillSet.icon,其余取 SkillSet.icon */
|
||||
private getIconId(skill: SkillConfig | null): string {
|
||||
if (!this.cardData) return "";
|
||||
if (this.cardData.icon) return this.cardData.icon;
|
||||
if (!this.cardData.skill && this.cardData.field && this.cardData.field.length > 0) {
|
||||
const fieldUuid = this.cardData.field[0];
|
||||
return FieldSkillSet[fieldUuid]?.icon || `${fieldUuid}`;
|
||||
|
||||
Reference in New Issue
Block a user