少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-13 c7f64d977c4e2884d5411a5a2d0f37b6afa52963
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
69
70
71
72
73
using Snxxz.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
/// <summary>
/// 宝石数据
/// </summary>
[XLua.LuaCallCSharp]
public class PlayerStoneData : Singleton<PlayerStoneData>
{
    private Dictionary<int, uint[]> stoneDic = new Dictionary<int, uint[]>();
    private Dictionary<int, byte[]> stoneBindDict = new Dictionary<int, byte[]>();
 
    public static event Action OnRefreshStoneData;
 
    GemModel m_Model;
    GemModel model {
        get {
            return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<GemModel>());
        }
    }
 
    public void RefreshData(HA3BC_tagMCStoneInfo vNetData)
    {
        for (int i = 0; i < vNetData.EquipCount; i++)
        {
            HA3BC_tagMCStoneInfo.tagMCStoneMsg data = vNetData.InfoList[i];
 
            if (data.EquipPlace >= (int)RoleEquipType.JadeDynasty_Cloak
                && data.EquipPlace <= (int)RoleEquipType.JadeDynasty_Sword4)
            {
                continue;
            }
 
            if (stoneDic.ContainsKey(data.EquipPlace))
            {
                stoneDic[data.EquipPlace] = data.StoneInfo;
                stoneBindDict[data.EquipPlace] = data.StoneBind;
            }
            else
            {
                stoneDic.Add(data.EquipPlace, data.StoneInfo);
                stoneBindDict.Add(data.EquipPlace, data.StoneBind);
            }
        }
        if (OnRefreshStoneData != null)
        {
            OnRefreshStoneData();
        }
        model.OnUpdateRedPoint();
    }
 
    public uint[] GetStoneInfo(int index)
    {
        uint[] infoArray = null;
        stoneDic.TryGetValue(index, out infoArray);
        return infoArray;
    }
 
    public byte[] GetStoneBindInfo(int index)
    {
        byte[] infoArray = null;
        stoneBindDict.TryGetValue(index, out infoArray);
        return infoArray;
    }
 
    public Dictionary<int, uint[]> GetAllStone()
    {
        return stoneDic;
    }
}