少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-16 fc714208ff3a320c3bb52bddd5ea3d91f647a206
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, January 29, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
 
 
namespace Snxxz.UI
{
 
    public class DungeonRewardItem : CommonItemBaisc
    {
        public ServerItem serverItem { get; set; }
        ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
 
        UIEffect itemColorSfx = null;
 
        private void OnEnable()
        {
            button.AddListener(ShowItemTip);
            RequestSfx();
        }
 
        private void OnDisable()
        {
            button.RemoveAllListeners();
            RecycleSfx();
        }
 
        private void ShowItemTip()
        {
            var attrData = new ItemAttrData(serverItem.ItemID, false, (ulong)serverItem.Count, -1, false, PackType.Deleted, "", ConfigParse.Analysis(serverItem.UserData));
            itemTipsModel.SetItemTipsModel(attrData);
        }
 
        private void RequestSfx()
        {
            RecycleSfx();
            var config = ItemConfig.Get(itemId);
            if (config != null)
            {
                var effect = config.ItemColor == 3 ? 1136 :
                                   config.ItemColor == 4 ? 1137 :
                                   config.ItemColor == 5 ? 1138 : 0;
                if (effect != 0)
                {
                    itemColorSfx = EffectMgr.Instance.PlayUIEffect(effect, 2500, transform, true);
                }
            }
 
        }
 
        private void RecycleSfx()
        {
            if (itemColorSfx != null)
            {
                itemColorSfx = null;
            }
        }
    }
 
}