备份CatanBuilding瘦身独立工程
This commit is contained in:
52
Assets/Scripts/UI/ShootingRange/ShootingRangeRewardTip.cs
Normal file
52
Assets/Scripts/UI/ShootingRange/ShootingRangeRewardTip.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ShootingRangeRewardTip : 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()
|
||||
{
|
||||
btnClose.onClick.AddListener(() => gameObject.SetActive(false));
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Init this tip.
|
||||
/// </summary>
|
||||
/// <param name="items">Items to be shown in this tip.</param>
|
||||
public void Init(List<ItemData> items)
|
||||
{
|
||||
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) continue;
|
||||
rewards[i].SetData(items[i], abbr: true);
|
||||
// rewards[i].text_num.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
// textPoint.text = LocalizationMgr.GetFormatTextValue("UI_EventPartnerFishbowlPanel_7", score, targetScore);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user