本文整理汇总了C#中System.Variant.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.GetValue方法的具体用法?C# Variant.GetValue怎么用?C# Variant.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Variant
的用法示例。
在下文中一共展示了Variant.GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEmailValue
/// <summary>
/// 邮件相关信息
/// </summary>
/// <param name="playerid">发件人</param>
/// <param name="name">发件人名称</param>
/// <param name="receiveid">接收人</param>
/// <param name="receivename">接收者名称</param>
/// <param name="d">邮件内容</param>
/// <returns></returns>
public static Variant CreateEmailValue(string playerid, string name, string receiveid, string receivename, Variant d)
{
Variant v = new Variant();
v.Add("SendID", playerid);
v.Add("SendName", name);
v.Add("ReceiveID", receiveid);
v.Add("ReceiveName", receivename);
v.Add("Content", d.GetValue<object>("mailMess"));
DateTime dt = DateTime.UtcNow;
v.Add("UpdateDate", dt);
//邮件有效天数
int day = Convert.ToInt32(TipManager.GetMessage(EmailReturn.HameDay));
v.Add("EndDate", dt.AddDays(day));
int IsHave = 0;
if (d.ContainsKey("moneyGoods"))
{
Variant money = d.GetVariantOrDefault("moneyGoods");
if (money.ContainsKey("Coin"))
{
v.Add("Coin", money.GetIntOrDefault("Coin"));
IsHave = money.GetIntOrDefault("Coin") > 0 ? 1 : 0;
}
else
{
v.Add("Coin", 0);
}
if (money.ContainsKey("Score"))
{
v.Add("Score", money.GetIntOrDefault("Score"));
IsHave = money.GetIntOrDefault("Score") > 0 ? 1 : 0;
}
else
{
v.Add("Score", 0);
}
}
else
{
v.Add("Coin", 0);
v.Add("Score", 0);
}
if (d.ContainsKey("goodsList"))
{
List<Variant> list = new List<Variant>();
IList goodsList = d.GetValue<IList>("goodsList");
foreach (Variant msg in goodsList)
{
GameConfig gc = GameConfigAccess.Instance.FindOneById(msg.GetStringOrDefault("E"));
string goodsType = string.Empty;
int sort = 0;
if (gc != null)
{
goodsType = gc.Value.GetStringOrDefault("GoodsType");
sort = gc.Value.GetIntOrDefault("Sort");
}
else
{
if (gc == null)
{
Goods g = GoodsAccess.Instance.FindOneById(msg.GetStringOrDefault("E"));
if (g != null)
{
goodsType = g.Value.GetStringOrDefault("GoodsType");
sort = g.Value.GetIntOrDefault("Sort");
}
else
{
if (g == null)
{
//查询是否是宠物
Pet pet = PetAccess.Instance.FindOneById(msg.GetStringOrDefault("E"));
if (pet != null)
{
goodsType = "Pet";
sort = pet.Value.GetIntOrDefault("Sort");
}
}
}
}
}
if (goodsType == string.Empty)
continue;
Variant gs = new Variant();
gs.Add("SoleID", msg.GetStringOrDefault("E"));
gs.Add("GoodsID", msg.GetStringOrDefault("G"));
gs.Add("Number", msg.GetIntOrDefault("A"));
gs.Add("GoodsType", goodsType);
gs.Add("Sort", sort);
//.........这里部分代码省略.........