Ejemplo n.º 1
0
 public override string ToString()
 {
     return(Spec.MaxArray != null && Spec.MaxArray.All(x => x == 1)
         ? string.Join("\u200a", NowArray.Select(n => (n % 10).ToString()))
         : Spec.MaxArray != null
             ? string.Join(" ", NowArray.Zip(Spec.MaxArray, (n, m) => $"{n}/{m}"))
             : $"{Now}/{Spec.Max}");
 }
Ejemplo n.º 2
0
        public bool AdjustCount(int progress)
        {
            if (!Spec.AdjustCount)
            {
                return(false);
            }
            if (NowArray != null)
            {
                if (progress != 100)
                {
                    return(false);
                }
                NowArray = NowArray.Zip(Spec.MaxArray, Math.Max).ToArray();
                return(true);
            }
            var next = 0;

            switch (progress)
            {
            case 0:
                next = 50;
                break;

            case 50:
                next = 80;
                break;

            case 80:
                next = 100;
                break;

            case 100:
                next = 100000;
                break;
            }
            var now = Now + Spec.Shift;
            var max = Spec.Max + Spec.Shift;
            var low = (int)Math.Ceiling(max * progress / 100.0);

            if (low >= max && progress != 100)
            {
                low = max - 1;
            }
            var high = (int)Math.Ceiling(max * next / 100.0);

            if (now < low)
            {
                Now = low - Spec.Shift;
                return(true);
            }
            if (now >= high)
            {
                Now = high - 1 - Spec.Shift;
                return(true);
            }
            return(false);
        }