예제 #1
0
 public void LoadConfig(TimedBlockConfig cfg)
 {
     /*Dictionary<BlockID_Type, IMyGridTerminalSystem> gridTerminals = new Dictionary<BlockID_Type, IMyGridTerminalSystem>();
      *
      * //..Add all the blocks
      * foreach (BlockIdentifier blockId in cfg.Blocks)
      * {
      *  IMyCubeGrid grid = MyAPIGateway.Entities.GetEntityById(blockId.GridID) as IMyCubeGrid;
      *
      *  Log.Write(" - Access grid: " + grid.EntityId + " (" + grid.DisplayName + ")");
      *
      *  if (!gridTerminals.ContainsKey(grid.EntityId))
      *      gridTerminals.Add(grid.EntityId, MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid));
      *
      *  IMyGridTerminalSystem gts = gridTerminals[grid.EntityId];
      *  IMyFunctionalBlock block = gts.GetBlockWithId(blockId.BlockID) as IMyFunctionalBlock;
      *
      *  Log.Write(" - Access terminal: " + gridTerminals[grid.EntityId]);
      *  Log.Write(" - Access block: " + gts.GetBlockWithId(blockId.BlockID).GetType().FullName);
      *  Log.Write(" - Access block (functional): " + (gts.GetBlockWithId(blockId.BlockID) as IMyFunctionalBlock).GetType().FullName);
      *
      *  _blocks.Add(block);
      * }
      *
      * //..Add all the times
      * foreach(TimePair pair in cfg.Times)
      * {
      *  _todayTimes.Add(pair);
      * }*/
 }
예제 #2
0
        public TimedBlockController(int id, bool testing = false)
        {
            _testing = testing;
            Id       = id;

            //..load the config file for this timed block controller (if there is one)
            //..if the config file is null, don't do anything
            TimedBlockConfig cfg = FileController.LoadFile <TimedBlockConfig>(FILENAME_CFG);

            if (cfg != null)
            {
                LoadConfig(cfg);
            }
        }