少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-05 efa5f8d07fc3321f6ac5f5d97fb422db28d0886f
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
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
using System.Linq;
 
namespace Snxxz.UI
{
    [XLua.Hotfix]
    public class FashionAttrBeh : MonoBehaviour
    {
        [SerializeField] Text titleText;
        [SerializeField] Text starDesText;
        [SerializeField] List<Text> attrlist = new List<Text>();
 
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
        FashionDressModel fashionModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } }
 
        public void SetDisplay(int star,int curStar)
        {
            int curFashionId = fashionModel.viewFashionDressId;
            FashionDress fashionDress = null;
            fashionModel.TryGetFashionDress(curFashionId,out fashionDress);
            int minStar = 1;
            int maxStar = fashionDress.maxLevel;
 
            if(star == curStar
                && curStar < maxStar)
            {
                titleText.text = Language.Get("FashionDress101",maxStar);
            }
            else if(star == curStar
                && curStar >= maxStar)
            {
                titleText.text = Language.Get("FashionDress105");
            }
            else
            {
                titleText.text = Language.Get("FashionDress102",star);
            }
 
            if (star == curStar)
            {
                starDesText.text = Language.Get("FashionDress103",star);
            }
            else
            {
                starDesText.text = Language.Get("FashionDress104",star);
            }
 
            Dictionary<int, int> attrDict = null;
            fashionModel.TryGetFashionDressProperty(curFashionId,star,out attrDict);
            if(attrDict != null)
            {
                List<int> attrIds = attrDict.Keys.ToList();
                for (int i = 0; i < attrlist.Count; i++)
                {
                    var attrText = attrlist[i];
                    if (i < attrIds.Count)
                    {
                        attrText.gameObject.SetActive(true);
                        int attrId = attrIds[i];
                        int attrValue = attrDict[attrId];
                        var attrConfig = PlayerPropertyConfig.Get(attrId);
                        string attrSB = string.Empty;
                        if (attrConfig.Name.Contains("%s"))
                        {
                            attrSB = attrConfig.Name.Replace("%s", tipsModel.GetProValueTypeStr(attrConfig, attrValue));
                        }
                        else
                        {
                            attrSB = StringUtility.Contact(attrConfig.Name, "+", tipsModel.GetProValueTypeStr(attrConfig, attrValue));
                        }
                        attrText.text = attrSB;
                    }
                    else
                    {
                        attrText.gameObject.SetActive(false);
                    }
                }
            }
        }
          
    }
}