public void RepresentSignal(LampType lamp, ConsoleColor color, bool signal)
        {
            int lampX = LampCoordinates[lamp].X;
                int lampY = LampCoordinates[lamp].Y;

            if (signal)
                    SetSignal(lampX, lampY, color);
                else
                    ResetSiganl(lampX, lampY);
        }
Пример #2
0
        public LampListData(LampMapping lampMapping)
        {
            Id          = lampMapping.Id;
            IsCoil      = lampMapping.IsCoil;
            Source      = lampMapping.Source;
            Description = lampMapping.Description;
            Device      = lampMapping.Device;
            DeviceItem  = lampMapping.DeviceItem;
            Type        = lampMapping.Type;
            Channel     = lampMapping.Channel;
            FadingSteps = lampMapping.FadingSteps;

            LampMapping = lampMapping;
        }
Пример #3
0
        public Lamp(LampType lampType, string manufacturer, double cost, string imageRef, int id = 0)
            : base(id)
        {
            if (String.IsNullOrEmpty(manufacturer))
            {
                throw new ArgumentNullException(nameof(manufacturer));
            }

            if (cost <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(cost));
            }


            LampType     = lampType;
            Manufacturer = manufacturer;
            Cost         = cost;
            ImageRef     = imageRef;
        }
Пример #4
0
        /// <summary>
        ///  Initializes a new instance of the BerlinClock class.
        /// </summary>
        public BerlinClock()
        {
            Second = LampType.White;

            _hour1 = new LampType[4];
            _hour2 = new LampType[4];

            _minute1 = new LampType[11];
            _minute2 = new LampType[4];

            Reset();

            _colorIdentifiers = new Dictionary <LampType, string>()
            {
                { LampType.Red, "R" },
                { LampType.Yellow, "Y" },
                { LampType.White, "O" }
            };
        }
Пример #5
0
            internal Lamp(LampType Type)
            {
                this.Type = Type;
                switch (Type)
                {
                case LampType.None:
                    this.Text = null;
                    break;

                case LampType.Ats:
                    this.Text = Translations.GetInterfaceString("lamps_ats");
                    break;

                case LampType.AtsOperation:
                    this.Text = Translations.GetInterfaceString("lamps_atsoperation");
                    break;

                case LampType.AtsPPower:
                    this.Text = Translations.GetInterfaceString("lamps_atsppower");
                    break;

                case LampType.AtsPPattern:
                    this.Text = Translations.GetInterfaceString("lamps_atsppattern");
                    break;

                case LampType.AtsPBrakeOverride:
                    this.Text = Translations.GetInterfaceString("lamps_atspbrakeoverride");
                    break;

                case LampType.AtsPBrakeOperation:
                    this.Text = Translations.GetInterfaceString("lamps_atspbrakeoperation");
                    break;

                case LampType.AtsP:
                    this.Text = Translations.GetInterfaceString("lamps_atsp");
                    break;

                case LampType.AtsPFailure:
                    this.Text = Translations.GetInterfaceString("lamps_atspfailure");
                    break;

                case LampType.Atc:
                    this.Text = Translations.GetInterfaceString("lamps_atc");
                    break;

                case LampType.AtcPower:
                    this.Text = Translations.GetInterfaceString("lamps_atcpower");
                    break;

                case LampType.AtcUse:
                    this.Text = Translations.GetInterfaceString("lamps_atcuse");
                    break;

                case LampType.AtcEmergency:
                    this.Text = Translations.GetInterfaceString("lamps_atcemergency");
                    break;

                case LampType.Eb:
                    this.Text = Translations.GetInterfaceString("lamps_eb");
                    break;

                case LampType.ConstSpeed:
                    this.Text = Translations.GetInterfaceString("lamps_constspeed");
                    break;

                default:
                    this.Text = "TEXT";
                    break;
                }
                Fonts.OpenGlFont font = Fonts.NormalFont;
                for (int i = 0; i < HUD.CurrentHudElements.Length; i++)
                {
                    if (HUD.CurrentHudElements[i].Subject.Equals("ats", StringComparison.OrdinalIgnoreCase))
                    {
                        font = HUD.CurrentHudElements[i].Font;
                        break;
                    }
                }
                System.Drawing.Size size = MeasureString(font, this.Text);
                this.Width  = size.Width;
                this.Height = size.Height;
            }
