123 lines
4.2 KiB
C#
123 lines
4.2 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.Item;
|
|||
|
using GCGame.Table;
|
|||
|
|
|||
|
public class MagicClearItems : UIItemSelect
|
|||
|
{
|
|||
|
public class ItemInfo
|
|||
|
{
|
|||
|
public GameItem _GameItem;
|
|||
|
public int _canClear;
|
|||
|
}
|
|||
|
|
|||
|
public Image m_ItemImgae;
|
|||
|
public Image m_ItemIcon;
|
|||
|
public Text Name;
|
|||
|
public GameObject isEquip;
|
|||
|
public GameObject _DisableFlag;
|
|||
|
public GameObject IsBind;
|
|||
|
public GameObject UnEnable;
|
|||
|
public Text lv;
|
|||
|
|
|||
|
private ItemInfo m_ItemInfo;
|
|||
|
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
m_ItemInfo = hash["InitObj"] as ItemInfo;
|
|||
|
if (m_ItemInfo == null || m_ItemInfo._GameItem==null)
|
|||
|
return;
|
|||
|
Tab_CommonItem tabItem = TableManager.GetCommonItemByID(m_ItemInfo._GameItem.DataID, 0);
|
|||
|
|
|||
|
if (tabItem == null)
|
|||
|
return;
|
|||
|
if (tabItem.ClassID != (int)ItemClass.MAGICITEM)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
UnEnable.SetActive(m_ItemInfo._canClear != 1);
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(m_ItemIcon, tabItem.Icon);
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(m_ItemImgae, GCGame.Utils.GetItemQualityFrame(tabItem.Quality));
|
|||
|
if (tabItem.QualityEffect > 0)
|
|||
|
{
|
|||
|
CommonItemContainerItem.ShowQualityEffect(true, tabItem.QualityEffect, m_ItemImgae.transform);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CommonItemContainerItem.ShowQualityEffect(false, tabItem.QualityEffect, m_ItemImgae.transform);
|
|||
|
}
|
|||
|
|
|||
|
Name.text = GCGame.Utils.GetItemQualityName(tabItem.Quality, tabItem.Name);
|
|||
|
// 等级颜色和名字颜色一致,所以公用一个GetItemQualityName
|
|||
|
if(lv != null)
|
|||
|
{
|
|||
|
lv.text = GCGame.Utils.GetItemQualityName(tabItem.Quality, StrDictionary.GetClientDictionaryString("#{1166}",tabItem.MinLevelRequire));
|
|||
|
}
|
|||
|
GameItemContainer Container = GameManager.gameManager.PlayerDataPool.GetItemContainer(GameItemContainer.Type.TYPE_MAGICPACK);
|
|||
|
isEquip.SetActive(false);
|
|||
|
if (Container != null)
|
|||
|
{
|
|||
|
if (Container.GetItemByGuid(m_ItemInfo._GameItem.Guid) != null)
|
|||
|
isEquip.SetActive(true);
|
|||
|
}
|
|||
|
IsBind.SetActive(m_ItemInfo._GameItem.BindFlag && isEquip.activeSelf == false);
|
|||
|
|
|||
|
DisableShow();
|
|||
|
base.Show();
|
|||
|
}
|
|||
|
|
|||
|
void DisableShow()
|
|||
|
{
|
|||
|
_DisableFlag.SetActive(true);
|
|||
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(m_ItemInfo._GameItem.DataID, 0);
|
|||
|
if (commonItem == null)
|
|||
|
return;
|
|||
|
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
|||
|
int nPlayerProfession = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession;
|
|||
|
int proLimit = commonItem.ProfessionRequire;
|
|||
|
if (((proLimit >> GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession) & 1) == 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (commonItem.MinLevelRequire > nPlayerLevel
|
|||
|
|| commonItem.MaxLevelRequire < nPlayerLevel)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
_DisableFlag.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
public void ItemToolTip()
|
|||
|
{
|
|||
|
GameItemContainer Container = GameManager.gameManager.PlayerDataPool.GetItemContainer(GameItemContainer.Type.TYPE_MAGICPACK);
|
|||
|
if (Container == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_ItemInfo == null || m_ItemInfo._GameItem == null)
|
|||
|
return;
|
|||
|
GameItem gameItem = Container.GetItemByGuid(m_ItemInfo._GameItem.Guid);
|
|||
|
if (gameItem == null)
|
|||
|
MagicTooltipLogic.ShowEquipTooltip(m_ItemInfo._GameItem, ItemTooltipsLogic.ShowType.UnEquiped);
|
|||
|
else
|
|||
|
MagicTooltipLogic.ShowEquipTooltip(m_ItemInfo._GameItem, ItemTooltipsLogic.ShowType.Equiped);
|
|||
|
}
|
|||
|
|
|||
|
public void UnEnable_Click()
|
|||
|
{
|
|||
|
if (m_ItemInfo == null || m_ItemInfo._GameItem == null)
|
|||
|
return;
|
|||
|
if(m_ItemInfo._canClear==-1)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("{#40316}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_ItemInfo._canClear == 0)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("{#40317}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|