少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, November 14, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
 
//宠物按钮
namespace Snxxz.UI
{
 
    public class PetButton : MonoBehaviour
    {
 
        [SerializeField] Button m_PetButton1;//按钮点击
        [SerializeField] GameObject m_ChoosenImg;//选中状态
        [SerializeField] GameObject m_UnchooseBtn1;//未中状态
        [SerializeField] GameObject m_LockText;//未解锁状态
        [SerializeField] Text m_ChoosenNameTxt1;//灵宠名
        [SerializeField] Text m_QualityTxt1;//灵宠品质
        [SerializeField] Text m_UseText;//灵宠阶级
        [SerializeField] GameObject appearanceImgObj; //外观切换图标
        [SerializeField] Text m_Textappearance;//
        [SerializeField] RedpointBehaviour redPonint;//红点
        [SerializeField] PetAttributeMethods _PetAttributeMethods;
        [SerializeField] Button m_PlayedButton;//出战按钮
        [SerializeField] Text m_Played_Text;//出战文本
        PetModel m_petModel;
        PetModel petmodel { get { return m_petModel ?? (m_petModel = ModelCenter.Instance.GetModel<PetModel>()); } }
 
        public Button PetButton1
        {
            get { return m_PetButton1; }
            set { m_PetButton1 = value; }
 
        }
        public GameObject ChoosenImg
        {
            get { return m_ChoosenImg; }
            set { m_ChoosenImg = value; }
 
        }
        public GameObject UnchooseBtn1
        {
            get { return m_UnchooseBtn1; }
            set { m_UnchooseBtn1 = value; }
 
        }
        public GameObject LockText
        {
            get { return m_LockText; }
            set { m_LockText = value; }
 
        }
        public Button PlayedButton
        {
            get { return m_PlayedButton; }
            set { m_PlayedButton = value; }
        }
        public Text Played_Text
        {
            get { return m_Played_Text; }
            set { m_Played_Text = value; }
        }
 
        public Text UseText
        {
            get { return m_UseText; }
            set { m_UseText = value; }
        }
        private void OnEnable()
        {
 
        }
        private void OnDisable()
        {
 
        }
 
        private void Start()
        {
        }
 
        public void ButtonAssignment(int PetID)//面板赋值
        {
            var config = PetInfoConfig.Get(PetID);
 
            if (petmodel._DicPetBack.ContainsKey(PetID))
            {
                LockText.SetActive(false);
                m_UseText.gameObject.SetActive(true);
                if (petmodel._DicPetBack[PetID].PetClass >= config.MaxRank)
                {
                    m_UseText.text = string.Format(Language.Get("Z1020"), petmodel._DicPetBack[PetID].PetClass);
                }
                else
                {
                    m_UseText.text = string.Format(Language.Get("LoadIconLV"), petmodel._DicPetBack[PetID].PetClass); ;
                }
 
                if(petmodel._DicPetBack[PetID].PetStatus == 1)
                {
                    appearanceImgObj.SetActive(true);
                    m_Textappearance.text = Language.Get("Petwin5");
                }
                else
                {
                    appearanceImgObj.SetActive(false);
                }
            }
            else
            {
                LockText.SetActive(true);
                LockText.GetComponent<Text>().text = Language.Get("Petwin6");
                m_UseText.gameObject.SetActive(false);
                appearanceImgObj.SetActive(false);
            }
 
            m_ChoosenNameTxt1.text = config.Name;
            m_QualityTxt1.text = ProductOrder(config.Quality.ToString());
            if (petmodel.PetRedpoint.ContainsKey(PetID))
            {
                redPonint.redpointId = petmodel.PetRedpoint[PetID].id;
            }
 
        }
 
        string ProductOrder(string _petProductOrder)//灵宠品质
        {
            FuncConfigConfig _PetQuality = FuncConfigConfig.Get("PetQuality");
            string[] _productlist = _PetQuality.Numerical1.Split('|');
            for (int i = 0; i < _productlist.Length; i++)
            {
                if (_petProductOrder == _productlist[i])
                {
                    string[] _productText = _PetQuality.Numerical2.Split('|');
                    string str = _productText[i];
                    return str;
                }
 
            }
            return null;
        }
        //public void PetShowAttribute(int PetID)
        //{
        //    _PetAttributeMethods.ModelShow(PetID);
        //}
    }
 
 
}