本文整理汇总了C#中ResourceInfo.getAvailableFactory方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceInfo.getAvailableFactory方法的具体用法?C# ResourceInfo.getAvailableFactory怎么用?C# ResourceInfo.getAvailableFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceInfo
的用法示例。
在下文中一共展示了ResourceInfo.getAvailableFactory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getResourceCost
/// <summary>Retorna o custo de um recurso num outro recurso</summary>
private bool getResourceCost( ResourceInfo resources, string originalRes, string costResCategory, string costRes, out int amount )
{
ResourceFactory factory = resources.getAvailableFactory(originalRes);
amount = 0;
if( factory.CostActions == null ) {
return true;
}
foreach( Action action in factory.CostActions ) {
if( action is ResourceNeeded ) {
ResourceNeeded needed = (ResourceNeeded) action;
//Chronos.Utils.Log.log("needed.Value=" + needed.Value + " needed.Key=" + needed.Key + " res=" + costRes);
if( needed.Key == costRes ) {
amount = needed.Quantity;
return needed.Quantity <= Manager.getResourceCount(costResCategory, costRes);
}
} else {
if( action is ResourceAvailable ) {
ResourceAvailable avail = (ResourceAvailable) action;
if( avail.Value == costRes ) {
amount = avail.Quantity;
return avail.Quantity <= Manager.getResourceCount(costResCategory, costRes);
}
}
}
}
return true;
}