65 lines
1.6 KiB
C#
Raw Normal View History

2024-12-10 17:46:37 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using cfg.BlacksmithData;
using UnityEngine;
using UnityEngine.UI;
public class RogenItem : MonoBehaviour
{
2024-12-13 20:38:15 +08:00
[SerializeField] private Image back;
2024-12-10 17:46:37 +08:00
[SerializeField] private Text describe;
[SerializeField] private Button _button;
2024-12-11 22:02:24 +08:00
[SerializeField] private Image icon;
2024-12-13 20:38:15 +08:00
[SerializeField] private Sprite qualityV1;
[SerializeField] private Sprite qualityV2;
[SerializeField] private Sprite qualityV3;
[SerializeField] private Sprite qualityV4;
public SkillRogueData SkillRogueData => skillData;
2024-12-10 17:46:37 +08:00
[SerializeField] private SkillRogueData skillData;
private void Awake()
{
_button = GetComponent<Button>();
}
private void OnEnable()
{
_button.onClick.AddListener(SendEvent);
}
private void OnDisable()
{
_button.onClick.RemoveListener(SendEvent);
}
public void SetData(SkillRogueData data)
{
describe.text = data.Describe;
skillData = data;
2024-12-11 22:02:24 +08:00
icon.sprite = AssetBundleManager.ins.Sprite(data.Icon,AtlasType.ItemIcon);
2024-12-13 20:38:15 +08:00
switch (data.Quality)
{
case 1:
back.sprite = qualityV1;
break;
case 2:
back.sprite = qualityV2;
break;
case 3:
back.sprite = qualityV3;
break;
case 4:
back.sprite = qualityV4;
break;
}
2024-12-16 17:25:10 +08:00
2024-12-10 17:46:37 +08:00
}
2024-12-24 17:05:51 +08:00
public void SendEvent()
2024-12-10 17:46:37 +08:00
{
BattleManager.ins.SetRogen(skillData);
UIMgr.ins.CloseRogenPanel();
}
}