少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-20 a87120c155c48fa45b20a97c1a58bdbeb77318b7
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
using Snxxz.UI;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz
{
    public class SuitTypeSwitchBtn : MonoBehaviour
    {
        [SerializeField] Image switchBG;
        [SerializeField] RectTransform switchIcon;
        [SerializeField] public GameObject onObj;
        [SerializeField] GameObject offObj;
        [SerializeField] public Button switchBtn;
     
        [Header("ON时图标位置")]
        [SerializeField]
        Vector3 OnPos = new Vector3(31, 1, 0);
        [Header("OFF时图标位置")]
        [SerializeField]
        Vector3 OffPos = new Vector3(-31, 1, 0);
 
        public void SetInit(SuitType type)
        {
            RefreshSwitchUI(type);
        }
 
        public void RefreshSwitchUI(SuitType type)
        {
            switch (type)
            {
                case SuitType.LowSuit:
                    switchIcon.anchoredPosition3D = OnPos;
                    onObj.SetActive(true);
                    offObj.SetActive(false);
                    switchBG.SetSprite("NormalBottom");
                    break;
                case SuitType.HighSuit:
                    switchIcon.anchoredPosition3D = OffPos;
                    onObj.SetActive(false);
                    offObj.SetActive(true);
                    switchBG.SetSprite("QiangHuaBottom");
                    break;
            }
 
        }
 
    }
}