本文整理汇总了C#中Server.Engines.Craft.CraftSystem.UsesHueSelector方法的典型用法代码示例。如果您正苦于以下问题:C# CraftSystem.UsesHueSelector方法的具体用法?C# CraftSystem.UsesHueSelector怎么用?C# CraftSystem.UsesHueSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Engines.Craft.CraftSystem
的用法示例。
在下文中一共展示了CraftSystem.UsesHueSelector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConsumeRes
//.........这里部分代码省略.........
// Consume ALL
if ( consumeType == ConsumeType.All )
{
m_ResHue = 0; m_ResAmount = 0;
m_System = craftSystem;
if ( IsQuantityType( types ) )
index = ConsumeQuantity( ourPack, types, amounts );
else
index = ourPack.ConsumeTotalGroupedCompared( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo );
resHue = m_ResHue;
}
// Consume Half ( for use all resource craft type )
else if ( consumeType == ConsumeType.Half )
{
for ( int i = 0; i < amounts.Length; i++ )
{
amounts[i] /= 2;
if ( amounts[i] < 1 )
amounts[i] = 1;
}
m_ResHue = 0; m_ResAmount = 0;
m_System = craftSystem;
if ( IsQuantityType( types ) )
index = ConsumeQuantity( ourPack, types, amounts );
else
index = ourPack.ConsumeTotalGroupedCompared( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo );
resHue = m_ResHue;
}
else // ConstumeType.None ( it's basicaly used to know if the crafter has enough resource before starting the process )
{
index = -1;
if ( IsQuantityType( types ) )
{
for ( int i = 0; i < types.Length; i++ )
{
if ( GetQuantity( ourPack, types[i] ) < amounts[i] )
{
index = i;
break;
}
}
}
else
{
for ( int i = 0; i < types.Length; i++ )
{
if ( !context.CheckedHues )
if ( RetainsColorFrom( m_System, types[i][0] ) )
CheckMulitpleHues( from, types[i] );
if ( craftSystem.UsesHueSelector( this, types[i][0] ) )
{
if ( context.CompareHueTo == null && context.Hues.Count > 1 )
{
m_BeginHueSelector = true;
m_TypeToCompare = types[i][0];
return false;
}
}
if ( ourPack.GetComparedGroupAmount( types[i], true, new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo ) < amounts[i] )
{
index = i;
break;
}
}
}
}
if ( index == -1 )
{
if ( consumeType != ConsumeType.None )
if ( consumeExtra != null )
consumeExtra.Delete();
return true;
}
else
{
CraftRes res = m_arCraftRes.GetAt( index );
if ( res.MessageNumber > 0 )
message = res.MessageNumber;
else if ( res.MessageString != null && res.MessageString != String.Empty )
message = res.MessageString;
else
message = 502925; // You don't have the resources required to make that item.
return false;
}
}