単一の艦隊情報を提供します。
Inheritance: ItemViewModel
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            if (Helper.IsWindows8OrGreater)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。",
                            () => App.ViewModelRoot.Messenger.Raise(new WindowActionMessage(WindowAction.Active, "Window/Activate")));
                    }
                };
            }
        }
示例#2
0
        private FleetViewModel ToViewModel(Fleet fleet)
        {
            var vm = new FleetViewModel(fleet).AddTo(this.fleetListeners);

            fleet.Subscribe(nameof(Fleet.ShipsUpdated), () =>
            {
                if (KanColleSettings.AutoFleetSelectWhenShipsChanged)
                {
                    var first = this.Fleets2.FirstOrDefault();

                    // 첫번째가 연합함대
                    if (first.GetType() == typeof(CombinedFleetViewModel))
                    {
                        // 연합함대에 포함
                        if ((first as CombinedFleetViewModel).Source.Fleets.Any(x => x == fleet))
                        {
                            this.SelectedFleet = first;
                        }
                        else
                        {
                            this.SelectedFleet = vm;
                        }
                    }
                    else
                    {
                        this.SelectedFleet = vm;
                    }
                }
            }, false).AddTo(this.fleetListeners);

            fleet.Subscribe(nameof(Fleet.IsInSortie), () => {
                if (KanColleSettings.AutoFleetSelectWhenSortie)
                {
                    var first = this.Fleets2.FirstOrDefault();

                    // 첫번째가 연합함대
                    if (first.GetType() == typeof(CombinedFleetViewModel))
                    {
                        // 연합함대에 포함
                        if ((first as CombinedFleetViewModel).Source.Fleets.Any(x => x == fleet))
                        {
                            this.SelectedFleet = first;
                        }
                        else
                        {
                            this.SelectedFleet = vm;
                        }
                    }
                    else
                    {
                        this.SelectedFleet = vm;
                    }
                }
            }, false).AddTo(this.fleetListeners);

            return(vm);
        }
示例#3
0
        private void UpdateFleets()
        {
            this.fleetListeners?.Dispose();
            this.fleetListeners = new MultipleDisposable();

            this.Fleets = KanColleClient.Current.Homeport.Organization.Fleets
                          .Select(kvp => this.ToViewModel(kvp.Value))
                          .ToArray();
            this.SelectedFleet = this.Fleets.FirstOrDefault();
        }
示例#4
0
        private FleetViewModel ToViewModel(Fleet fleet)
        {
            var vm = new FleetViewModel(fleet).AddTo(this.fleetListeners);

            fleet.Subscribe(nameof(Fleet.ShipsUpdated), () => { if (KanColleSettings.AutoFleetSelectWhenShipsChanged)
                                                                {
                                                                    this.SelectedFleet = vm;
                                                                }
                            }, false).AddTo(this.fleetListeners);
            fleet.Subscribe(nameof(Fleet.IsInSortie), () => { if (KanColleSettings.AutoFleetSelectWhenSortie)
                                                              {
                                                                  this.SelectedFleet = vm;
                                                              }
                            }, false).AddTo(this.fleetListeners);

            return(vm);
        }
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            reSortie.Readied += (sender, args) =>
            {
                if (Models.Settings.Current.EnableFatigueNotification)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_NotificationMessage_Title,
                        string.Format(Resources.ReSortie_NotificationMessage, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }
            };

            reSortie.CriticalCondition += (sender, args) =>
            {
                if (Models.Settings.Current.EnableCriticalNotify)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_CriticalConditionMessage_Title,
                        string.Format(Resources.ReSortie_CriticalConditionMessage, args.Ship.Info.Name, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }

                if (Models.Settings.Current.EnableCriticalAccent)
                {
                    App.ViewModelRoot.Mode = Mode.CriticalCondition;
                }
            };

            reSortie.CriticalCleared += (sender, args) =>
            {
                App.ViewModelRoot.Mode = Mode.Started;
            };

            this.UpdateMessage();
            this.UpdateRemaining();
        }
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            reSortie.Readied += (sender, args) =>
            {
                if (Models.Settings.Current.EnableFatigueNotification)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_NotificationMessage_Title,
                        string.Format(Resources.ReSortie_NotificationMessage, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }
            };

            reSortie.CriticalCondition += (sender, args) =>
            {
                if (Models.Settings.Current.EnableCriticalNotify)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_CriticalConditionMessage_Title,
                        string.Format(Resources.ReSortie_CriticalConditionMessage, args.Ship.Info.Name, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }

                if (Models.Settings.Current.EnableCriticalAccent)
                    App.ViewModelRoot.Mode = Mode.CriticalCondition;
            };

            reSortie.CriticalCleared += (sender, args) =>
            {
                App.ViewModelRoot.Mode = Mode.Started;
            };

            this.UpdateMessage();
            this.UpdateRemaining();
        }
        /// <summary>
        /// 艦隊の索敵値を計算します。
        /// </summary>
        /// <returns></returns>
        public static int CalcFleetViewRange(FleetViewModel fleetVM, ViewRangeType type)
        {
            if (fleetVM == null || fleetVM.Ships.Length == 0) return 0;

            var fleet = fleetVM.GetFleet();
            switch (type)
            {
                case ViewRangeType.Type1:
                    #region Type1

                    return fleet.Ships.Sum(x => x.ViewRange);

                    #endregion
                case ViewRangeType.Type2:
                    #region Type2

                    // http://wikiwiki.jp/kancolle/?%C6%EE%C0%BE%BD%F4%C5%E7%B3%A4%B0%E8#area5
                    // [索敵装備と装備例] によって示されている計算式
                    // stype=7 が偵察機 (2 倍する索敵値)、stype=8 が電探

                    var spotter = fleet.Ships.SelectMany(
                        x => x.SlotItems
                            .Zip(x.OnSlot, (i, o) => new { Item = i.Info, Slot = o })
                            .Where(a => a.Item.GetRawData().api_type.Get(1) == 7)
                            .Where(a => a.Slot > 0)
                            .Select(a => a.Item.GetRawData().api_saku)
                        ).Sum();

                    var radar = fleet.Ships.SelectMany(
                        x => x.SlotItems
                            .Where(i => i.Info.GetRawData().api_type.Get(1) == 8)
                            .Select(i => i.Info.GetRawData().api_saku)
                        ).Sum();

                    return (spotter * 2) + radar + (int)Math.Sqrt(fleet.Ships.Sum(x => x.ViewRange) - spotter - radar);

                    #endregion
            }

            return 0;
        }
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            if (Toast.IsSupported)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。",
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        NotifyIconWrapper.Show(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。");
                    }
                };
            }
        }
