private int HandleSpeedDown(int baseValue, int totalValue, int orignalSpeed)
 {
     if (this.bUseStepAdjustWhenSpeedDown)
     {
         int  num  = 0;
         bool flag = false;
         for (int i = 0; i < this.SpeedDownConfigs.get_Count(); i++)
         {
             RangeConfig rangeConfig = this.SpeedDownConfigs.get_Item(i);
             int         num2        = 0;
             int         num3        = 0;
             if (rangeConfig.Intersect(this.bReferenceBaseSpeedWhenSpeedDown ? baseValue : 0, totalValue, orignalSpeed, out num2, out num3))
             {
                 flag = true;
                 int num4 = num3 - num2;
                 num4 *= 100 - rangeConfig.Attenuation;
                 num4 /= 100;
                 num  += num4;
             }
             else if (flag)
             {
                 break;
             }
         }
         return(orignalSpeed - num);
     }
     for (int j = 0; j < this.SpeedDownConfigs.get_Count(); j++)
     {
         if (this.SpeedDownConfigs.get_Item(j).Intersect(this.bReferenceBaseSpeedWhenSpeedUp ? baseValue : 0, totalValue))
         {
             return(this.SpeedDownConfigs.get_Item(j).MaxValue - (this.SpeedDownConfigs.get_Item(j).MaxValue - totalValue) * (100 - this.SpeedDownConfigs.get_Item(j).Attenuation) / 100);
         }
     }
     return(totalValue);
 }
Esempio n. 2
0
        private static int HandleSpeedUp(int baseValue, int totalValue, int orignalSpeed)
        {
            int  num  = 0;
            bool flag = false;

            for (int i = 0; i < s_SpeedUpRanges.Length; i++)
            {
                RangeConfig config = s_SpeedUpRanges[i];
                int         outMin = 0;
                int         outMax = 0;
                if (config.Intersect(baseValue, orignalSpeed, totalValue, out outMin, out outMax))
                {
                    flag = true;
                    int num5 = outMax - outMin;
                    num5 *= 100 - config.Attenuation;
                    num5 /= 100;
                    num  += num5;
                }
                else if (flag)
                {
                    break;
                }
            }
            return(orignalSpeed + num);
        }