Пример #1
0
 protected override void Load(IniFileSection section)
 {
     base.Load(section);
     LapsCount = section.GetInt("LAPS", 5);
     WaitTime  = TimeSpan.FromSeconds(section.GetInt("WAIT_TIME", 60));
     JoinType  = section.GetIntEnum("IS_OPEN", ServerPresetRaceJoinType.CloseAtStart);
 }
Пример #2
0
            public ControlsInput(IniFileSection section, Keys key)
            {
                _joy          = section.GetInt("JOY", -1);
                _button       = section.GetInt("BUTTON", -1);
                _pov          = section.GetInt("__CM_POV", -1);
                _povDirection = section.GetIntEnum("__CM_POV_DIR", DirectInputPovDirection.Up);

                var k = section.GetInt("KEY", -1);

                _key = k == -1 ? key : (Keys)k;
            }
Пример #3
0
        public CarSetupEntry([NotNull] string key, IniFileSection section, [CanBeNull] AcLocaleProvider localeProvider, [NotNull] DataWrapper data)
        {
            Key         = key;
            DisplayName = localeProvider?.GetString("SETUP", section.GetNonEmpty("NAME"))
                          ?? CarSetupObject.FixEntryName(section.GetNonEmpty("NAME"), false) ?? key;
            HelpInformation = localeProvider?.GetString(AcLocaleProvider.CategoryTag, section.GetNonEmpty("HELP")) ?? section.GetNonEmpty("HELP");

            var ratios = section.GetNonEmpty("RATIOS");

            if (ratios != null)
            {
                Values    = data.GetRtoFile(ratios).Values;
                Minimum   = 0;
                Maximum   = Values.Count - 1;
                Step      = 1;
                StepsMode = CarSetupStepsMode.Steps;
                TabKey    = "GEARS";
            }
            else
            {
                Minimum      = section.GetDouble("MIN", 0);
                Maximum      = section.GetDouble("MAX", Minimum + 100);
                Step         = FixedStep(key) ?? section.GetDouble("STEP", 1d);
                StepsMode    = section.GetIntEnum("SHOW_CLICKS", CarSetupStepsMode.ActualValue);
                UnitsPostfix = StepsMode == CarSetupStepsMode.ActualValue ? GetUnitsPostfix(key) : null;
                TabKey       = section.GetNonEmpty("TAB");
            }

            var defaultValue = GetDefaultValue(key, data);

            DefaultValue    = defaultValue ?? (Minimum + Maximum) / 2f;
            HasDefaultValue = defaultValue.HasValue;

            var range = Maximum - Minimum;

            VisualStep = range / Step < 10 ? Step : range / 10;
        }