95 lines
2.8 KiB
C#
95 lines
2.8 KiB
C#
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using Games.Mission;
|
|
using Games.Events;
|
|
using Games.Item;
|
|
|
|
public class ClearChangeAttrItem : UIItemBase
|
|
{
|
|
#region
|
|
|
|
public class ChangeAttrInfo
|
|
{
|
|
public string PropName;
|
|
public long PropOrgValue;
|
|
public long PropNewValue;
|
|
public bool isAttr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
public Text _PropName;
|
|
public Text _PropName1;
|
|
public Text _PropValueOrg;
|
|
public Text _PropValueNew;
|
|
public GameObject _ArrowUp;
|
|
public GameObject _ArrowDown;
|
|
|
|
private ChangeAttrInfo _ChangeAttr;
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
_ChangeAttr = (ChangeAttrInfo)hash["InitObj"];
|
|
ShowAttr(_ChangeAttr);
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
_PropValueOrg.text = "";
|
|
_PropValueNew.text = "";
|
|
_ArrowUp.SetActive(false);
|
|
_ArrowDown.SetActive(false);
|
|
}
|
|
|
|
public void ShowAttr(long OldData,long newData,bool isattr)
|
|
{
|
|
ChangeAttrInfo cChangeAttr = new ChangeAttrInfo();
|
|
cChangeAttr.PropName = "";
|
|
cChangeAttr.PropNewValue = newData;
|
|
cChangeAttr.PropOrgValue = OldData;
|
|
cChangeAttr.isAttr = isattr;
|
|
ShowAttr(cChangeAttr);
|
|
}
|
|
|
|
public void ShowAttr(ChangeAttrInfo cChangeAttr)
|
|
{
|
|
if (cChangeAttr == null)
|
|
return;
|
|
_ChangeAttr = cChangeAttr;
|
|
if (_PropName!=null && string.IsNullOrEmpty(_ChangeAttr.PropName)==false)
|
|
_PropName.text = _ChangeAttr.PropName;
|
|
if (_PropName1 != null && string.IsNullOrEmpty(_ChangeAttr.PropName) == false)
|
|
_PropName1.text = _ChangeAttr.PropName;
|
|
_PropValueOrg.text = _ChangeAttr.PropOrgValue.ToString();
|
|
|
|
_ArrowUp.gameObject.SetActive(_ChangeAttr.PropNewValue > _ChangeAttr.PropOrgValue && _ChangeAttr.PropNewValue > 0);
|
|
_ArrowDown.gameObject.SetActive(_ChangeAttr.PropNewValue < _ChangeAttr.PropOrgValue && _ChangeAttr.PropNewValue > 0);
|
|
if (_ChangeAttr.PropNewValue > _ChangeAttr.PropOrgValue)
|
|
{
|
|
string addStr = "";
|
|
if (cChangeAttr.isAttr)
|
|
{
|
|
addStr = string.Format(" <color=#721fadff>(+{0})</color>", cChangeAttr.PropNewValue - cChangeAttr.PropOrgValue);
|
|
}
|
|
_PropValueNew.text = StrDictionary.GetClientDictionaryString("#{5528}") + _ChangeAttr.PropNewValue.ToString() + "</color>" + addStr;
|
|
}
|
|
else if(_ChangeAttr.PropNewValue == _ChangeAttr.PropOrgValue)
|
|
{
|
|
_PropValueNew.text = _ChangeAttr.PropNewValue.ToString();
|
|
}
|
|
else
|
|
{
|
|
_PropValueNew.text = StrDictionary.GetClientDictionaryString("#{5529}") + _ChangeAttr.PropNewValue.ToString() + "</color>";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|