少年修仙传客户端代码仓库
hch
2023-06-14 f23c81d21c9cc4c9f06e8bed3ebb7ddbe7e15ac3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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;
            }
        }
    }
}