Exemple #1
0
 private void SetShiftLightVariables(SdkWrapper.SessionInfoUpdatedEventArgs e)
 {
     SetShiftLights(e.SessionInfo);
     int driverID;
     Int32.TryParse(YamlParser.Parse(e.SessionInfo, "DriverInfo:DriverCarIdx:"), out driverID);
     Int32.TryParse(YamlParser.Parse(e.SessionInfo, String.Format("DriverInfo:Drivers:CarIdx:{{{0}}}{1}:", driverID, "CarID")), out this.SavedTelemetry.MyCarID);
     this.UseCustomShiftLights = false;
     this.CurrentCarShiftStyle = CarShiftStyles.None;
     var foundStyle = false;
     foreach (var style in ShiftLightData.CarShiftStyles)
     {
         if (style.CarID == this.SavedTelemetry.MyCarID)
         {
             this.UseCustomShiftLights = style.UseCustomRPMS;
             this.CurrentCarShiftStyle = style.ShiftStyle;
             foundStyle = true;
         }
     }
     if (this.UseCustomShiftLights)
     {
         var found = false;
         foreach (var carShiftRPMData in this.ShiftLightData.CarShiftRPMs.Where(carShiftRPMData => carShiftRPMData.CarID == this.SavedTelemetry.MyCarID))
         {
             found = true;
             this.CurrentShiftRPMData = carShiftRPMData;
         }
         if (!found)
         {
             this.UseCustomShiftLights = false;
         }
     }
     MatchedShiftStyles = new List<ShiftStyleEnum>();
     UseTripleSegmentStyle = new List<bool>();
     UseTripleSegmentStyle.Clear();
     MatchedShiftStyles.Clear();
     foreach (var unit in CurrentConfiguration.DisplayConfigurations)
     {
         if (foundStyle)
         {
             this.MatchedShiftStyles.Add(
                 unit.MatchCarShiftStyle
                     ? LEDs.MatchCarShiftStyle(unit.MatchCarShiftStyleOption, this.CurrentCarShiftStyle, unit.MatchRedShift)
                     : unit.ShiftLightStyle);
             this.UseTripleSegmentStyle.Add(unit.MatchCarShiftStyle ? this.CurrentCarShiftStyle == CarShiftStyles.LeftToRight3Segments : unit.ShiftClumps);
         }
         else
         {
             this.MatchedShiftStyles.Add(unit.ShiftLightStyle);
             this.UseTripleSegmentStyle.Add(unit.ShiftClumps);
         }
     }
 }
Exemple #2
0
        public static ShiftStyleEnum MatchCarShiftStyle(MatchCarShiftOptions option, CarShiftStyles carStyle, bool useRedShift)
        {
            switch (carStyle)
            {
            case CarShiftStyles.LeftToRight:
                switch (option)
                {
                case MatchCarShiftOptions.Single:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenProgressiveRedShift);
                    }
                    return(ShiftStyleEnum.GreenProgressive);

                case MatchCarShiftOptions.DualLeft:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenProgressiveRedShiftFirstHalf);
                    }
                    return(ShiftStyleEnum.GreenProgressiveFirstHalf);

                case MatchCarShiftOptions.DualRight:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenProgressiveRedShiftSecondHalf);
                    }
                    return(ShiftStyleEnum.GreenProgressiveSecondHalf);
                }
                break;

            case CarShiftStyles.LeftToRight3Segments:
                switch (option)    /////
                {
                case MatchCarShiftOptions.Single:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenProgressiveRedShift);
                    }
                    return(ShiftStyleEnum.GreenProgressive);

                case MatchCarShiftOptions.DualLeft:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenProgressiveRedShiftFirstHalf);
                    }
                    return(ShiftStyleEnum.GreenProgressiveFirstHalf);

                case MatchCarShiftOptions.DualRight:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenProgressiveRedShiftSecondHalf);
                    }
                    return(ShiftStyleEnum.GreenProgressiveSecondHalf);
                }
                break;

            case CarShiftStyles.RightToLeft:     ///////Not Implemented yet (Does this type Exist??)
                switch (option)
                {
                case MatchCarShiftOptions.Single:
                    break;

                case MatchCarShiftOptions.DualLeft:
                    break;

                case MatchCarShiftOptions.DualRight:
                    break;
                }
                break;

            case CarShiftStyles.Converging:
                switch (option)
                {
                case MatchCarShiftOptions.Single:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenConvergingRedShift);
                    }
                    return(ShiftStyleEnum.GreenConverging);

                case MatchCarShiftOptions.DualLeft:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenConvergingRedShiftFirstHalf);
                    }
                    return(ShiftStyleEnum.GreenConvergingFirstHalf);

                case MatchCarShiftOptions.DualRight:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.GreenConvergingRedShiftSecondHalf);
                    }
                    return(ShiftStyleEnum.GreenConvergingSecondHalf);
                }
                break;

            case CarShiftStyles.SingleLight:
                switch (option)
                {
                case MatchCarShiftOptions.Single:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.BasicShiftLight);
                    }
                    return(ShiftStyleEnum.BasicShiftLight);

                case MatchCarShiftOptions.DualLeft:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.BasicShiftLight);
                    }
                    return(ShiftStyleEnum.BasicShiftLight);

                case MatchCarShiftOptions.DualRight:
                    if (useRedShift)
                    {
                        return(ShiftStyleEnum.BasicShiftLight);
                    }
                    return(ShiftStyleEnum.BasicShiftLight);
                }
                break;

            case CarShiftStyles.NoLights:
                switch (option)
                {
                case MatchCarShiftOptions.Single:
                    return(ShiftStyleEnum.None);

                case MatchCarShiftOptions.DualLeft:
                    return(ShiftStyleEnum.None);

                case MatchCarShiftOptions.DualRight:
                    return(ShiftStyleEnum.None);
                }
                break;

            case CarShiftStyles.None:
                return(ShiftStyleEnum.None);
            }
            return(ShiftStyleEnum.None);
        }
