using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
namespace Snxxz.UI
|
{
|
public class DogzDetailBehaviour : MonoBehaviour
|
{
|
[SerializeField] RectTransform m_Rect;
|
[SerializeField] ScrollRect m_Scroller;
|
[SerializeField] DogzEquip m_DogzEquip;
|
[SerializeField] Text m_ItemNameTxt;
|
[SerializeField] Text m_EquipGradeTxt;
|
[SerializeField] Text m_GradeTxt;
|
[SerializeField] Button m_CloseBtn;
|
[SerializeField] RectTransform m_ContainerBaseProp;
|
[SerializeField] PropertyBehaviour[] m_BasePropertys;
|
[SerializeField] RectTransform m_ContainerSpecialProp;
|
[SerializeField] PropertyBehaviour[] m_SpecialPropertys;
|
[SerializeField] AdaptiveLayout m_AdaptiveLayout;
|
|
DogzModel model { get { return ModelCenter.Instance.GetModel<DogzModel>(); } }
|
|
public event Action onCloseClick;
|
public Button CloseBtn
|
{
|
get
|
{
|
return m_CloseBtn;
|
}
|
}
|
|
private void Awake()
|
{
|
m_CloseBtn.onClick.AddListener(() =>
|
{
|
if (onCloseClick != null)
|
{
|
onCloseClick();
|
}
|
});
|
}
|
|
public void Display(ItemModel data)
|
{
|
//m_DogzEquip.Display(data);
|
//var config = ItemConfig.Get(data.itemId);
|
//if (config != null)
|
//{
|
// m_ItemNameTxt.text = config.ItemName;
|
// m_ItemNameTxt.color = UIHelper.GetUIColor(config.ItemColor);
|
//}
|
//m_ContainerBaseProp.SetActive(data.basePropertyDict != null);
|
//if (data.basePropertyDict != null)
|
//{
|
// var index = 0;
|
// foreach (var _key in data.basePropertyDict.Keys)
|
// {
|
// if (index < m_BasePropertys.Length)
|
// {
|
// var propertyConfig = PlayerPropertyConfig.Get(_key);
|
// m_BasePropertys[index].SetActive(true);
|
// m_BasePropertys[index].Display(_key, data.basePropertyDict[_key]);
|
// }
|
// index++;
|
// }
|
// for (int i = index; i < m_BasePropertys.Length; i++)
|
// {
|
// m_BasePropertys[i].SetActive(false);
|
// }
|
//}
|
//m_ContainerSpecialProp.SetActive(data.specialPropertyDict != null);
|
//if (data.specialPropertyDict != null)
|
//{
|
// var index = 0;
|
// foreach (var _key in data.specialPropertyDict.Keys)
|
// {
|
// if (index < m_SpecialPropertys.Length)
|
// {
|
// var propertyConfig = PlayerPropertyConfig.Get(_key);
|
// m_SpecialPropertys[index].SetActive(true);
|
// m_SpecialPropertys[index].Display(_key, data.specialPropertyDict[_key]);
|
// }
|
// index++;
|
// }
|
// for (int i = index; i < m_SpecialPropertys.Length; i++)
|
// {
|
// m_SpecialPropertys[i].SetActive(false);
|
// }
|
//}
|
}
|
|
private void OnEnable()
|
{
|
var _rectTransform = m_Scroller.transform as RectTransform;
|
if (m_AdaptiveLayout.Size <= _rectTransform.rect.height)
|
{
|
m_Scroller.vertical = false;
|
}
|
else
|
{
|
m_Scroller.vertical = true;
|
}
|
}
|
}
|
}
|
|
|