少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-05 efa5f8d07fc3321f6ac5f5d97fb422db28d0886f
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
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class RealmStageBehaviour : MonoBehaviour
    {
        [SerializeField] RealmIcon m_RealmIcon;
        [SerializeField] Image m_RealmCompleted;
        [SerializeField] Image m_Arrow;
        [SerializeField] Image m_Last;
        [SerializeField] VerticalLayoutGroup m_Layout;
 
        public void Display(int _realmLv, bool last)
        {
            var config = RealmConfig.Get(_realmLv);
            var realmLevel = PlayerDatas.Instance.baseData.realmLevel;
            if (config != null)
            {
                m_RealmIcon.Display(_realmLv);
                m_RealmCompleted.gameObject.SetActive(realmLevel >= _realmLv);
                m_Arrow.gameObject.SetActive(realmLevel == _realmLv);
                m_Last.gameObject.SetActive(last);
            }
        }
 
        public float GetWidth(int realmLevel)
        {
            var config = RealmConfig.Get(realmLevel);
            if (config != null)
            {
                var sprite = UILoader.LoadSprite(config.Img);
                if (sprite)
                {
                    return sprite.rect.width + m_Layout.padding.left + m_Layout.padding.right;
                }
            }
            return 86 + m_Layout.padding.left + m_Layout.padding.right;
        }
    }
}