Get() public static method

public static Get ( string key ) : ICalcViewRange
key string
return ICalcViewRange
        /// <summary>
        /// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
        /// </summary>
        internal void Calculate()
        {
            var ships = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();

            this.TotalLevel   = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
            this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;

            this.MinAirSuperiorityPotential = ships.Sum(s => s.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Minimum));
            this.MaxAirSuperiorityPotential = ships.Sum(s => s.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Maximum));
            this.Speed = ships.All(x => x.Info.Speed == ShipSpeed.Fast)
                                ? FleetSpeed.Fast
                                : ships.All(x => x.Info.Speed == ShipSpeed.Low)
                                        ? FleetSpeed.Low
                                        : FleetSpeed.Hybrid;

            var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);

            this.ViewRange         = logic.Calc(this.source);
            this.ViewRangeCalcType = logic.Name;

            if (this.Calculated != null)
            {
                this.Calculated(this, new EventArgs());
            }
        }
Example #2
0
 /// <summary>
 /// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
 /// </summary>
 public void Calculate()
 {
     this.TotalLevel              = this.Ships.HasItems() ? this.Ships.Sum(x => x.Level) : 0;
     this.AverageLevel            = this.Ships.HasItems() ? (double)this.TotalLevel / this.Ships.Length : 0.0;
     this.AirSuperiorityPotential = this.Ships.Sum(s => s.CalcAirSuperiorityPotential());
     this.TotalViewRange          = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType).Calc(this);
     this.Speed = this.Ships.All(s => s.Info.Speed == Speed.Fast) ? Speed.Fast : Speed.Low;
 }
Example #3
0
        /// <summary>
        /// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
        /// </summary>
        public void Calculate()
        {
            var ships           = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();
            var firstFleetShips = this.source.FirstOrDefault()?.Ships.WithoutEvacuated().ToArray() ?? new Ship[0];

            List <SecondResult> partPercent = new List <SecondResult>();

            List <ShipSlot>     SecondSlotList = new List <ShipSlot>(this.MakeSecondList(ships));
            List <SecondResult> TotalSecond    = new List <SecondResult>(MakeSecondResult(SecondSlotList));

            List <int> HitList = new List <int>(this.MakeHitList(ships));

            for (int i = 0; i < HitList.Count; i++)
            {
                partPercent.Add(new SecondResult {
                    Hit = HitList[i], SecondEncounter = TotalSecond.Where(x => x.Hit == HitList[i]).Sum(y => y.SecondEncounter)
                });
            }

            if (ships.HasItems())
            {
                this.UsedFuel = ships.Sum(x => x.UsedFuel);
                this.UsedBull = ships.Sum(x => x.UsedBull);
            }
            else
            {
                this.UsedFuel = this.UsedBull = 0;
            }

            this.TotalLevel   = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
            this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
            this.MinAirSuperiorityPotential = firstFleetShips.Sum(x => x.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Minimum));
            this.MaxAirSuperiorityPotential = firstFleetShips.Sum(x => x.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Maximum));
            this.EncounterPercent           = TotalSecond.Sum(x => x.SecondEncounter);
            this.PartEncounterPercent       = partPercent;
            this.FirstEncounter             = ships.Sum(s => s.CalcFirstEncounterPercent());
            this.Speed = ships.All(x => x.Info.Speed == ShipSpeed.Fast)
                                ? FleetSpeed.Fast
                                : ships.All(x => x.Info.Speed == ShipSpeed.Low)
                                        ? FleetSpeed.Low
                                        : FleetSpeed.Hybrid;

            var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);

            this.ViewRange         = logic.Calc(this.source);
            this.ViewRangeCalcType = logic.Name;

            this.Calculated?.Invoke(this, new EventArgs());
        }
Example #4
0
        /// <summary>
        /// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
        /// </summary>
        public void Calculate()
        {
            var ships           = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();
            var firstFleetShips = this.source.FirstOrDefault()?.Ships.WithoutEvacuated().ToArray() ?? new Ship[0];

            this.TotalLevel   = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
            this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
            this.MinAirSuperiorityPotential = firstFleetShips.Sum(x => x.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Minimum));
            this.MaxAirSuperiorityPotential = firstFleetShips.Sum(x => x.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Maximum));
            this.Speed = new FleetSpeed(Array.ConvertAll(ships, x => x.Speed));

            var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);

            this.ViewRange         = logic.Calc(this.source);
            this.ViewRangeCalcType = logic.Name;

            this.Calculated?.Invoke(this, new EventArgs());
        }
