本文整理匯總了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;
}
}