本文整理汇总了C#中System.Variant.GetIntOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.GetIntOrDefault方法的具体用法?C# Variant.GetIntOrDefault怎么用?C# Variant.GetIntOrDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Variant
的用法示例。
在下文中一共展示了Variant.GetIntOrDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewPoint
public static Point NewPoint(Variant point)
{
if (point == null) return Point.Empty;
int x = point.GetIntOrDefault("X");
int y = point.GetIntOrDefault("Y");
return new Point(x, y);
}
示例2: Task10004
/// <summary>
/// 判断是否存在要求回收的物品
/// </summary>
/// <param name="note"></param>
/// <param name="s"></param>
/// <returns>true表示发生变化</returns>
public static bool Task10004(UserNote note, Variant s)
{
if (s.GetIntOrDefault("Cur") == s.GetIntOrDefault("Total"))
return false;
if (!s.ContainsKey("GoodsID"))
return false;
if (s.GetIntOrDefault("Type") != 10004)
return false;
int m = GameConfigAccess.Instance.GetStactCount(s.GetStringOrDefault("GoodsID"));
if (m <= 0) return false;
PlayerEx burden = note.Player.B0;
IList c = burden.Value.GetValue<IList>("C");
int number = 0;
foreach (Variant d in c)
{
if (d.GetStringOrDefault("G") == s.GetStringOrDefault("GoodsID"))
{
number += d.GetIntOrDefault("A");
}
}
if (number >= s.GetIntOrDefault("Total"))
s["Cur"] = s.GetIntOrDefault("Total");
else
s["Cur"] = number;
return true;
}
示例3: Create
public static LimitTeam Create(string name, Variant v)
{
int minMember = v.GetIntOrDefault("MinMember");
int maxMember = v.GetIntOrDefault("MaxMember");
if (minMember > 0 || maxMember > 0)
{
return new LimitTeam(name, minMember, maxMember);
}
return null;
}
示例4: Create
public static LimitFamily Create(string name, Variant v)
{
int dayDev = v.GetIntOrDefault("DayDev");
int familyTask = v.GetIntOrDefault("FamilyTask");
if (familyTask > 0 || dayDev > 0)
{
return new LimitFamily(name, dayDev, familyTask);
}
return null;
}
示例5: Create
public static LimitLevel Create(string name, Variant v)
{
int minLev = v.GetIntOrDefault("MinLevel");
int maxLev = v.GetIntOrDefault("MaxLevel");
if (minLev > 1 || maxLev > 0)
{
return new LimitLevel(name, minLev, maxLev);
}
return null;
}
示例6: NewRectangle
/// <summary>
///
/// </summary>
/// <param name="range"></param>
/// <param name="fourfold">是否扩大选择区</param>
/// <returns></returns>
public static Rectangle NewRectangle(Variant range, bool fourfold = false)
{
if (range == null) return Rectangle.Empty;
int x = range.GetIntOrDefault("X");
int y = range.GetIntOrDefault("Y");
int w = range.GetIntOrDefault("W");
int h = range.GetIntOrDefault("H");
if (fourfold)
{
return new Rectangle(x - w, y - h, w << 1, h << 1);
}
return new Rectangle(x, y, w, h);
}
示例7: AddPetBook
/// <summary>
/// 学习宠物技能(御宠图鉴)
/// </summary>
/// <param name="variant"></param>
public bool AddPetBook(Variant c)
{
string skillID = c.GetStringOrDefault("SkillID");
if (string.IsNullOrEmpty(skillID)) return false;
int level = c.GetIntOrDefault("SkillLev");
var skill = m_petBook.Value.GetValueOrDefault<List<object>>(skillID);
if (skill == null)
{
skill = new List<object>();
m_petBook.Value[skillID] = skill;
}
if (skill.Contains(level))
{
return false;
}
int mustslevel = level - 1;
if (mustslevel > 0 && (!skill.Contains(mustslevel)))
{
return false;
}
skill.Add(level);
m_petBook.Save();
this.Call(ClientCommand.UpdateActorR, new PlayerExDetail(m_petBook));
return true;
}
示例8: Apc
public Apc(Variant config)
{
ID = config.GetStringOrDefault("_id");
this.Name = config.GetStringOrDefault("Name");
Name = config.GetStringOrDefault("Name");
m_value = config.GetVariantOrDefault("Value");
m_life = new PlayerProperty();
if (m_value != null)
{
m_life.Add(m_value);
this.Level = m_value.GetIntOrDefault("Level");
}
this.ApcType = FighterType.APC;
Variant ui = config.GetVariantOrDefault("UI");
if (ui != null)
{
this.Skin = ui.GetStringOrDefault("Skin");
string apcType = ui.GetStringOrDefault("Type");
if (apcType == "BB")
{
this.ApcType = FighterType.BB;
}
else if (apcType == "Boss")
{
this.ApcType = FighterType.Boss;
}
}
}
示例9: Create
public static LimitScore Create(string name, Variant v)
{
int coin = v.GetIntOrDefault("Coin");
if (coin > 0)
{
return new LimitScore(name, coin);
}
return null;
}
示例10: Create
public static LimitScore Create(string name, Variant v)
{
int bond = v.GetIntOrDefault("Bond");
if (bond > 0)
{
return new LimitScore(name, bond);
}
return null;
}
示例11: Create
public static LimitScore Create(string name, Variant v)
{
int score = v.GetIntOrDefault("Score");
if (score > 0)
{
return new LimitScore(name, score);
}
return null;
}
示例12: Create
public static LimitMaxinto Create(string ectypeID, string name, Variant v)
{
int maxInto = v.GetIntOrDefault("MaxInto");
if (maxInto > 0)
{
return new LimitMaxinto(ectypeID, name, maxInto);
}
return null;
}
示例13: Box
public Box(Variant config)
{
ID = config.GetStringOrDefault("_id");
Name = config.GetStringOrDefault("Name");
m_value = config.GetVariantOrDefault("Value");
if (m_value != null)
{
this.SceneID = m_value.GetStringOrDefault("SceneID");
this.GoodsID = m_value.GetStringOrDefault("GoodsID");
this.OpenMS = m_value.GetIntOrDefault("OpenMS");
this.GrowSecond = m_value.GetIntOrDefault("GrowSecond");
this.MaxOpen = m_value.GetIntOrDefault("MaxOpen");
m_range = RangeHelper.NewRectangle(m_value.GetVariantOrDefault("Range"), true);
}
Variant ui = config.GetVariantOrDefault("UI");
if (ui != null)
{
this.Skin = ui.GetStringOrDefault("Skin");
}
if (this.GrowSecond <= 0)
{
this.GrowSecond = 30;
}
}
示例14: FightAction
public FightAction(Variant v, int fightCount)
{
this.ActionType = (ActionType)(v.GetIntOrDefault("fType"));
this.Sender = v.GetStringOrDefault("handler");
object obj;
if (v.TryGetValueT("target", out obj))
{
this.Target = (obj == null ? string.Empty : obj.ToString());
}
if (v.TryGetValueT("parameter", out obj))
{
this.Parameter = (obj == null ? string.Empty : obj.ToString());
}
this.FightCount = fightCount;
}
示例15: GetPetSkin
private static string GetPetSkin(Variant v)
{
string skin = v.GetStringOrDefault("Skin");
int rank = v.GetIntOrDefault("PetsRank");
int index = skin.IndexOf('|');
if (index >= 0)
{
string[] skins = skin.Split('|');
if (rank < skins.Length)
{
return skins[rank];
}
}
return skin + rank.ToString();
}