122 lines
3.1 KiB
C#
122 lines
3.1 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
using Games.GlobeDefine;
|
|
|
|
public class CommonItemPlotBase : UIItemBase
|
|
{
|
|
|
|
public Image _BackSprite;
|
|
public Image _Icon;
|
|
public Text _Num;
|
|
public Image _Quality;
|
|
public Text _Name;
|
|
|
|
private GameItem _ShowingItem;
|
|
public GameItem ShowingItem
|
|
{
|
|
get
|
|
{
|
|
return _ShowingItem;
|
|
}
|
|
}
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show(hash);
|
|
|
|
var showItem = (GameItem)hash["InitObj"];
|
|
ShowItem(showItem);
|
|
}
|
|
|
|
public void ShowItem(GameItem showItem)
|
|
{
|
|
if (showItem == null)
|
|
{
|
|
ClearShow();
|
|
return;
|
|
}
|
|
_ShowingItem = showItem;
|
|
|
|
Tab_CommonItem tabCommonItem = TableManager.GetCommonItemByID(showItem.DataID, 0);
|
|
if (tabCommonItem == null)
|
|
{
|
|
ClearShow();
|
|
}
|
|
else
|
|
{
|
|
_Icon.gameObject.SetActive(true);
|
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, tabCommonItem.Icon);
|
|
if (_Quality != null)
|
|
{
|
|
_Quality.gameObject.SetActive(true);
|
|
LoadAssetBundle.Instance.SetImageSprite(_Quality, showItem.GetQualityFrame());
|
|
}
|
|
if (tabCommonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, tabCommonItem.QualityEffect, _Icon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, tabCommonItem.QualityEffect, _Icon.transform);
|
|
}
|
|
|
|
|
|
if (_Num != null)
|
|
{
|
|
if (showItem.StackCount > 0)
|
|
{
|
|
_Num.text = showItem.StackCount.ToString();
|
|
_Num.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_Num.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
if (_Name != null)
|
|
{
|
|
_Name.text = tabCommonItem.Name;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnItemClick()
|
|
{
|
|
base.OnItemClick();
|
|
if (_ShowingItem == null)
|
|
return;
|
|
if (_ShowingItem.IsMagicMent())
|
|
{
|
|
MagicTooltipLogic.ShowEquipTooltip(_ShowingItem, ItemTooltipsLogic.ShowType.Info, false);
|
|
}
|
|
else if (_ShowingItem.IsEquipMent())
|
|
{
|
|
EquipTooltipsLogic.ShowEquipTooltip(_ShowingItem, ItemTooltipsLogic.ShowType.Info, transform.position);
|
|
}
|
|
else
|
|
{
|
|
ItemTooltipsLogic.ShowItemTooltip(_ShowingItem, ItemTooltipsLogic.ShowType.Info, transform.position);
|
|
}
|
|
}
|
|
|
|
private void ClearShow()
|
|
{
|
|
_ShowingItem = null;
|
|
_Icon.gameObject.SetActive(false);
|
|
if (_Num != null)
|
|
{
|
|
_Num.gameObject.SetActive(false);
|
|
}
|
|
if(_Quality != null)
|
|
_Quality.gameObject.SetActive(false);
|
|
if (_Name != null)
|
|
{
|
|
_Name.text = "";
|
|
}
|
|
}
|
|
}
|