当前位置: 首页>>代码示例>>C#>>正文


C# CraftSystem.UsesHueSelector方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:101,代码来源:CraftItem.cs


注:本文中的Server.Engines.Craft.CraftSystem.UsesHueSelector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。