Grabacr07.KanColleWrapper.Models.ViewRangeCalcLogic.Get C# (CSharp) Method

Get() public static method

public static Get ( string key ) : ICalcViewRange
key string
return ICalcViewRange
        public static ICalcViewRange Get(string key)
        {
            ICalcViewRange logic;
            return logics.TryGetValue(key, out logic) ? logic : new ViewRangeType1();
        }

Usage Example

        /// <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());
            }
        }
All Usage Examples Of Grabacr07.KanColleWrapper.Models.ViewRangeCalcLogic::Get