本文整理汇总了C#中System.Collections.Dictionary.SetOrInc方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.SetOrInc方法的具体用法?C# Dictionary.SetOrInc怎么用?C# Dictionary.SetOrInc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Dictionary
的用法示例。
在下文中一共展示了Dictionary.SetOrInc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Melt
//.........这里部分代码省略.........
PlayerEx burden = note.Player.B0;
IList c = burden.Value.GetValue<IList>("C");
//包袱空格数
int space = BurdenManager.BurdenSpace(c);
//需要空格数
int count = baoshi == "-1" ? v.Count : v.Count + 1;
if (count > space)
{
//表示包袱不能存放可得到的物品
note.Call(MeltCommand.MeltR, false, TipManager.GetMessage(MeltReturn.MeltBurdenFull));
return;
}
List<Variant> list = new List<Variant>();
Dictionary<string, PlayerEx> bus = new Dictionary<string, PlayerEx>();
Dictionary<string, int> numberList = new Dictionary<string, int>();
Dictionary<string, int> binds = new Dictionary<string, int>();
Variant tmp;
foreach (Variant m in v)
{
//得到的物品
GameConfig getGoods = GameConfigAccess.Instance.FindOneById(m.GetStringOrDefault("GoodsID"));
int a = BurdenManager.StactCount(getGoods);
string name = "B0";
if (a == 0)
{
note.Call(MeltCommand.MeltR, false, TipManager.GetMessage(MeltReturn.MeltEquipError));
return;
}
PlayerEx b = note.Player.Value[name] as PlayerEx;
if (!bus.ContainsKey(name)) bus.Add(name, b);
if (!numberList.ContainsKey(getGoods.ID))
numberList.Add(getGoods.ID, m.GetIntOrDefault("Number"));
else
numberList[getGoods.ID] += m.GetIntOrDefault("Number");
if (!binds.ContainsKey(getGoods.ID)) binds.Add(getGoods.ID, isBinding);
//TODO:得到的物品检查
tmp = new Variant();
tmp.Add("GoodsID", getGoods.ID);
tmp.Add("Name", getGoods.Name);
tmp.Add("Count", m.GetIntOrDefault("Number"));
tmp.Add("IsGet", 1);
list.Add(tmp);
}
if (baoshi != string.Empty)
{
GameConfig getBaoShi = GameConfigAccess.Instance.FindOneById(g.Value.GetVariantOrDefault("BaoShiInfo")[baoshi].ToString());
if (getBaoShi != null)
{
if (!bus.ContainsKey("B0"))
{
bus.Add("B0", note.Player.B0);
}
numberList.SetOrInc(getBaoShi.ID, 1);
if (!binds.ContainsKey(getBaoShi.ID))
{
binds.Add(getBaoShi.ID, isBinding);
}
}
}
if (BurdenManager.BurdenIsFull(bus, numberList, binds))
{
note.Call(MeltCommand.MeltR, false, TipManager.GetMessage(MeltReturn.MeltBurdenFull));
return;
}
BurdenManager.TaskGoodsInsert(bus, numberList, binds, note.PlayerID);
#region 移除熔炼的装备
foreach (Variant con in c)
{
if (con.GetStringOrDefault("E") == goodsid)
{
tmp = new Variant();
tmp.Add("GoodsID", g.GoodsID);
tmp.Add("Name", g.Name);
tmp.Add("Count", con.GetIntOrDefault("A"));
tmp.Add("IsGet", 0);//0表示失去,1表示得到
list.Add(tmp);
//g.Mode = 1;
g.Save();
BurdenManager.BurdenClear(con);
break;
}
}
#endregion
burden.Save();
note.Call(MeltCommand.MeltR, true, list);
note.Player.UpdateBurden();
}
示例2: CheckPlayerTasks
/// <summary>
/// 通知任务系统
/// </summary>
protected void CheckPlayerTasks()
{
Dictionary<string, int> allApc = new Dictionary<string, int>();
foreach (FightApc target in m_teamB)
{
FightPlayer killer = target.Killer as FightPlayer;
if (killer != null)
{
allApc.SetOrInc(target.APC.ID, 1);
}
}
if (allApc.Count > 0)
{
foreach (var p in m_players)
{
if (p == null) continue;
//通知任务系统
UserNote note2 = new UserNote(p, TaskCommand.FightingTask, new object[] { allApc });
Notifier.Instance.Publish(note2);
}
}
}