艦隊の状態を表します。
Inheritance: DisposableNotifier
Example #1
0
		public CombinedFleet(Homeport parent, params Fleet[] fleets)
		{
			if (fleets == null || fleets.Length == 0) throw new ArgumentException();

			this.Fleets = fleets;
			this.State = new FleetState(parent, fleets);
			this.CompositeDisposable.Add(this.State);

			foreach (var fleet in fleets)
			{
				this.CompositeDisposable.Add(new PropertyChangedEventListener(fleet)
				{
					{ nameof(Fleet.Name), (sender, args) => this.UpdateName() },
				});

				var source = fleet;
				this.CompositeDisposable.Add(new WeakEventListener<EventHandler, EventArgs>(
					h => new EventHandler(h),
					h => source.State.Updated += h,
					h => source.State.Updated -= h,
					(sender, args) => this.State.Update()));
				this.CompositeDisposable.Add(new WeakEventListener<EventHandler, EventArgs>(
					h => new EventHandler(h),
					h => source.State.Calculated += h,
					h => source.State.Calculated -= h,
					(sender, args) => this.State.Calculate()));
			}

			this.UpdateName();

			this.State.Calculate();
			this.State.Update();
		}
Example #2
0
		public HomeportViewModel(FleetState state)
			: base(state)
		{
			this.Condition = new ConditionViewModel(state.Condition);
            this.Repairing = new RepairingViewModel(state.Dock);
			this.CompositeDisposable.Add(this.Condition);
            this.CompositeDisposable.Add(this.Repairing);
		}
		public FleetStateViewModel(FleetState source)
		{
			this.Source = source;
			this.CompositeDisposable.Add(new PropertyChangedEventListener(source)
			{
				(sender, args) => this.RaisePropertyChanged(args.PropertyName),
			});

			this.Sortie = new SortieViewModel(source);
			this.CompositeDisposable.Add(this.Sortie);

			this.Homeport = new HomeportViewModel(source);
			this.CompositeDisposable.Add(this.Homeport);
		}
Example #4
0
 internal void UpdateStatus()
 {
     if (this.Ships.Length == 0) this.State = FleetState.Empty;
     else if (this.Expedition.IsInExecution) this.State = FleetState.Expedition;
     else if (this.homeport.Repairyard.CheckRepairing(this)) this.State = FleetState.Repairing;
     else this.State = FleetState.Ready;
 }
Example #5
0
        internal void Update(kcsapi_deck rawData)
        {
            this.Id = rawData.api_id;
            this.Name = rawData.api_name;
            this.Ships = rawData.api_ship.Select(id => KanColleClient.Current.Homeport.Ships[id]).Where(x => x != null).ToArray();
            this.Expedition.Update(rawData.api_mission);

            if (this.Expedition.IsInExecution) this.State = FleetState.Expedition;
            else if(KanColleClient.Current.Homeport.Repairyard.CheckRepairing(this)) this.State = FleetState.Repairing;
            else this.State = FleetState.Ready;
        }
Example #6
0
		public SortieViewModel(FleetState state) : base(state) {
            SortieInfo = state.GetFleet().SortieInfo;
		}
		protected QuickStateViewViewModel(FleetState state)
		{
			this.State = state;
		}
		// QuickStateView は ContentControl に対し型ごとの DataTemplate を適用する形で実現するので
		// 状況に応じた型がそれぞれ必要。これはその 1 つ。

		public SortieViewModel(FleetState state) : base(state) { }