Exemple #3
0
 public static ShiftStyleEnum MatchCarShiftStyle(MatchCarShiftOptions option, CarShiftStyles carStyle, bool useRedShift)
 {
     switch (carStyle)
     {
         case CarShiftStyles.LeftToRight:
             switch (option)
             {
                 case MatchCarShiftOptions.Single:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenProgressiveRedShift;
                     }
                     return ShiftStyleEnum.GreenProgressive;
                 case MatchCarShiftOptions.DualLeft:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenProgressiveRedShiftFirstHalf;
                     }
                     return ShiftStyleEnum.GreenProgressiveFirstHalf;
                 case MatchCarShiftOptions.DualRight:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenProgressiveRedShiftSecondHalf;
                     }
                     return ShiftStyleEnum.GreenProgressiveSecondHalf;
             }
             break;
         case CarShiftStyles.LeftToRight3Segments:
             switch (option)/////
             {
                 case MatchCarShiftOptions.Single:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenProgressiveRedShift;
                     }
                     return ShiftStyleEnum.GreenProgressive;
                 case MatchCarShiftOptions.DualLeft:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenProgressiveRedShiftFirstHalf;
                     }
                     return ShiftStyleEnum.GreenProgressiveFirstHalf;
                 case MatchCarShiftOptions.DualRight:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenProgressiveRedShiftSecondHalf;
                     }
                     return ShiftStyleEnum.GreenProgressiveSecondHalf;
             }
             break;
         case CarShiftStyles.RightToLeft: ///////Not Implemented yet (Does this type Exist??)
             switch (option)
             {
                 case MatchCarShiftOptions.Single:
                     break;
                 case MatchCarShiftOptions.DualLeft:
                     break;
                 case MatchCarShiftOptions.DualRight:
                     break;
             }
             break;
         case CarShiftStyles.Converging:
             switch (option)
             {
                 case MatchCarShiftOptions.Single:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenConvergingRedShift;
                     }
                     return ShiftStyleEnum.GreenConverging;
                 case MatchCarShiftOptions.DualLeft:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenConvergingRedShiftFirstHalf;
                     }
                     return ShiftStyleEnum.GreenConvergingFirstHalf;
                 case MatchCarShiftOptions.DualRight:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.GreenConvergingRedShiftSecondHalf;
                     }
                     return ShiftStyleEnum.GreenConvergingSecondHalf;
             }
             break;
         case CarShiftStyles.SingleLight:
             switch (option)
             {
                 case MatchCarShiftOptions.Single:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.BasicShiftLight;
                     }
                     return ShiftStyleEnum.BasicShiftLight;
                 case MatchCarShiftOptions.DualLeft:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.BasicShiftLight;
                     }
                     return ShiftStyleEnum.BasicShiftLight;
                 case MatchCarShiftOptions.DualRight:
                     if (useRedShift)
                     {
                         return ShiftStyleEnum.BasicShiftLight;
                     }
                     return ShiftStyleEnum.BasicShiftLight;
             }
             break;
         case CarShiftStyles.NoLights:
             switch (option)
             {
                 case MatchCarShiftOptions.Single:
                     return ShiftStyleEnum.None;
                 case MatchCarShiftOptions.DualLeft:
                     return ShiftStyleEnum.None;
                 case MatchCarShiftOptions.DualRight:
                     return ShiftStyleEnum.None;
             }
             break;
         case CarShiftStyles.None:
             return ShiftStyleEnum.None;
     }
     return ShiftStyleEnum.None;
 }