69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class PrivilegeVipRewItem : MonoBehaviour, IPointerDownHandler{
|
|
|
|
public Image _ItemQuality;
|
|
public Image _ItemIcon;
|
|
public Text _ItemNum;
|
|
|
|
private int _ItemId;
|
|
private int _itemCount;
|
|
private Tab_CommonItem commonItem = null;
|
|
|
|
public void InitItem(int _ItemId, int _ItemNum)
|
|
{
|
|
_itemCount = _ItemNum;
|
|
this._ItemId = _ItemId;
|
|
commonItem = TableManager.GetCommonItemByID(_ItemId, 0);
|
|
if(commonItem == null)
|
|
{
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
|
|
LoadAssetBundle.Instance.SetImageSprite(_ItemQuality, GCGame.Utils.GetItemQualityFrame(commonItem.Quality), delegate (bool isSucess, GameObject obj) {
|
|
_ItemQuality.gameObject.SetActive(true);
|
|
});
|
|
|
|
#region 时装图标分男女
|
|
string szIcon = commonItem.Icon;
|
|
int _PlayerProfession = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession; //获取玩家职业
|
|
//名字 Icon
|
|
if (_PlayerProfession == 0 || _PlayerProfession == 2)
|
|
{
|
|
szIcon = commonItem.Icon;//男
|
|
}
|
|
else if (_PlayerProfession == 1 || _PlayerProfession == 3)
|
|
{
|
|
szIcon = commonItem.Iconnv; //女
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
LoadAssetBundle.Instance.SetImageSprite(_ItemIcon, szIcon, delegate (bool isSucess, GameObject obj) {
|
|
_ItemIcon.gameObject.SetActive(true);
|
|
});
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, _ItemIcon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, _ItemIcon.transform);
|
|
}
|
|
|
|
this._ItemNum.text = _itemCount.ToString();
|
|
}
|
|
|
|
public void OnPointerDown(PointerEventData eventData)
|
|
{
|
|
ItemTooltipsLogic.ShowItemTooltip(_ItemId, ItemTooltipsLogic.ShowType.Info, _ItemIcon.transform.position);
|
|
}
|
|
}
|