Esempio n. 1
0
 private void recycle()
 {
     if (info != null)
     {
         ui.reportPane.Clear();
         info.Recycle(discardExcess.isOn, on_recycled);
     }
 }
Esempio n. 2
0
        /// <summary>
        ///   Calls the Recycle() method on an objects if it implements
        ///   the IRecyclable interface
        /// </summary>
        /// <param name="item">
        ///   Object whose Recycle() method will be called if supported by the object
        /// </param>
        private static void callRecycleIfSupported(ItemType item)
        {
            IRecyclable recycleable = item as IRecyclable;

            if (recycleable != null)
            {
                recycleable.Recycle();
            }
        }
Esempio n. 3
0
        public void Execute(IRecyclable target, bool didRecycle = false)
        {
            // don't scrap stuff that's already been scrapped due to it being in cargo of something else being scrapped!
            if (!target.IsDisposed)
            {
                var val = target.ScrapValue;
                if (target.Owner != null)                 // if not, it's already scrapped?
                {
                    target.Owner.StoredResources += val;
                    target.Owner.Log.Add(target.CreateLogMessage("We have scrapped " + target + " and reclaimed " + val + "."));
                }
                target.Dispose();

                if (!didRecycle)
                {
                    target.Recycle(this, true);
                }
            }
        }