178 lines
5.3 KiB
C#
178 lines
5.3 KiB
C#
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using GCGame.Table;
|
|
using Games.Mission;
|
|
using Games.Events;
|
|
using Games.Item;
|
|
using Module.Log;
|
|
/// <summary>
|
|
/// 常用项设备项
|
|
/// </summary>
|
|
public class CommonItemEquipItem : CommonItemContainerItem
|
|
{
|
|
public bool _DontShowFlat = false;
|
|
public Text _EquipName;
|
|
public GameObject _EquipingFlag;
|
|
public GameObject _BindFlag;
|
|
public GameObject _DisableFlag;
|
|
/// <summary>
|
|
/// 强化量
|
|
/// </summary>
|
|
public Text strength;
|
|
/// <summary>
|
|
/// 强化等级底板
|
|
/// </summary>
|
|
public GameObject StrengthLvDiTu;
|
|
|
|
private GameItem _EuqipItem;
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
_EuqipItem = (GameItem)hash["InitObj"];
|
|
InitItem(_EuqipItem);
|
|
}
|
|
|
|
public void InitItem(GameItem itemParam)
|
|
{
|
|
_EuqipItem = itemParam;
|
|
_InitInfo = _EuqipItem;
|
|
if (_EuqipItem != null && _EuqipItem.IsValid())
|
|
{
|
|
|
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(_EuqipItem.DataID, 0);
|
|
if (commonItem != null && itemParam.StackCount > 0)
|
|
{
|
|
|
|
//m_ItemNum.text = itemParam.StackCount.ToString();
|
|
m_ItemImg.gameObject.SetActive(true);
|
|
m_ItemQuality.gameObject.SetActive(true);
|
|
LoadAssetBundle.Instance.SetImageSprite(m_ItemImg, commonItem.Icon);
|
|
LoadAssetBundle.Instance.SetImageSprite(m_ItemQuality, itemParam.GetQualityFrame());
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, m_ItemImg.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, EquipFrenzy.EquipFrenzyEffectID, m_ItemImg.transform);
|
|
}
|
|
|
|
if (_EquipName != null)
|
|
_EquipName.text = _EuqipItem.GetEquipName();
|
|
if (!_DontShowFlat)
|
|
{
|
|
if (_EuqipItem.IsPlayerEquiped())
|
|
{
|
|
_EquipingFlag.SetActive(true);
|
|
_BindFlag.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
_EquipingFlag.SetActive(false);
|
|
if (_EuqipItem.BindFlag)
|
|
{
|
|
_BindFlag.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_BindFlag.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (_DisableFlag != null)
|
|
{
|
|
_DisableFlag.SetActive(false);
|
|
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
|
|
|
if (!itemParam.IsValid()
|
|
|| (!itemParam.IsFitForPlayer()))
|
|
{
|
|
_DisableFlag.SetActive(true);
|
|
}
|
|
|
|
if (nPlayerLevel < _EuqipItem.EquipUseLevel || nPlayerLevel > commonItem.MaxLevelRequire)
|
|
{
|
|
_DisableFlag.SetActive(true);
|
|
}
|
|
|
|
//if (commonItem.MinLevelRequire > nPlayerLevel
|
|
// || commonItem.MaxLevelRequire < nPlayerLevel)
|
|
//{
|
|
// _DisableFlag.SetActive(true);
|
|
//}
|
|
|
|
if (itemParam.ShihunTime > 0)
|
|
{
|
|
_DisableFlag.SetActive(true);
|
|
}
|
|
|
|
if (itemParam.Durable == 0)
|
|
{
|
|
_DisableFlag.SetActive(true);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, -1, null);
|
|
if (_EquipName != null)
|
|
_EquipName.text = "";
|
|
}
|
|
|
|
if(_EquipingFlag != null)
|
|
_EquipingFlag.SetActive(false);
|
|
if (_BindFlag != null)
|
|
_BindFlag.SetActive(false);
|
|
m_ItemImg.gameObject.SetActive(false);
|
|
m_ItemQuality.gameObject.SetActive(false);
|
|
}
|
|
|
|
public override void OnItemClick()
|
|
{
|
|
if (_ClickEvent == null)
|
|
{
|
|
if (_EuqipItem == null)
|
|
return;
|
|
EquipTooltipsLogic.ShowEquipTooltip(_EuqipItem, ItemTooltipsLogic.ShowType.Info, transform.position);
|
|
}
|
|
else
|
|
{
|
|
base.OnItemClick();
|
|
}
|
|
}
|
|
|
|
public void SetStrength(int lv)
|
|
{
|
|
if (strength != null)
|
|
{
|
|
if (lv > 0)
|
|
{
|
|
strength.text = "+" + lv.ToString();
|
|
strength.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
strength.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
if (StrengthLvDiTu != null)
|
|
{
|
|
if (lv>0)
|
|
{
|
|
StrengthLvDiTu.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
StrengthLvDiTu.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|