TH1/Unity/Assets/Scripts/TH1_UI/HintUI/HeroHintPanelCommonCircleMono.cs
2026-06-07 00:28:58 +08:00

78 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Logic.Action;
using Logic.Skill;
using RuntimeData;
using TH1_Logic.Action;
using TH1_UI.HintUI;
using TH1Resource;
using UI.HintUI;
using UnityEngine;
using UnityEngine.UI;
namespace TH1_UI.HintUI
{
/// <summary>
/// HeroHintPanel 中的技能圆圈组件
/// </summary>
public class HeroHintPanelCommonCircleMono : MonoBehaviour
{
public HintTrigger HintTrigger;
public Image SkillIcon;
public Image SkillIconBG;
private static Color DefaultActionBgColor =>
Table.Instance.SkillDataAssets.GetBGColor(SkillViewType.Normal, false);
/// <summary>
/// 设置技能显示内容
/// </summary>
public void SetContent(SkillType skillType, UnitFullType unitFullType)
{
if (!Table.Instance.SkillDataAssets.GetSkillInfo(skillType, out var info))
return;
// 设置技能图标
if (Table.Instance.SkillDataAssets.GetSkillIcon(skillType, unitFullType, out var spr))
SkillIcon.sprite = spr;
// 设置背景颜色
SkillIconBG.color = Table.Instance.SkillDataAssets.GetBGColor(info.SkillViewType, false);
// 设置 HintTrigger 数据
HintTrigger.DataProvider.HintDataType = HintDataType.SkillHintData;
HintTrigger.DataProvider.SkillTypeData = skillType;
HintTrigger.DataProvider.UnitFullType = unitFullType;
}
/// <summary>
/// 设置 Action 显示内容
/// </summary>
public void SetContent(CommonActionId actionId)
{
if (!Table.Instance.ActionDataAssets.GetActionInfo(actionId, out var actionInfo))
return;
// 设置 Action 图标
SkillIcon.sprite = actionInfo.Icon;
// Action 没有 SkillViewType使用默认背景色
SkillIconBG.color = DefaultActionBgColor;
// 设置 HintTrigger 数据
HintTrigger.DataProvider.HintDataType = HintDataType.ActionHintData;
HintTrigger.DataProvider.ActionIdData = actionId;
HintTrigger.DataProvider.locked = false;
}
/// <summary>
/// 重置内容
/// </summary>
public void ResetContent()
{
SkillIcon.sprite = null;
SkillIconBG.color = DefaultActionBgColor;
HintTrigger.DataProvider.HintDataType = HintDataType.TextData;
HintTrigger.DataProvider.Text = "";
}
}
}