Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves all block ITerminalProperty values.
        /// </summary>
        private List <IScrollableProp> GetScrollableProps()
        {
            List <ITerminalProperty> properties = new List <ITerminalProperty>(12);
            List <IScrollableProp>   scrollables;
            IMyBatteryBlock          battery = TBlock as IMyBatteryBlock;
            IMyTerminalControl       terminalControl;
            string name;

            TBlock.GetProperties(properties);
            scrollables = new List <IScrollableProp>(properties.Count);

            foreach (ITerminalProperty prop in properties)
            {
                name            = GetTooltipName(prop);
                terminalControl = prop as IMyTerminalControl;

                if (name.Length > 0 && terminalControl != null && terminalControl.Visible(TBlock))
                {
                    if (prop is ITerminalProperty <bool> )
                    {
                        scrollables.Add(new BoolProperty(name, (ITerminalProperty <bool>)prop, this));
                    }
                    else if (prop is ITerminalProperty <float> )
                    {
                        scrollables.Add(new FloatProperty(name, (ITerminalProperty <float>)prop, this));
                    }
                    else if (prop is ITerminalProperty <Color> )
                    {
                        scrollables.AddRange(ColorProperty.GetColorProperties(name, this, (ITerminalProperty <Color>)prop));
                    }
                }
            }

            if (battery != null)
            {
                scrollables.Add(new BattProperty(battery));
            }

            return(scrollables);
        }
Ejemplo n.º 2
0
 public BattProperty(IMyBatteryBlock battery)
 {
     this.battery = battery;
     name         = "Charge Mode ";
     index        = GetChargeModeIndex();
 }