117 lines
3.7 KiB
C#
117 lines
3.7 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.Item;
|
|||
|
using GCGame.Table;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 词条洗练管理
|
|||
|
/// </summary>
|
|||
|
public class EquipXilianAttrItem : UIItemBase
|
|||
|
{
|
|||
|
public Text _AttrValue;
|
|||
|
public Text _OrgValue;
|
|||
|
public Text _OrgLine;
|
|||
|
public Image _FixedImg;
|
|||
|
|
|||
|
private EquipXilianAttr _ShowAttr;
|
|||
|
private GameItem _EquipItem;
|
|||
|
|
|||
|
public static List<int> xilianList = new List<int>();
|
|||
|
|
|||
|
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
base.Show();
|
|||
|
|
|||
|
_ShowAttr = hash["InitObj"] as EquipXilianAttr;
|
|||
|
if (_ShowAttr == null)
|
|||
|
return;
|
|||
|
|
|||
|
_EquipItem = hash["EquipItem"] as GameItem;
|
|||
|
_OrgValue.gameObject.SetActive(false);
|
|||
|
InitAttr(_ShowAttr, _EquipItem);
|
|||
|
}
|
|||
|
|
|||
|
private void InitAttr(EquipXilianAttr exAttr, GameItem equipItem)
|
|||
|
{
|
|||
|
if (exAttr.IsBaseAttr)
|
|||
|
{
|
|||
|
_FixedImg.gameObject.SetActive(false);
|
|||
|
if (exAttr.XilianValue > 0)
|
|||
|
{
|
|||
|
_AttrValue.text = StrDictionary.GetClientDictionaryString("#{5339}", exAttr.XilianValue);
|
|||
|
//Debug.LogError(exAttr.XilianValue);
|
|||
|
xilianList.Clear();
|
|||
|
xilianList.Add(exAttr.XilianValue);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_AttrValue.text = StrDictionary.GetClientDictionaryString("#{5340}", exAttr.XilianValue);
|
|||
|
//Debug.LogError(exAttr.XilianValue);
|
|||
|
xilianList.Clear();
|
|||
|
xilianList.Add(exAttr.XilianValue);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_ShowAttr = exAttr;
|
|||
|
string attrStr = (exAttr.XilianTab.Name) + PropID.GetAttrValue((PropID.PropertyID)_ShowAttr.XilianTab.PropID, _ShowAttr.PropSubID, _ShowAttr.XilianValue);
|
|||
|
string colorStr = exAttr.XilianTab.GetColorbyIndex(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession);
|
|||
|
if (string.IsNullOrEmpty(colorStr) || colorStr.Length < 15)
|
|||
|
{
|
|||
|
_AttrValue.text = _EquipItem.GetEquipColorStr() + attrStr + "</color>";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_AttrValue.text = colorStr + attrStr + "</color>";
|
|||
|
}
|
|||
|
|
|||
|
if (exAttr.IsFixedImg && _FixedImg != null)
|
|||
|
{
|
|||
|
_FixedImg.gameObject.SetActive(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_FixedImg.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ShowReplaceAttr(EquipXilianAttr exAttr, GameItem equipItem)
|
|||
|
{
|
|||
|
//if (_EquipItem != null && _EquipItem == equipItem && _ShowAttr != null && (_ShowAttr.XilianTab != exAttr.XilianTab || _ShowAttr.XilianValue != exAttr.XilianValue))
|
|||
|
//{
|
|||
|
// _OrgValue.gameObject.SetActive(true);
|
|||
|
// _OrgValue.text = (_ShowAttr.XilianTab.Name) + " " +
|
|||
|
// PropID.GetAttrName((PropID.PropertyID)_ShowAttr.XilianTab.PropID) + " +" + _ShowAttr.XilianValue;
|
|||
|
//}
|
|||
|
//else
|
|||
|
{
|
|||
|
_OrgValue.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
_EquipItem = equipItem;
|
|||
|
InitAttr(exAttr, equipItem);
|
|||
|
_ShowAttr = exAttr;
|
|||
|
}
|
|||
|
|
|||
|
public void ShowReplaceOrigin(EquipXilianAttr exAttr, GameItem equipItem)
|
|||
|
{
|
|||
|
_OrgValue.gameObject.SetActive(true);
|
|||
|
_OrgValue.text = (_ShowAttr.XilianTab.Name) + PropID.GetAttrValue((PropID.PropertyID)_ShowAttr.XilianTab.PropID, _ShowAttr.PropSubID, _ShowAttr.XilianValue);
|
|||
|
string orgLine = "";
|
|||
|
int lineLength = (int)(_OrgValue.text.Length);
|
|||
|
for (int i = 0; i < lineLength; ++i)
|
|||
|
{
|
|||
|
orgLine += "—";
|
|||
|
}
|
|||
|
_OrgLine.text = orgLine;
|
|||
|
|
|||
|
InitAttr(exAttr, equipItem);
|
|||
|
_ShowAttr = exAttr;
|
|||
|
_EquipItem = equipItem;
|
|||
|
}
|
|||
|
|
|||
|
}
|