コード例 #1
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;
        }
コード例 #2
0
 public SetupEntriesTab(string key, SetupEntry[] entries, AcLocaleProvider localeProvider)
 {
     Key         = key;
     DisplayName = FixName(localeProvider.GetString("TABS", key) ?? key, true);
     Entries     = entries;
 }
コード例 #3
0
 public CarSetupEntry([Localizable(false), NotNull] string key, [CanBeNull] AcLocaleProvider localeProvider, [NotNull] DataWrapper data)
     : this(key, data.GetIniFile("setup.ini")[key], localeProvider, data)
 {
 }