少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 aecb6a5a62d8a4cfc7b924ce957a9c7ea90c235d
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
using System.Collections;
using System.Collections.Generic;
using TableConfig;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class RealmIcon : MonoBehaviour
    {
        [SerializeField] Image m_RealmIcon;
        [SerializeField] UIEffect m_LightSfx;
 
        int realmLv { get; set; }
 
        public void Display(int _realmLv)
        {
            realmLv = _realmLv;
            var config = Config.Instance.Get<RealmConfig>(realmLv);
            if (config != null)
            {
                m_RealmIcon.SetSprite(config.Img);
            }
            DisplaySfx(realmLv);
        }
 
        void DisplaySfx(int _realmLv)
        {
            var effectId = GetLightSfx(_realmLv);
            if (m_LightSfx != null)
            {
                m_LightSfx.StopImediatly();
                if (effectId != 0)
                {
                    m_LightSfx.effect = effectId;
                    m_LightSfx.Play();
                }
            }
        }
 
        private void OnEnable()
        {
            if (realmLv != 0)
            {
                DisplaySfx(realmLv);
            }
        }
 
 
        public static int GetLightSfx(int _realmLv)
        {
            var config = Config.Instance.Get<RealmConfig>(_realmLv);
            if (config != null)
            {
                switch (config.Quality)
                {
                    case 9:
                        return 3064;
                }
            }
            return 0;
        }
    }
}