65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using cfg.BlacksmithData;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RogenItem : MonoBehaviour
|
|
{
|
|
[SerializeField] private Image back;
|
|
[SerializeField] private Text describe;
|
|
[SerializeField] private Button _button;
|
|
[SerializeField] private Image icon;
|
|
[SerializeField] private Sprite qualityV1;
|
|
[SerializeField] private Sprite qualityV2;
|
|
[SerializeField] private Sprite qualityV3;
|
|
[SerializeField] private Sprite qualityV4;
|
|
public SkillRogueData SkillRogueData => skillData;
|
|
[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;
|
|
icon.sprite = AssetBundleManager.ins.Sprite(data.Icon,AtlasType.ItemIcon);
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
private void SendEvent()
|
|
{
|
|
BattleManager.ins.SetRogen(skillData);
|
|
UIMgr.ins.CloseRogenPanel();
|
|
}
|
|
}
|