internal void Update(kcsapi_ndock[] source) { if (this.Docks.Count == source.Length) { foreach (var raw in source) this.Docks[raw.api_id]?.Update(raw); } else { foreach (var dock in this.Docks) dock.Value?.Dispose(); this.Docks = new MemberTable<RepairingDock>(source.Select(x => new RepairingDock(this.homeport, x))); } }
private void Update(kcsapi_ndock[] source) { if (this.Docks.Count == source.Length) { foreach (var raw in source) { var target = this.Docks[raw.api_id]; if (target != null) target.Update(raw); } } else { this.Docks = new MemberTable<RepairingDock>(source.Select(x => new RepairingDock(x))); } }
internal void Update(kcsapi_ndock[] source) { if (this.Docks.Count == source.Length) { foreach (var raw in source) { var target = this.Docks[raw.api_id]; if (target != null) target.Update(raw); } } else { this.Docks.ForEach(x => x.Value.Dispose()); this.Docks = new MemberTable<RepairingDock>(source.Select(x => new RepairingDock(homeport, x))); } }
private void Update(kcsapi_ndock[] source) { if (this.Docks.Count == source.Length) { foreach (var raw in source) { var target = this.Docks[raw.api_id]; if (target != null) target.Update(raw); } } else { this.Docks.ForEach(x => x.Value.Dispose()); this.Docks = new MemberTable<RepairingDock>(source.Select(x => new RepairingDock(homeport, x))); } // 艦娘を入渠させたとき、ship2 -> ndock の順でデータが来るため、 // ndock の後で改めて各艦隊のステータスを更新してやらないと入渠ステータスに変更できない this.homeport.Fleets.ForEach(x => x.Value.UpdateStatus()); }
internal RepairingDock(Homeport parent, kcsapi_ndock rawData) { this.homeport = parent; this.Update(rawData); }
internal void Update(kcsapi_ndock rawData) { this.Id = rawData.api_id; this.State = (RepairingDockState)rawData.api_state; this.ShipId = rawData.api_ship_id; this.Ship = this.State == RepairingDockState.Repairing ? this.homeport.Ships[this.ShipId] : null; this.CompleteTime = this.State == RepairingDockState.Repairing ? (DateTimeOffset?)Definitions.UnixEpoch.AddMilliseconds(rawData.api_complete_time) : null; }
internal RepairingDock(kcsapi_ndock rawData) { this.Update(rawData); }
internal void Update(kcsapi_ndock rawData) { this.Id = rawData.api_id; this.State = (RepairingDockState)rawData.api_state; this.ShipId = rawData.api_ship_id; this.Ship = this.State == RepairingDockState.Repairing ? this.homeport.Organization.Ships[this.ShipId] : null; if (this.State == RepairingDockState.Repairing) { var fleet = this.homeport.Organization.GetFleet(this.ShipId); if (fleet != null) fleet.State.Update(); } this.CompleteTime = this.State == RepairingDockState.Repairing ? (DateTimeOffset?)Definitions.UnixEpoch.AddMilliseconds(rawData.api_complete_time) : null; }
internal void Update(kcsapi_ndock[] source) { if(this.Docks.SetValueRange(source, x => x.api_id, x => new RepairingDock(homeport, x), (obj, dat) => obj.Update(dat), true, x => x.Dispose())) RaisePropertyChanged(nameof(Docks)); }