少年修仙传客户端代码仓库
client_Hale
2019-04-17 38dbbe3f7cb862fdf46ba053994bc2419c730ce1
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
using UnityEngine;
using UnityEngine.UI;
 
using System.Collections.Generic;
 
namespace Snxxz.UI
{
    public class ModelShowPerfab : MonoBehaviour
    {
        [SerializeField] public Text titleText;
        [SerializeField] public RawImage modelImg;
        [SerializeField] public Text fightPowerText;
        [SerializeField] public Image fightImg;
 
        ModelShowType showType;
        FashionDressModel fashionDressModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } }
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
 
        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;
           
            switch (showType)
            {
                case ModelShowType.Treasure:
                    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.gameObject.SetActive(false);
                fightPowerText.gameObject.SetActive(false);
            }
            else
            {
                fightImg.gameObject.SetActive(true);
                fightPowerText.gameObject.SetActive(true);
                fightPowerText.text = fightValue.ToString();
                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;
        }
 
    }
 
    public enum ModelShowType
    {
        Treasure, //法宝
        Mount, //坐骑
        Pet, //灵宠
        FashionDress, //时装
    }
 
}