少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 9fe4964c60e82735b165001d6e3d2914f73184e5
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
using UnityEngine;
using UnityEngine.UI;
using TableConfig;
 
namespace Snxxz.UI
{
    public class ModelShowPerfab : MonoBehaviour
    {
        [SerializeField] public Text titleText;
        [SerializeField] public RawImage modelImg;
        [SerializeField] public Text fightPowerText;
        [SerializeField] public GameObject fightImg;
 
        ModelShowType showType;
 
        public void OnDisable()
        {
            switch (showType)
            {
                case ModelShowType.treasure:
                    UI3DTreasureExhibition.Instance.StopShow();
                    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:
                    UI3DTreasureExhibition.Instance.BeginShowTreasure(id, modelImg);
                    break;
                case ModelShowType.mount:
                    UI3DModelExhibition.Instance.BeginShowHourse(id, modelImg);
                    break;
                case ModelShowType.pet:
                    var config = Config.Instance.Get<NPCConfig>(id);
                    UI3DModelExhibition.Instance.BeginShowNPC(id, config.UIModeLOffset, config.UIModelRotation, modelImg);
                    break;
            }
 
            if (fightValue == 0)
            {
                fightImg.SetActive(false);
                fightPowerText.gameObject.SetActive(false);
            }
            else
            {
                fightImg.SetActive(true);
                fightPowerText.gameObject.SetActive(true);
                fightPowerText.text = fightValue.ToString();
            }
        }
    }
 
    public enum ModelShowType
    {
        treasure, //法宝
        mount, //坐骑
        pet,
    }
}