feat: 为奖励卡片添加类型标识显示功能
- 在 MissionGetsComp 中添加根据 CardKind 显示不同类型标识的逻辑 - 修改 get.prefab 预制体,增加 Atk、Atked、Buff 等类型标识节点 - 默认隐藏 card.prefab 中的两个子节点以优化初始显示状态
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -464,7 +464,7 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 19
|
"__id__": 19
|
||||||
@@ -639,7 +639,7 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 27
|
"__id__": 27
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
|||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
import { CardKind } from "../common/config/GameSet";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -72,6 +73,49 @@ export class MissionGetsCompComp extends CCComp {
|
|||||||
this.get_nodes.push(node);
|
this.get_nodes.push(node);
|
||||||
|
|
||||||
node.getChildByName("num").getComponent(Label).string = "1";
|
node.getChildByName("num").getComponent(Label).string = "1";
|
||||||
|
|
||||||
|
// 先隐藏所有类型标识
|
||||||
|
const typeNodes = ["Atk", "Atked", "Buff", "Attr", "Skill", "Hp", "Dead", "Partner"];
|
||||||
|
// 1. 处理 bg 节点
|
||||||
|
typeNodes.forEach(nodeName => {
|
||||||
|
const node_bg = node.getChildByName(nodeName);
|
||||||
|
if (node_bg) node_bg.active = false;
|
||||||
|
});
|
||||||
|
// 根据 kind 激活bg
|
||||||
|
let activeNodeName = "";
|
||||||
|
switch (type) {
|
||||||
|
case CardKind.Atk:
|
||||||
|
activeNodeName = "Atk";
|
||||||
|
break;
|
||||||
|
case CardKind.Atted:
|
||||||
|
activeNodeName = "Atked";
|
||||||
|
break;
|
||||||
|
case CardKind.Buff:
|
||||||
|
activeNodeName = "Buff";
|
||||||
|
break;
|
||||||
|
case CardKind.Attr:
|
||||||
|
activeNodeName = "Attr";
|
||||||
|
break;
|
||||||
|
case CardKind.Skill:
|
||||||
|
activeNodeName = "Skill";
|
||||||
|
break;
|
||||||
|
case CardKind.Hp:
|
||||||
|
activeNodeName = "Hp";
|
||||||
|
break;
|
||||||
|
case CardKind.Dead:
|
||||||
|
activeNodeName = "Dead";
|
||||||
|
break;
|
||||||
|
case CardKind.Partner:
|
||||||
|
activeNodeName = "Partner";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeNodeName) {
|
||||||
|
// 激活bg
|
||||||
|
const activeNode = node.getChildByName(activeNodeName);
|
||||||
|
if (activeNode) activeNode.active = true;
|
||||||
|
}
|
||||||
|
|
||||||
const sprite = node.getChildByName("icon").getComponent(Sprite);
|
const sprite = node.getChildByName("icon").getComponent(Sprite);
|
||||||
if (!sprite) return;
|
if (!sprite) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user