本文整理汇总了C#中Info.of方法的典型用法代码示例。如果您正苦于以下问题:C# Info.of方法的具体用法?C# Info.of怎么用?C# Info.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Info
的用法示例。
在下文中一共展示了Info.of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupTooltip
public void SetupTooltip(Info info)
{
if ((tooltipFlags & TooltipFlag.HIDE) == TooltipFlag.HIDE)
{
return;
}
if ((tooltipFlags & TooltipFlag.DISPLAY_COST) == TooltipFlag.DISPLAY_COST)
{
tooltip += "\n\nCost:\n" +
"Wood: [[resources.wood]]\n" +
"Metal: [[resources.metal]]\n" +
"Food: [[resources.food]]";
}
if ((tooltipFlags & TooltipFlag.DISPLAY_TARGET) == TooltipFlag.DISPLAY_TARGET)
{
string attrs = "";
switch (targetType)
{
case EntityType.UNIT:
UnitInfo unitTarget = info.of(targetRace, targetUnit);
attrs = "\n\nAttributes:\n" +
"WeaponAbility: [[attributes.weaponAbility]]\n" +
"ProjectileAbility: [[attributes.projectileAbility]]\n" +
"Strength: [[attributes.strength]]\n" +
"Resistance: [[attributes.resistance]]\n" +
"Wounds: [[attributes.wounds]]\n" +
"Attack Rate: [[attributes.attackRate]]\n" +
"Movement Rate: [[attributes.movementRate]]";
attrs = attrs.FormatWith(unitTarget, @"\[\[", @"\]\]");
tooltip = "Recruit " + unitTarget.name + " " + tooltip + attrs;
break;
case EntityType.BUILDING:
BuildingInfo buildingTarget = info.of(targetRace, targetBuilding);
int i = 0;
foreach (EntityAbility ability in buildingTarget.abilities)
{
if (i > 0)
{
attrs += ", ";
}
if ((ability.tooltipFlags & TooltipFlag.HIDE) == TooltipFlag.HIDE)
{
continue;
}
attrs += ability.name;
++i;
}
if (i > 0)
{
attrs = "\n\nCan recruit:\n" + attrs;
}
tooltip = "Create " + buildingTarget.name + " " + tooltip + attrs + "\nKey : " + keyBinding.ToString();
break;
}
}
}