少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, April 01, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
 
    public class TipModelWidget : MonoBehaviour
    {
 
        [SerializeField] RawImage m_Model;
        [SerializeField] Text m_FightPower;
        [SerializeField] Image m_Fight;
 
        ModelShowType showType;
        FashionDressModel fashionDressModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } }
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
 
        void OnDisable()
        {
            switch (showType)
            {
                case ModelShowType.Treasure:
                    UI3DTreasureExhibition.Instance.Stop();
                    break;
                case ModelShowType.Mount:
                    break;
                case ModelShowType.Pet:
                    break;
            }
        }
 
        public void Display(int id, ModelShowType showType, int fightValue = 0)
        {
            this.showType = showType;
 
            switch (showType)
            {
                case ModelShowType.Treasure:
                    m_Fight.SetSprite("FightingLv_Normal");
                    UI3DTreasureExhibition.Instance.ShowTreasure(id, m_Model);
                    break;
                case ModelShowType.Mount:
                    m_Fight.SetSprite("FightingLv_Normal");
                    UI3DModelExhibition.Instance.ShowHourse(id, m_Model);
                    break;
                case ModelShowType.Pet:
                    m_Fight.SetSprite("FightingLv_Normal");
                    var npcConfig = NPCConfig.Get(id);
                    UI3DModelExhibition.Instance.ShowNPC(id, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_Model);
                    break;
                case ModelShowType.FashionDress:
                    m_Fight.SetSprite("FightingLv_Normal");
                    var itemConfig = ItemConfig.Get(id);
                    if (itemConfig != null)
                    {
                        var fashionType = 0;
                        var fashionId = 0;
                        var 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(m_Model, SetFashionDressData(fashionIds));
                            }
                        }
 
                    }
                    break;
            }
 
            if (fightValue == 0)
            {
                m_Fight.SetActive(false);
                m_FightPower.SetActive(false);
            }
            else
            {
                m_Fight.SetActive(true);
                m_FightPower.SetActive(true);
                m_FightPower.text = fightValue.ToString();
                m_Fight.SetNativeSize();
            }
        }
 
        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;
                var 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;
        }
 
    }
 
}