少年修仙传客户端代码仓库
hch
2025-07-24 50e53441950268933694eeb5aad36147bbe1014d
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
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
 
class BreachSuccessWin : ILWindow
{
 
    Transform attGridContainer;
    Transform prefabs;
    RawImage equShow;
    Button bgBtn;
    Text powerText;
    UIEffect uiEffect;
 
    List<AttGridBehaviour> attGridBehaviours = new List<AttGridBehaviour>();
 
    protected override void BindController()
    {
        base.BindController();
        this.attGridContainer = this.transform.Find("Container_AttrGrid");
        this.prefabs = this.transform.Find("Prefabs");
        this.equShow = this.transform.FindComponentEx<RawImage>("Cotainer_Bg/EquShow");
        this.bgBtn = this.transform.FindComponentEx<Button>("Img_BG");
        this.powerText = this.transform.FindComponentEx<Text>("Conatainer_Power/Text_Power");
        this.uiEffect = this.transform.FindComponentEx<UIEffect>("UIEffect");
    }
 
    protected override void AddListeners()
    {
        base.AddListeners();
        this.bgBtn.SetListener(() =>
        {
            WindowCenter.Instance.CloseIL<BreachSuccessWin>();
        });
    }
 
    protected override void OnPreOpen()
    {
        base.OnPreOpen();
        this.uiEffect.Play();
        this.RefreshUI();
    }
 
    void RefreshUI()
    {
        var beforeItemID = SpiritEquipModel.Instance.beforeBeachItemID;
        var afterItemID = SpiritEquipModel.Instance.afterBeachItemID;
 
        var beforeConfig = SpiritWeaponConfig.Get(beforeItemID);
        var afterConfig = SpiritWeaponConfig.Get(afterItemID);
        var attrCount = afterConfig.AttrIDList.Length;
 
        //展示模型
        if (SpiritEquipModel.Instance.curEquType == RoleEquipType.Wing)
            UI3DModelExhibition.Instance.ShowWing(afterConfig.NPCID, this.equShow);
        else if (SpiritEquipModel.Instance.curEquType == RoleEquipType.Guard)
            UI3DModelExhibition.Instance.ShowNPC(afterConfig.NPCID, new Vector3(0, -45, 0), this.equShow, false, false);
        else
            UI3DModelExhibition.Instance.ShowEquipment(ItemConfig.Get(afterItemID).ChangeOrd, afterConfig.Rotation, afterConfig.scale, this.equShow);
        //展示战力
        var power = EquipFightPower.Instance.GetSpiritWeaponPower(afterItemID);
        this.powerText.text = power.ToString();
 
        var beforeAttrValueTable = new Dictionary<int, int>();
        for (int i = 0; i < beforeConfig.AttrIDList.Length; i++)
        {
            beforeAttrValueTable[beforeConfig.AttrIDList[i]] = beforeConfig.AttrValueList[i];
        }
 
        var beforeAttrs = SpiritEquipModel.Instance.GetBaseProperty(beforeItemID).baseProperties;
        var afterBaseAttrs = SpiritEquipModel.Instance.GetBaseProperty(afterItemID).baseProperties;
        var baseAttrCount = afterBaseAttrs.Count;
 
        var totalAttrCount = attrCount + baseAttrCount;
        var lerpCount = totalAttrCount - this.attGridBehaviours.Count;
 
        var attGridPrefab = this.prefabs.Find("AttGrid");
        for (int i = 1; i <= lerpCount; i++)
        {
            var attGrid = GameObject.Instantiate(attGridPrefab, this.attGridContainer);
            attGrid.SetActiveIL(true);
            attGrid.localScale = Vector3.one;
            var attGridBehaviour = new AttGridBehaviour();
            attGridBehaviour.BindController(attGrid);
            attGridBehaviours.Add(attGridBehaviour);
        }
 
        for (int i = 0; i < attGridBehaviours.Count; i++)
        {
            var index = i + 1;
            var behaviour = attGridBehaviours[i];
            if (index > totalAttrCount)
                behaviour.transform.SetActive(false);
            else
            {
                behaviour.transform.SetActive(true);
                PlayerPropertyConfig attrConfig;
                var nowAttrValue = 0;
                var afterAttrValue = 0;
                if (index > baseAttrCount)
                {
                    var id = index - baseAttrCount;
                    afterAttrValue = afterConfig.AttrValueList[id - 1];
                    attrConfig = PlayerPropertyConfig.Get(afterConfig.AttrIDList[id - 1]);
                    beforeAttrValueTable.TryGetValue(afterConfig.AttrIDList[id - 1], out nowAttrValue);
                }
                else
                {
                    afterAttrValue = afterBaseAttrs[index - 1].y;
                    attrConfig = PlayerPropertyConfig.Get(afterBaseAttrs[index - 1].x);
                    if (index - 1 < beforeAttrs.Count)
                        nowAttrValue = beforeAttrs[index - 1].y;
                    else
                        attrConfig = PlayerPropertyConfig.Get(afterBaseAttrs[index - 1].x);
                }
 
                var bIsPerAttr = attrConfig.ISPercentage == 1;
                var attrName = "";
                var attrBeforeStr = "";
                var attrAfterStr = "";
                //if (bIsPerAttr)
                //    valueUnit = "%";
 
                attrName = attrConfig.Name + ':';
                attrBeforeStr = PlayerPropertyConfig.GetValueDescription(attrConfig.ID, nowAttrValue, false);
                attrAfterStr = PlayerPropertyConfig.GetValueDescription(attrConfig.ID, afterAttrValue, false);
                behaviour.Init(attrName, attrBeforeStr, attrAfterStr);
            }
        }
    }
}