public int GetMainTipsCount(int winId) // 通过key获取vlue
{
if (m_MainTipsDict.ContainsKey(winId))
{
return m_MainTipsDict[winId];
}
return 0;
}
public void SetMainTipsInfo(int winId, int num) // 往字典添加一条新的数据
{
if (m_MainTipsDict.ContainsKey(winId))
{
m_MainTipsDict[winId] = num;
}
else
{
m_MainTipsDict.Add(winId, num);
}
}
</pre><pre name="code" class="csharp">if (m_WinIDs.IndexOf(winID) == -1)// ==-1 判断列表里有没有<span style="font-family: Arial, Helvetica, sans-serif;">winID字段 </span>
循环设置字典value
***** 不能循环赋值 要把keys取出来 再复制
List<int> keys = new List<int>();
foreach (int key in m_pDungeonStateDic.Keys)
{
keys.Add(key);
}
for (int i = 0, count = keys.Count; i < count; i++)
{
m_pDungeonStateDic[keys[i]] = emExpeditionDungeonStateType.AcceptedGoodType;
}