82 lines
2.0 KiB
C#
82 lines
2.0 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
|
|||
|
public class TestingCopyOnceAwardTipCtr : MonoBehaviour {
|
|||
|
|
|||
|
public Image icon;
|
|||
|
public Image iconBG;
|
|||
|
public Image topBG;
|
|||
|
public Text itemName;
|
|||
|
public Text itemType;
|
|||
|
public Text desc;
|
|||
|
public Transform infoRt; // 用于控制显示位置
|
|||
|
|
|||
|
public UIBackRayBehind bgMask;
|
|||
|
|
|||
|
private static TestingCopyOnceAwardTipCtr instance;
|
|||
|
public static TestingCopyOnceAwardTipCtr Instance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return instance;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
if(instance == null)
|
|||
|
{
|
|||
|
instance = this;
|
|||
|
bgMask._BackClick.AddListener(Close);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Show(int tabID, CopyOnceReward items, Vector3 showPosition)
|
|||
|
{
|
|||
|
infoRt.position = showPosition;
|
|||
|
|
|||
|
Tab_TestingCopyOnceAward tab = TableManager.GetTestingCopyOnceAwardByID(tabID, 0);
|
|||
|
if(tab == null)
|
|||
|
{
|
|||
|
Close();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(icon, tab.IconPath);
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(iconBG, tab.IconBGPath);
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(topBG, tab.TopBGPath);
|
|||
|
|
|||
|
itemName.text = tab.AwardName;
|
|||
|
itemType.text = tab.AwardType;
|
|||
|
|
|||
|
string itemDesc = tab.Award;
|
|||
|
itemDesc.Replace("#r", "\n");
|
|||
|
|
|||
|
for(int i = 0; i < items._ItemID.Count; ++i)
|
|||
|
{
|
|||
|
Tab_CommonItem tabAward = TableManager.GetCommonItemByID(items._ItemID[i], 0);
|
|||
|
if (tabAward == null)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
string awardDesc = "";
|
|||
|
awardDesc = Utils.GetQualityColorInTip(tabAward.Quality);
|
|||
|
awardDesc += tabAward.Name + "X" + items._ItemNum[i] + "</color>";
|
|||
|
|
|||
|
itemDesc += "\n" + awardDesc;
|
|||
|
}
|
|||
|
|
|||
|
desc.text = itemDesc;
|
|||
|
}
|
|||
|
|
|||
|
private void Close()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.TestingCopyOnceAwardTip);
|
|||
|
}
|
|||
|
}
|