Example #5
0
        /// <summary>
        /// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
        /// </summary>
        public void Calculate()
        {
            var ships           = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();
            var firstFleetShips = this.source.FirstOrDefault()?.Ships.WithoutEvacuated().ToArray() ?? new Ship[0];

            this.TotalLevel                 = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
            this.AverageLevel               = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
            this.AirSuperiorityPotential    = firstFleetShips.Sum(s => s.CalcAirSuperiorityPotential());
            this.MinAirSuperiorityPotential = firstFleetShips.Sum(s => s.CalcMinAirSuperiorityPotential());
            this.MaxAirSuperiorityPotential = firstFleetShips.Sum(s => s.CalcMaxAirSuperiorityPotential());
            this.Speed = ships.All(x => x.Info.Speed == ShipSpeed.Fast)
                                ? FleetSpeed.Fast
                                : ships.All(x => x.Info.Speed == ShipSpeed.Low)
                                        ? FleetSpeed.Low
                                        : FleetSpeed.Hybrid;

            var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);

            this.ViewRange         = logic.Calc(this.source);
            this.ViewRangeCalcType = logic.Name;

            this.Calculated?.Invoke(this, new EventArgs());
        }
Example #6
0
        /// <summary>
        /// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
        /// </summary>
        public void Calculate()
        {
            var ships           = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();
            var firstFleetShips = this.source.FirstOrDefault()?.Ships.WithoutEvacuated().ToArray() ?? new Ship[0];

            List <SecondResult> partPercent = new List <SecondResult>();

            List <ShipSlot>     SecondSlotList = new List <ShipSlot>(this.MakeSecondList(ships));
            List <SecondResult> TotalSecond    = new List <SecondResult>(MakeSecondResult(SecondSlotList));

            List <int> HitList = new List <int>(this.MakeHitList(ships));

            for (int i = 0; i < HitList.Count; i++)
            {
                partPercent.Add(new SecondResult {
                    Hit = HitList[i], SecondEncounter = TotalSecond.Where(x => x.Hit == HitList[i]).Sum(y => y.SecondEncounter)
                });
            }

            if (ships.HasItems())
            {
                this.UsedFuel    = ships.Sum(x => x.UsedFuel);
                this.UsedBull    = ships.Sum(x => x.UsedBull);
                this.UsedBauxite = ships.Sum(x =>
                                             x.Slots.Sum(y => y.Lost * 5)
                                             );
            }
            else
            {
                this.UsedFuel = this.UsedBull = this.UsedBauxite = 0;
            }

            this.TotalLevel   = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
            this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
            this.MinAirSuperiorityPotential = firstFleetShips.Sum(x => x.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Minimum));
            this.MaxAirSuperiorityPotential = firstFleetShips.Sum(x => x.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Maximum));

            this.EncounterPercent     = TotalSecond.Sum(x => x.SecondEncounter);
            this.PartEncounterPercent = partPercent;
            this.FirstEncounter       = ships.Sum(s => s.CalcFirstEncounterPercent());

            /*
             * {
             *      if (ships.All(x => x.Speed == ShipSpeed.Fastest)) // 최속으로만 구성
             *              this.Speed = FleetSpeed.Fastest;
             *      else if (ships.All(x => x.Speed == ShipSpeed.Faster)) // 고속+로만 구성
             *              this.Speed = FleetSpeed.Faster;
             *      else if (ships.All(x => x.Speed == ShipSpeed.Fast)) // 고속으로만 구성
             *              this.Speed = FleetSpeed.Fast;
             *      else if (ships.All(x => x.Speed == ShipSpeed.Slow)) // 저속으로만 구성
             *              this.Speed = FleetSpeed.Low;
             *
             *      else if (!ships.Any(x => x.Speed == ShipSpeed.Fast || x.Speed == ShipSpeed.Slow)) // 최속&고속+ 구성
             *              this.Speed = FleetSpeed.Hybrid_Faster;
             *      else if (!ships.Any(x => x.Speed == ShipSpeed.Slow)) // 최속&고속+&고속 구성
             *              this.Speed = FleetSpeed.Hybrid_Fast;
             *      else
             *              this.Speed = FleetSpeed.Hybrid_Low; // 저속 포함 구성
             * }
             * // this.Speed = new FleetSpeed(Array.ConvertAll(ships, x => x.Speed));
             */
            if (ships.Any(x => x.Speed == ShipSpeed.Slow))             // 저속 포함
            {
                this.Speed = FleetSpeed.Low;
            }
            else if (ships.All(x => x.Speed == ShipSpeed.Fast))             // 고속 포함
            {
                this.Speed = FleetSpeed.Fast;
            }
            else if (ships.All(x => x.Speed == ShipSpeed.Faster))             // 고속+ 포함
            {
                this.Speed = FleetSpeed.Faster;
            }
            else             // 최속만
            {
                this.Speed = FleetSpeed.Fastest;
            }

            var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);

            this.ViewRange         = logic.Calc(this.source);
            this.ViewRangeCalcType = logic.Name;

            this.Calculated?.Invoke(this, new EventArgs());
        }