refactor(ui, talent): 重构图标加载逻辑并简化天赋文案
统一使用全局smc.uiconsAtlas缓存图标图集,移除各组件本地的缓存逻辑与变量 简化CardComp、SkillBoxComp的图标更新代码,删除冗余的异步加载步骤 将两处天赋名称简化,去掉多余的“额外”描述
This commit is contained in:
@@ -151,14 +151,13 @@ export class SkillBoxComp extends CCComp {
|
||||
// 加载技能图标
|
||||
if (this.icon_node) {
|
||||
const iconId = SkillSet[this.s_uuid]?.icon || `${this.s_uuid}`;
|
||||
resources.load("gui/uicons", SpriteAtlas, (err, atlas) => {
|
||||
if (err || !atlas) return;
|
||||
const frame = atlas.getSpriteFrame(iconId);
|
||||
if (smc.uiconsAtlas) {
|
||||
const frame = smc.uiconsAtlas.getSpriteFrame(iconId);
|
||||
if (frame && this.icon_node && this.icon_node.isValid) {
|
||||
const sprite = this.icon_node.getComponent(Sprite) || this.icon_node.addComponent(Sprite);
|
||||
let sprite = this.icon_node.getComponent(Sprite) || this.icon_node.addComponent(Sprite);
|
||||
sprite.spriteFrame = frame;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 更新剩余次数标签
|
||||
|
||||
Reference in New Issue
Block a user