using Snxxz.UI;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using TableConfig;
|
/// <summary>
|
/// 宝石数据
|
/// </summary>
|
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 (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;
|
}
|
|
public int GetAllStoneLv()
|
{
|
int allStoneLv = 0;
|
var _dict = GetAllStone();
|
foreach (uint[] array in _dict.Values)
|
{
|
if (array == null || array.Length == 0) continue;
|
for (int i = 0; i < array.Length; i++)
|
{
|
if (array[i] == 0)
|
{
|
continue;
|
}
|
ItemConfig _tagChinItemModel = Config.Instance.Get<ItemConfig>((int)array[i]);
|
if (_tagChinItemModel == null)
|
{
|
continue;
|
}
|
allStoneLv += _tagChinItemModel.EffectValueB1;
|
}
|
}
|
return allStoneLv;
|
}
|
}
|