Пример #6
0
 internal Lamp(LampType Type)
 {
     this.Type = Type;
     switch (Type) {
         case LampType.None:
             this.Text = null;
             break;
         case LampType.Ats:
             this.Text = Interface.GetInterfaceString("lamps_ats");
             break;
         case LampType.AtsOperation:
             this.Text = Interface.GetInterfaceString("lamps_atsoperation");
             break;
         case LampType.AtsPPower:
             this.Text = Interface.GetInterfaceString("lamps_atsppower");
             break;
         case LampType.AtsPPattern:
             this.Text = Interface.GetInterfaceString("lamps_atsppattern");
             break;
         case LampType.AtsPBrakeOverride:
             this.Text = Interface.GetInterfaceString("lamps_atspbrakeoverride");
             break;
         case LampType.AtsPBrakeOperation:
             this.Text = Interface.GetInterfaceString("lamps_atspbrakeoperation");
             break;
         case LampType.AtsP:
             this.Text = Interface.GetInterfaceString("lamps_atsp");
             break;
         case LampType.AtsPFailure:
             this.Text = Interface.GetInterfaceString("lamps_atspfailure");
             break;
         case LampType.Atc:
             this.Text = Interface.GetInterfaceString("lamps_atc");
             break;
         case LampType.AtcPower:
             this.Text = Interface.GetInterfaceString("lamps_atcpower");
             break;
         case LampType.AtcUse:
             this.Text = Interface.GetInterfaceString("lamps_atcuse");
             break;
         case LampType.AtcEmergency:
             this.Text = Interface.GetInterfaceString("lamps_atcemergency");
             break;
         case LampType.Eb:
             this.Text = Interface.GetInterfaceString("lamps_eb");
             break;
         case LampType.ConstSpeed:
             this.Text = Interface.GetInterfaceString("lamps_constspeed");
             break;
         default:
             this.Text = "TEXT";
             break;
     }
     Fonts.OpenGlFont font = Fonts.NormalFont;
     for (int i = 0; i < Interface.CurrentHudElements.Length; i++) {
         if (Interface.CurrentHudElements[i].Subject.Equals("ats", StringComparison.OrdinalIgnoreCase)) {
             font = Interface.CurrentHudElements[i].Font;
             break;
         }
     }
     System.Drawing.Size size = MeasureString(font, this.Text);
     this.Width = size.Width;
     this.Height = size.Height;
 }
Пример #7
0
 public Lamp(String fancyName, SupplementaryType supplementaryType, double price, LampType lampType, int flux)
     : base(fancyName, supplementaryType, price)
 {
     this.lampType = lampType;
     this.flux = flux;
 }
Пример #8
0
 public Lamp(LampType type, LampColor color, int timeValue)
 {
     LampTimeValue = timeValue;
     LampType      = type;
     LampColor     = color;
 }
Пример #9
0
 /// <summary>
 /// Determines the color of the lamp once it is switched on.
 /// </summary>
 private LampColor GetLampOnColor(LampType type, int lampNo)
 {
     switch (type)
     {
         case LampType.SecondChange:
             return LampColor.Yellow;
         case LampType.GroupedHour:
             return LampColor.Red;
         case LampType.LeftHour:
             return LampColor.Red;
         case LampType.GroupedMinute:
             return lampNo % 3 == 0 ? LampColor.Red : LampColor.Yellow;
         case LampType.LeftMinute:
             return LampColor.Yellow;
         default:
             throw new Exception("Color functionality not implemented for lamp of type " + type);
     }
 }
Пример #10
0
 /// <summary>
 /// At any moment of time, determines if the lamp, defined by the type and its position, is on.
 /// </summary>
 private bool IsLampOn(LampType type, int lampNo, DateTime24 time)
 {
     switch (type)
     {
         case LampType.SecondChange:
             return time.Second % 2 == 0;
         case LampType.GroupedHour:
             return time.Hour / 5 >= lampNo;
         case LampType.LeftHour:
             return time.Hour % 5 >= lampNo;
         case LampType.GroupedMinute:
             return time.Minute / 5 >= lampNo;
         case LampType.LeftMinute:
             return time.Minute % 5 >= lampNo;
         default:
             throw new Exception("On functionality not implemented for lamp of type " + type);
     }
 }
Пример #11
0
 public void SetRespawnLamp()
 {
     lampType = LampType.RESPAWN;
     SetLightColor(RESPAWN_LAMP_COLOR);
 }
Пример #12
0
 public void SetProximityLamp()
 {
     lampType = LampType.PROXIMITY;
     SetLightColor(PROXIMITY_LAMP_COLOR);
 }
Пример #13
0
 public void SetNormalLamp()
 {
     lampType = LampType.NORMAL;
     SetLightColor(DEFAULT_LAMP_COLOR);
 }
Пример #14
0
 private string GetColorIdentifier(LampType lamp)
 {
     return(_colorIdentifiers[lamp]);
 }