コード例 #1
0
        void init_tank_manager()
        {
            if (tank_manager != null)
            {
                return;
            }
            tank_manager = new SwitchableTankManager(this);
            if (ModuleSave == null)
            {
                this.Log("ModuleSave is null. THIS SHOULD NEVER HAPPEN!");
                return;
            }
            ModuleSave.SetValue("Volume", Volume);
            tank_manager.Load(ModuleSave);
            var used_volume = tank_manager.TotalVolume;

            if (used_volume > Volume)
            {
                this.Log("WARNING: Volume limit is less than the total volume " +
                         "of preconfigured tanks: {} - {} = {}",
                         Volume, used_volume, Volume - used_volume);
                Volume = used_volume;
            }
            tank_manager.Volume = Volume;
        }
コード例 #2
0
        public override string GetInfo()
        {
            var info = string.Format("Max. Volume: {0}\n", Utils.formatVolume(Volume));

            if (ModuleSave != null)
            {
                info += SwitchableTankManager.GetInfo(this, ModuleSave);
            }
            return(info);
        }
コード例 #3
0
 public TankWrapper(ModuleSwitchableTank tank, SwitchableTankManager manager)
 {
     this.tank         = tank;
     this.manager      = manager;
     VolumeField.Value = tank.Volume;
 }
コード例 #4
0
        public static string GetInfo(PartModule host, ConfigNode node)
        {
            var mgr = new SwitchableTankManager(host);

            return(mgr.GetInfo(node));
        }