Exemple #1
0
        public void Validate()
        {
            if (versionID != BvMain.configVersionID)
            {
                versionID = BvMain.configVersionID;
            }

            if (menu != null)
            {
                menu.Validate();
            }
            else
            {
                menu = PropMenuConfig.Defaults;
            }

            if (binds != null)
            {
                binds.Validate();
            }
            else
            {
                binds = BindsConfig.Defaults;
            }

            if (propertyBlock != null)
            {
                propertyBlock.Validate();
            }
            else
            {
                propertyBlock = PropBlockConfig.Defaults;
            }
        }
Exemple #2
0
        public override void Validate()
        {
            if (VersionID != vID)
            {
                VersionID    = vID;
                targeting    = TargetingConfig.Defaults;
                genUI        = UIConfig.Defaults;
                block        = PropBlockConfig.Defaults;
                binds        = BindsConfig.Defaults;
                WasConfigOld = true;
            }
            else
            {
                if (targeting != null)
                {
                    targeting.Validate();
                }
                else
                {
                    targeting = TargetingConfig.Defaults;
                }

                if (genUI != null)
                {
                    genUI.Validate();
                }
                else
                {
                    genUI = UIConfig.Defaults;
                }

                if (binds != null)
                {
                    binds.Validate();
                }
                else
                {
                    binds = BindsConfig.Defaults;
                }

                if (block != null)
                {
                    block.Validate();
                }
                else
                {
                    block = PropBlockConfig.Defaults;
                }

                if (genUI.legacyModeEnabled)
                {
                    targeting.canOpenIfPlacing = true;
                }
            }
        }
        /// <summary>
        /// Checks for any fields that have invalid values and resets them to the default if necessary.
        /// </summary>
        public void Validate()
        {
            PropBlockConfig defaults = Defaults;

            if (floatDiv <= 0f)
            {
                floatDiv = defaults.floatDiv;
            }

            // Float multipliers
            if (floatMult.X <= 0f)
            {
                floatMult.X = defaults.floatMult.X;
            }

            if (floatMult.Y <= 0f)
            {
                floatMult.Y = defaults.floatMult.Y;
            }

            if (floatMult.Z <= 0f)
            {
                floatMult.Z = defaults.floatMult.Z;
            }

            // Color multipiers
            if (colorMult.X <= 0)
            {
                colorMult.X = defaults.colorMult.X;
            }

            if (colorMult.Y <= 0)
            {
                colorMult.Y = defaults.colorMult.Y;
            }

            if (colorMult.Z <= 0)
            {
                colorMult.Z = defaults.colorMult.Z;
            }
        }
 static PropertyBlock()
 {
     cfg = PropBlockConfig.Defaults;
 }