64 lines
2.4 KiB
C#
64 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using GameCore;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace game
|
|
{
|
|
public class EventPotionRewardTips : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject rewardEmptyGo1, rewardEmptyGo2;
|
|
[SerializeField] private GameObject[] rewardGos;
|
|
[SerializeField] private RewardItemNew[] rewards;
|
|
//[SerializeField] private TMP_Text textTarget, textOwned;
|
|
[SerializeField] private Button btnClose;
|
|
[SerializeField] private GameObject tipGo;
|
|
|
|
public void Awake()
|
|
{
|
|
tipGo.SetActive(false);
|
|
btnClose.onClick.AddListener(() => UIManager.Instance.DestroyUI(UITypes.EventPotionRewardTips));
|
|
}
|
|
/// <summary>
|
|
/// Init this tip.
|
|
/// </summary>
|
|
/// <param name="items">Items to be shown in this tip.</param>
|
|
/// <param name="btnTransform">The position where this tip shows up.</param>
|
|
public void Init(List<ItemData> items, Transform btnTransform = null)
|
|
{
|
|
if (items.Count == 1)
|
|
{
|
|
rewardEmptyGo1.SetActive(true);
|
|
rewardEmptyGo2.SetActive(true);
|
|
rewardGos[0].SetActive(true);
|
|
for (int i = 1; i < rewardGos.Length; i++)
|
|
{
|
|
rewardGos[i].SetActive(false);
|
|
}
|
|
rewards[0].SetData(items[0]);
|
|
}
|
|
else if (items.Count > 1)
|
|
{
|
|
rewardEmptyGo1.SetActive(false);
|
|
rewardEmptyGo2.SetActive(false);
|
|
for (int i = 0; i < rewardGos.Length; i++)
|
|
{
|
|
rewardGos[i].SetActive(i < items.Count);
|
|
if (i < items.Count)
|
|
rewards[i].SetData(items[i]);
|
|
}
|
|
}
|
|
// textPoint.text = LocalizationMgr.GetFormatTextValue("UI_EventPartnerFishbowlPanel_7", score, targetScore);
|
|
//if (textOwned)
|
|
// textOwned.text = LocalizationMgr.GetFormatTextValue("UI_item_tips_1", score);
|
|
//if (textTarget)
|
|
// textTarget.text = LocalizationMgr.GetFormatTextValue("UI_EventRankPopupPanel_16", targetScore);
|
|
if (btnTransform)
|
|
tipGo.transform.position = btnTransform.position;
|
|
tipGo.SetActive(true);
|
|
}
|
|
}
|
|
}
|