示例#9
0
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            if (Toast.IsSupported)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "Morale Recovery",
                            "Morale of ships in the " + parent.Name + "has fully recovered.",
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        NotifyIconWrapper.Show(
                            "Morale Recovery",
                            "Morale of ships in the " + parent.Name + "has fully recovered.");
                    }
                };
            }
        }
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            reSortie.Readied += (sender, args) =>
            {
                if (this.IsNotifyReadied)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_NotificationMessage_Title,
                        string.Format(Resources.ReSortie_NotificationMessage, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }
            };
        }
示例#11
0
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            reSortie.Readied += (sender, args) =>
            {
                if (this.IsNotifyReadied)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_NotificationMessage_Title,
                        string.Format(Resources.ReSortie_NotificationMessage, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }
            };
        }
示例#12
0
 private void UpdateFleets()
 {
     this.Fleets        = KanColleClient.Current.Homeport.Organization.Fleets.Select(kvp => new FleetViewModel(kvp.Value)).ToArray();
     this.SelectedFleet = this.Fleets.FirstOrDefault();
 }
示例#13
0
 private void UpdateFleets()
 {
     this.Fleets = KanColleClient.Current.Homeport.Organization.Fleets.Select(kvp => new FleetViewModel(kvp.Value)).ToArray();
     this.SelectedFleet = this.Fleets.FirstOrDefault();
     this.Fleets.ForEach(x => x.Expedition.IsNotifyReturned = this.IsNotifyReturned);
 }
示例#14
0
		private FleetViewModel ToViewModel(Fleet fleet)
		{
			var vm = new FleetViewModel(fleet).AddTo(this.fleetListeners);
			fleet.Subscribe(nameof(Fleet.ShipsUpdated), () => { if (KanColleSettings.AutoFleetSelectWhenShipsChanged) this.SelectedFleet = vm; }, false).AddTo(this.fleetListeners);
			fleet.Subscribe(nameof(Fleet.IsInSortie), () => { if (KanColleSettings.AutoFleetSelectWhenSortie) this.SelectedFleet = vm; }, false).AddTo(this.fleetListeners);

			return vm;
		}
示例#15
0
		private void UpdateFleets()
		{
			this.fleetListeners?.Dispose();
			this.fleetListeners = new MultipleDisposable();

			this.Fleets = KanColleClient.Current.Homeport.Organization.Fleets
				.Select(kvp => this.ToViewModel(kvp.Value))
				.ToArray();
			this.SelectedFleet = this.Fleets.FirstOrDefault();
		}
示例#16
0
		private void UpdateFleets()
		{
			this.Fleets = KanColleClient.Current.Homeport.Organization.Fleets.Select(kvp => new FleetViewModel(kvp.Value)).ToArray();
			this.SelectedFleet = this.Fleets.FirstOrDefault();
		}