132 lines
3.7 KiB
C#
132 lines
3.7 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.Item;
|
|||
|
using GCGame.Table;
|
|||
|
using Module.Log;
|
|||
|
|
|||
|
public class MagicInfoItems : CommonItemContainerItem
|
|||
|
{
|
|||
|
private GameItem m_gameItem;
|
|||
|
public GameObject _DisableFlag;
|
|||
|
public GameObject redPoint; // 红点提示
|
|||
|
public GameObject IsBind;
|
|||
|
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
base.Show();
|
|||
|
|
|||
|
m_gameItem = (GameItem)hash["InitObj"];
|
|||
|
if (m_gameItem == null)
|
|||
|
return;
|
|||
|
ItemInfo ItemParam = new ItemInfo();
|
|||
|
ItemParam.itemID = m_gameItem.DataID;
|
|||
|
ItemParam.itemNum = m_gameItem.StackCount;
|
|||
|
|
|||
|
InitItem(ItemParam);
|
|||
|
DisableShow();
|
|||
|
UpdateRedPoint();
|
|||
|
IsBind.SetActive(m_gameItem.BindFlag);
|
|||
|
}
|
|||
|
|
|||
|
void DisableShow()
|
|||
|
{
|
|||
|
_DisableFlag.SetActive(true);
|
|||
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(m_gameItem.DataID, 0);
|
|||
|
if (commonItem == null)
|
|||
|
return;
|
|||
|
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
|||
|
int nPlayerProfession = Singleton<ObjManager>.Instance.MainPlayer.Profession;
|
|||
|
int proLimit = commonItem.ProfessionRequire;
|
|||
|
if (((proLimit >> Singleton<ObjManager>.GetInstance().MainPlayer.Profession) & 1) == 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (commonItem.MinLevelRequire > nPlayerLevel
|
|||
|
|| commonItem.MaxLevelRequire < nPlayerLevel)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
_DisableFlag.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
public override void OnItemClick()
|
|||
|
{
|
|||
|
if (m_gameItem == null)
|
|||
|
return;
|
|||
|
|
|||
|
MagicTooltipLogic.ShowEquipTooltip(m_gameItem, ItemTooltipsLogic.ShowType.UnEquiped);
|
|||
|
|
|||
|
if (_ClickEvent != null)
|
|||
|
{
|
|||
|
_ClickEvent(_InitInfo);
|
|||
|
}
|
|||
|
|
|||
|
if (_PanelClickEvent != null)
|
|||
|
{
|
|||
|
_PanelClickEvent(this);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void SetRedPoint(bool isShow)
|
|||
|
{
|
|||
|
if(redPoint != null)
|
|||
|
{
|
|||
|
if(redPoint.activeSelf != isShow)
|
|||
|
{
|
|||
|
redPoint.SetActive(isShow);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 检查当前法宝是否是更好的选择
|
|||
|
/// </summary>
|
|||
|
public void UpdateRedPoint()
|
|||
|
{
|
|||
|
if (!m_gameItem.IsMagicMent())
|
|||
|
{
|
|||
|
LogModule.ErrorLog("This is not magic !!!");
|
|||
|
SetRedPoint(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
GameItemContainer Container = GameManager.gameManager.PlayerDataPool.GetItemContainer(GameItemContainer.Type.TYPE_MAGICPACK);
|
|||
|
if (Container == null)
|
|||
|
{
|
|||
|
LogModule.ErrorLog("Can't get magicpack Container !!!");
|
|||
|
SetRedPoint(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
// 最大最小穿戴等级判定
|
|||
|
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
|||
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(m_gameItem.DataID, 0);
|
|||
|
if (commonItem.MinLevelRequire > nPlayerLevel
|
|||
|
|| commonItem.MaxLevelRequire < nPlayerLevel)
|
|||
|
{
|
|||
|
SetRedPoint(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
// 法宝专属职业判定
|
|||
|
int proLimit = commonItem.ProfessionRequire;
|
|||
|
if (((proLimit >> GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession) & 1) == 0)
|
|||
|
{
|
|||
|
SetRedPoint(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
// 当前装备的item
|
|||
|
GameItem equipItem = Container.GetItem(m_gameItem.GetSubClass() - 1);
|
|||
|
if (equipItem.DataID == -1 || m_gameItem.CombatValue > equipItem.CombatValue)
|
|||
|
{
|
|||
|
SetRedPoint(true);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
SetRedPoint(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|