public override void TakeSettingData(StationBase oldStationData)
        {
            TradeStation loadedData   = (TradeStation)oldStationData;
            List <Item>  currentGoods = _goods;

            _goods = loadedData._goods;

            foreach (Item nowItem in Goods)
            {
                foreach (Item beforeItem in currentGoods)
                {
                    if (nowItem.SerializedDefinition != beforeItem.SerializedDefinition)
                    {
                        continue;
                    }

                    nowItem.CurrentCargo = beforeItem.CurrentCargo;

                    break; // first out
                }
            }

            ProduceFrom = loadedData.ProduceFrom;
            ReduceFrom  = loadedData.ReduceFrom;
        }
Пример #2
0
        public static StationBase Factory(string blockName)
        {
            if (string.IsNullOrWhiteSpace(blockName))
            {
                throw new ArgumentException("Station Block name was empty");
            }

            StationBase station;

            switch (blockName)
            {
            case TradeStation.StationType:
                station = new TradeStation(true);
                break;

            case IronForge.StationType:
                station = new IronForge(true);
                break;

            case MiningStation.StationType:
                station = new MiningStation(true);
                break;

            default:
                throw new ArgumentException("Station Block name did not match a station kind");
            }

            station.TakeSettingData(null);
            return(station);
        }