コード例 #1
0
ファイル: CraftState.cs プロジェクト: justdanofficial/khaeros
 public CraftState( Mobile crafter, BaseTool tool, int componentAmount )
 {
     m_Crafter = crafter;
     m_Tool = tool;
     m_GumpComponents = new GumpComponent[componentAmount];
     for ( int i = 0; i < componentAmount; i++ )
         m_GumpComponents[i] = new GumpComponent();
 }
コード例 #2
0
ファイル: CraftState.cs プロジェクト: justdanofficial/khaeros
        public virtual void RemoveComponent( int index, bool skipupdate )
        {
            Type type = GumpComponents[index].Type;
            if ( type == null )
                return;
            if ( !m_Components.ContainsKey( type ) )
                return;

            if ( m_Components[type] > 1 )
                m_Components[type]--;
            else
                m_Components.Remove( type );

            GumpComponents[index] = new GumpComponent();

            if (!skipupdate)
                Update();
        }
コード例 #3
0
ファイル: CraftState.cs プロジェクト: justdanofficial/khaeros
        public virtual bool ReadRecipe( BaseRecipe recipe )
        {
            if ( recipe.ComponentTypes == null )
            {
                m_LastMessage = "This recipe is blank.";
                return false;
            }

            m_GumpComponents = new GumpComponent[recipe.ComponentTypes.Length];

            for ( int i=0; i<recipe.ComponentTypes.Length; i++ )
            {
                m_GumpComponents[i] = new GumpComponent();
                if ( recipe.ComponentTypes[i] == null )
                    continue;

                Item instance = (Item)Activator.CreateInstance(recipe.ComponentTypes[i]);
                if ( !AddComponent( instance, i, true ) )
                {
                    m_LastMessage = "You cannot use one or more of the listed components.";
                    Update();
                    return false;
                }
            }

            m_LastMessage = "You successfully add the components according to the recipe.";
            Update();
            return true; // success
        }