hch
14 小时以前 6ae4b14b7fb6640ec805f070a1f0f691941c6917
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
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
public class BeautyMMUpgradeWin : UIBase
{
    [SerializeField] Text titleText;
    [SerializeField] Text title2Text;
    [SerializeField] ImageEx roleImg;
    [SerializeField] Text[] talentTexts;
 
    int mmID;
    BeautyConfig mmConfig;
 
 
    protected override void OnPreOpen()
    {
        mmID = functionOrder;
        Display();
    }
 
 
 
    void Display()
    {
        mmConfig = BeautyConfig.Get(mmID);
        var skinID = BeautyMMManager.Instance.GetUsedSkinID(mmID);
        var skinConfig = BeautySkinConfig.Get(skinID);
        roleImg.SetOrgSprite(skinConfig.BigRole, "BeautyMMBigRole");
        roleImg.SetNativeSize();
 
        var mmData = BeautyMMManager.Instance.GetBeautyMMData(mmID);
        int rank = 0;
        if (mmData != null)
        {
            rank = mmData.LV / BeautyMMManager.Instance.needLVForTalent;
        }
        titleText.text = Language.Get($"BeautyMMLVName{rank}");
        title2Text.text = Language.Get($"BeautyMMLVName{rank + 1}");
        ShowTalent();
    }
 
 
    void ShowTalent()
    {
        //先显示天赋属性,再显示天赋特性
        var attrs = BeautyMMManager.Instance.GetMMTalentAttrForUI(mmID, true);
        int talentIndex = 0;
        if (attrs.IsNullOrEmpty())
        {
            talentIndex = 0;
        }
        else
        {
            foreach (var attr in attrs)
            {
                if (talentIndex < talentTexts.Length)
                {
                    talentTexts[talentIndex].SetActive(true);
                    string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}");
                    talentTexts[talentIndex].text = PlayerPropertyConfig.GetFullDescription(attr.Key, attr.Value, format);
                }
                else
                {
                    break;
                }
                talentIndex++;
            }
        }
 
 
        var talentValue = BeautyMMManager.Instance.GetMMTalentEffectForUI(mmID);
        for (int i = talentIndex; i < talentTexts.Length; i++)
        {
            if (i == talentIndex && mmConfig.EffType != 0)
            {
                //天赋效果约定最多一个
                talentTexts[talentIndex].SetActive(true);
                switch (mmConfig.EffType)
                {
                    case 1:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent1", talentValue);
                        break;
                    case 2:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent2", talentValue / 100, ItemConfig.Get(mmConfig.EffTypeValue).ItemName);
                        break;
                    case 3:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent3", talentValue);
                        break;
                    case 4:
                        talentTexts[i].text = Language.Get($"BeautyMMTalent4", ItemConfig.Get(mmConfig.EffTypeValue).ItemName, talentValue);
                        break;
                }
            }
            else
            {
                talentTexts[i].SetActive(false);
            }
        }
    }
 
 
}