69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
using Games.Item;
|
|
|
|
public class FashionEquipItem : MonoBehaviour {
|
|
#region
|
|
public Image itemIcon;
|
|
public GameObject descObj;
|
|
public Image _ItemQuality;
|
|
#endregion
|
|
|
|
private int itemId = -1; //对应CommonItem
|
|
|
|
public void InitItem(int dataId)
|
|
{
|
|
if(dataId == -1)
|
|
{
|
|
itemIcon.gameObject.SetActive(false);
|
|
_ItemQuality.gameObject.SetActive(false);
|
|
descObj.gameObject.SetActive(true);
|
|
return;
|
|
}
|
|
itemIcon.gameObject.SetActive(true);
|
|
descObj.gameObject.SetActive(false);
|
|
_ItemQuality.gameObject.SetActive(true);
|
|
itemId = dataId;
|
|
//icon
|
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(dataId, 0);
|
|
if(commonItem != null)
|
|
{
|
|
#region 时装图标分男女
|
|
int _PlayerProfession = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession; //获取玩家职业
|
|
if (_PlayerProfession == 0 || _PlayerProfession == 2)
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(itemIcon, commonItem.Icon);//男
|
|
}
|
|
else if (_PlayerProfession == 1 || _PlayerProfession == 3)
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(itemIcon, commonItem.Iconnv); //女
|
|
}
|
|
|
|
#endregion
|
|
//LoadAssetBundle.Instance.SetImageSprite(itemIcon, commonItem.Icon);
|
|
LoadAssetBundle.Instance.SetImageSprite(_ItemQuality, GCGame.Utils.GetItemQualityFrame(commonItem.Quality));
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, itemIcon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, itemIcon.transform);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
public void OnItemClick()
|
|
{
|
|
//显示对应的ItemToolTips
|
|
if (itemId == -1)
|
|
{
|
|
return;
|
|
}
|
|
ItemTooltipsLogic.ShowItemTooltip(itemId, ItemTooltipsLogic.ShowType.Info, transform.position);
|
|
}
|
|
}
|