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;
|
}
|
}
|