using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { public class PropertyBehaviour : MonoBehaviour { [SerializeField] Text m_PropertyName; [SerializeField] Text m_PropertyValue; [SerializeField] Text m_PropertyAdd; public void Display(int _property, long _value) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = GetValueLabel(_property, _value); } public void DisplayUpper(int _property, long _value) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = GetAddValueLabel(_property, _value); } public void DisplayAdd(int _property, long _value, int _add) { m_PropertyName.text = StringUtility.Contact(GetPropertyName(_property), ":"); m_PropertyValue.text = GetValueLabel(_property, _value); DisplayAddLabel(_property, _add); } public void DisplayRealm(int _property, long _value, int _add) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = GetValueLabel(_property, _value); m_PropertyAdd.text = GetValueLabel(_property, _add); } //原样显示 result为0时不显示,比如满级的情况 public void DisplayResul(int _property, long _value, int result) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = GetValueLabel(_property, _value); if (result == 0) { m_PropertyAdd.text = string.Empty; } else { m_PropertyAdd.text = GetValueLabel(_property, result); } } public void DisplayGodWeaponAdd(int _property, long _value, int _add) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = GetValueLabel(_property, _value); DisplayAddLabel(_property, _add); } public void DisplayUp(int _property, long _value, int _add) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = GetAddValueLabel(_property, _value); DisplayAddLabel(_property, _add); } public void DisplayGem(int _property, long _value) { m_PropertyName.text = GetPropertyName(_property); m_PropertyValue.text = StringUtility.Contact("+", PlayerPropertyConfig.GetValueDescription(_property, _value, false)); } string GetPropertyName(int property) { var config = PlayerPropertyConfig.Get(property); if (config != null) { return config.Name; } return string.Empty; } void DisplayAddLabel(int _property, long _value) { if (_value == 0) { m_PropertyAdd.text = string.Empty; } else { m_PropertyAdd.text = GetAddValueLabel(_property, _value); } } public void DisplayReiki(int _property, long _value, int _add) { m_PropertyName.text = GetPropertyName(_property); if (_property == (int)PropertyType.ATK) { m_PropertyValue.text = StringUtility.Contact(GetValueLabel(_property, PlayerDatas.Instance.extersion.MINATK) , "-", GetValueLabel(_property, PlayerDatas.Instance.extersion.MAXATK)); } else if (_property == (int)PropertyType.LuckPer) { m_PropertyValue.text = GetValueLabel((int)PropertyType.Luck, (int)UIHelper.GetPropertyValue(PropertyType.Luck)); } else { m_PropertyValue.text = GetValueLabel(_property, _value); } DisplayAddLabel(_property, _add); } string GetAddValueLabel(int _property, long _value) { return StringUtility.Contact("+", GetValueLabel(_property, _value)); } string GetValueLabel(int _property, long _value) { return PlayerPropertyConfig.GetValueDescription(_property, _value, true); } public void SetColor(TextColType colorType, bool bright) { m_PropertyName.color = UIHelper.GetUIColor(colorType, bright); m_PropertyValue.color = UIHelper.GetUIColor(colorType, bright); } } }