少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using UnityEngine;
using UnityEngine.UI;
 
using System.Collections.Generic;
using System;
 
namespace vnxbqy.UI
{
    public class ModelShowPerfab : MonoBehaviour
    {
        [SerializeField] public Text titleText;
        [SerializeField] public RawImage modelImg;
        [SerializeField] public Text fightPowerText;
        [SerializeField] public Image fightImg;
        [SerializeField] Button m_ViewSkill;
 
        int displayId = 0;
 
        ModelShowType showType;
        FashionDressModel fashionDressModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } }
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
 
        private void Awake()
        {
            if (m_ViewSkill != null)
            {
                m_ViewSkill.onClick.AddListener(OnViewSkill);
            }
        }
 
        public void OnDisable()
        {
            switch (showType)
            {
                case ModelShowType.Treasure:
                    UI3DTreasureExhibition.Instance.Stop();
                    break;
                case ModelShowType.Mount:
                    break;
                case ModelShowType.Pet:
                    break;
            }
        }
 
        public void SetModelShow(int id, ModelShowType showType, string title, int fightValue = 0)
        {
            titleText.text = title;
            this.showType = showType;
 
            if (m_ViewSkill != null)
            {
                m_ViewSkill.SetActive(false);
            }
 
            switch (showType)
            {
                case ModelShowType.Treasure:
                    displayId = id;
                    if (m_ViewSkill != null)
                    {
                        m_ViewSkill.SetActive(id == 304);
                    }
                    fightImg.SetSprite("FightingLv_Normal");
                    UI3DTreasureExhibition.Instance.ShowTreasure(id, modelImg);
                    break;
                case ModelShowType.Mount:
                    fightImg.SetSprite("FightingLv_Max");
                    UI3DModelExhibition.Instance.ShowHourse(id, modelImg);
                    break;
                case ModelShowType.Pet:
                    fightImg.SetSprite("FightingLv_Max");
                    var npcConfig = NPCConfig.Get(id);
                    UI3DModelExhibition.Instance.ShowNPC(id, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, modelImg);
                    break;
                case ModelShowType.FashionDress:
                    fightImg.SetSprite("FightingLv_Normal");
                    var itemConfig = ItemConfig.Get(id);
                    if(itemConfig != null)
                    {
                        int fashionType = 0;
                        int fashionId = 0;
                        bool isFashion = tipsModel.TryGetItemFashionData(itemConfig.ID, out fashionType, out fashionId);
                        if(isFashion)
                        {
                            List<int> fashionIds = null;
                            fashionDressModel.TryGetFashionIds(fashionType, out fashionIds);
                            if(fashionIds != null && fashionIds.Count > 0)
                            {
                                UI3DModelExhibition.Instance.ShowPlayer(modelImg, SetFashionDressData(fashionIds));
                            }
                        }
                      
                    }
                    break;
            }
 
            if (fightValue == 0)
            {
                fightImg.SetActive(false);
                fightPowerText.SetActive(false);
            }
            else
            {
                fightImg.SetActive(true);
                fightPowerText.SetActive(true);
                fightPowerText.text = UIHelper.ReplaceLargeNum(fightValue);
                fightImg.SetNativeSize();
            }
        }
 
        public UI3DPlayerExhibitionData SetFashionDressData(List<int> fashionIds)
        {
            var job = PlayerDatas.Instance.baseData.Job;
            var fashionClothesId = 0;
            var fashionWeaponId = 0;
            var fashionSecondaryId = 0;
            foreach(var fashionId in fashionIds)
            {
                FashionDress fashionDress = null;
                bool isFashion = fashionDressModel.TryGetFashionDress(fashionId, out fashionDress);
                if (isFashion)
                {
                    int itemId = fashionDress.requireLevelUpItem;
                    var itemConfig = ItemConfig.Get(itemId);
                    switch (fashionDress.fashionDressType)
                    {
                        case 1:
                            fashionClothesId = fashionDress.GetEquipItemId();
                            break;
                        case 2:
                            fashionWeaponId = fashionDress.GetEquipItemId();
                            break;
                        case 3:
                            fashionSecondaryId = fashionDress.GetEquipItemId();
                            break;
                    }
                }
 
            }
 
            var data = new UI3DPlayerExhibitionData()
            {
                job = job,
                fashionClothesId = fashionClothesId,
                fashionWeaponId = fashionWeaponId,
                fashionSecondaryId = fashionSecondaryId,
                isDialogue = false,
            };
            return data;
        }
 
        private void OnViewSkill()
        {
            WindowCenter.Instance.uiRoot.uicamera.SetActive(false);
            CameraController.Instance.CameraObject.SetActive(false);
 
            UI3DHeroSkillShow.Instance.ShowTreasureSkill(displayId, () =>
            {
                WindowCenter.Instance.uiRoot.uicamera.SetActive(true);
                CameraController.Instance.CameraObject.SetActive(true);
            });
        }
    }
 
    public enum ModelShowType
    {
        Treasure, //法宝
        Mount, //坐骑
        Pet, //灵宠
        FashionDress, //时装
        //后续IL开发添加预设
        default1,
        default2,
        default3,
        default4,
        default5,
    }
 
}