public void SetHomeport(Homeport homeport) { if (homeport == null) { return; } // Fleets & Expedition homeport.Organization.PropertyEvent(nameof(homeport.Organization.Fleets), () => { var fleets = homeport.Organization.Fleets.Select(x => x.Value); layoutFleets.Invoke(() => { // 기존 목록 제거 layoutFleets.Controls.Clear(); foreach (var fleet in fleets.OrderBy(x => x.Id)) { if (fleet == null) { continue; } FleetView fleetView = new FleetView(); // fleetView.Dock = DockStyle.Top; fleetView.AutoSize = true; fleetView.Padding = new Padding(0, 0, 8, 8); fleetView.SetFleet(fleet); layoutFleets.Controls.Add(fleetView); } }); }, true); }
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(); }
public void SetHomeport(Homeport homeport) { this.homeport = homeport; if (homeport == null) { return; } homeport.Organization.PropertyEvent(nameof(homeport.Organization.Ships), () => { Action UpdateShips = () => { var list = homeport.Organization.Ships.OrderByDescending(x => x.Value.Exp); comboShip.Items.Clear(); foreach (var ship in list) { comboShip.Items.Add(new DisplayShip { Ship = ship.Value }); } }; if (this.InvokeRequired) { this.Invoke(UpdateShips); } else { UpdateShips(); } }, true); }
internal Fleet(Homeport parent, kcsapi_deck rawData) { this.homeport = parent; this.ReSortie = new FleetReSortie(); this.Expedition = new Expedition(this); this.Update(rawData); }
public void Initialize(Homeport homeport) { if (homeport == null) { return; } SetDisposable(KanColleClient.Current.Proxy); }
public void SetHomeport(Homeport homeport) { this.homeport = homeport; if (homeport == null) { return; } homeport.Organization.PropertyEvent(nameof(homeport.Organization.Ships), () => shipListTable.SetHomeport(this.homeport), true); }
internal Fleet(Homeport parent, kcsapi_deck rawData) { this.homeport = parent; this.State = new FleetState(parent, this); this.Expedition = new Expedition(this); this.CompositeDisposable.Add(this.State); this.CompositeDisposable.Add(this.Expedition); this.Update(rawData); }
public FleetState(Homeport homeport, params Fleet[] fleets) { this.homeport = homeport; this.source = fleets ?? new Fleet[0]; this.Condition = new FleetCondition(); this.CompositeDisposable.Add(this.Condition); this.CompositeDisposable.Add(new PropertyChangedWeakEventListener(KanColleClient.Current.Settings) { { "ViewRangeCalcType", (sender, args) => this.Calculate() }, }); }
public void SetHomeport(Homeport homeport) { this.homeport = homeport; this.RequestUpdate(); if (homeport == null) { return; } homeport.Organization.PropertyEvent(nameof(homeport.Itemyard.SlotItems), () => tableView.RequestUpdate(), true); }
private void UpdateMode() { if (!this.Initialised) { this.Initialised = true; this.homeport = KanColleClient.Current.Homeport; this.CompositeDisposable.Add(new PropertyChangedEventListener(this.homeport.Organization) { { () => this.homeport.Organization.Ships, (sender, args) => this.Update() }, }); } }
public FleetState(Homeport homeport, params Fleet[] fleets) { this.homeport = homeport; this.source = fleets ?? new Fleet[0]; this.Condition = new FleetCondition(); this.CompositeDisposable.Add(this.Condition); this.CompositeDisposable.Add(new PropertyChangedWeakEventListener(KanColleClient.Current.Settings) { { nameof(IKanColleClientSettings.ViewRangeCalcType), (sender, args) => this.Calculate() }, { nameof(IKanColleClientSettings.SqrtDoubleToInt), (sender, args) => this.Calculate() }, { nameof(IKanColleClientSettings.EnableAircraftFilter), (sender, args) => this.Calculate() }, }); }
public FleetState(Homeport homeport, params Fleet[] fleets) { this.homeport = homeport; this.source = fleets ?? new Fleet[0]; this.Condition = new FleetCondition(); this.CompositeDisposable.Add(this.Condition); this.CompositeDisposable.Add(new PropertyChangedWeakEventListener(KanColleClient.Current.Settings) { { nameof(IKanColleClientSettings.ViewRangeCalcType), (_, __) => this.Calculate() }, { nameof(IKanColleClientSettings.IsViewRangeCalcIncludeFirstFleet), (_, __) => this.Calculate() }, { nameof(IKanColleClientSettings.IsViewRangeCalcIncludeSecondFleet), (_, __) => this.Calculate() }, }); }
internal Fleet(Homeport parent, kcsapi_deck rawData) { this.homeport = parent; this.Condition = new FleetCondition(this); this.Expedition = new Expedition(this); this.Update(rawData); this.compositeDisposable = new LivetCompositeDisposable { new PropertyChangedWeakEventListener(KanColleClient.Current.Settings) { { "ViewRangeCalcLogic", (sender, args) => this.Calculate() } } }; }
internal Ship(Homeport parent, kcsapi_ship2 rawData) : base(rawData) { this.homeport = parent; this.Info = KanColleClient.Current.Master.Ships[rawData.api_ship_id] ?? ShipInfo.Dummy; this.HP = new LimitedValue(this.RawData.api_nowhp, this.RawData.api_maxhp, 0); this.Fuel = new LimitedValue(this.RawData.api_fuel, this.Info.RawData.api_fuel_max, 0); this.Bull = new LimitedValue(this.RawData.api_bull, this.Info.RawData.api_bull_max, 0); if (this.RawData.api_kyouka.Length == 4) { this.Firepower = new ModernizableStatus(this.Info.RawData.api_houg, this.RawData.api_kyouka[0]); this.Torpedo = new ModernizableStatus(this.Info.RawData.api_raig, this.RawData.api_kyouka[1]); this.AA = new ModernizableStatus(this.Info.RawData.api_tyku, this.RawData.api_kyouka[2]); this.Armer = new ModernizableStatus(this.Info.RawData.api_souk, this.RawData.api_kyouka[3]); } this.SlotItems = this.RawData.api_slot.Select(id => this.homeport.SlotItems[id]).Where(x => x != null).ToArray(); }
internal SlotItemTracker(Homeport parent, KanColleProxy proxy) { this.homeport = parent; this.SlotItems = new MemberTable <SlotItem>(); proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data)); proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(this.DestroyItem); proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => { this.RemoveFromRemodel(x.Data); this.RemodelSlotItem(x.Data); }); foreach (var item in this.homeport.Itemyard.SlotItems) { this.SlotItems.Add(new SlotItem(item.Value.RawData)); } }
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(); }
internal Ship(Homeport parent, kcsapi_ship2 rawData) : base(rawData) { this.homeport = parent; this.Update(rawData); }
internal RepairingDock(Homeport parent, kcsapi_ndock rawData) { this.homeport = parent; this.Update(rawData); }
internal RepairingDock(Homeport parent, kcsapi_ndock rawData) : base(false) { this.homeport = parent; this._Id = rawData.api_id; this.Update(rawData); }
public AirBase(kcsapi_airbase_corps rawData, Homeport homeport) : base(rawData) { this.homeport = homeport; this.Update(RawData); }
public NotifyHost(Homeport homeport) { homeport.PropertyEvent(nameof(homeport.Dockyard), () => UpdateDockyard(homeport.Dockyard), true); homeport.PropertyEvent(nameof(homeport.Repairyard), () => UpdateRepairyard(homeport.Repairyard), true); homeport.PropertyEvent(nameof(homeport.Organization), () => UpdateFleets(homeport.Organization), true); }
public void SetHomeport(Homeport homeport) { this.homeport = homeport; if (homeport == null) { return; } notifyHost = new NotifyHost(homeport); Action UpdateInfo = () => { var shipsMax = homeport.Admiral?.MaxShipCount ?? 0; var ships = homeport.Organization?.Ships.Count(x => x.Value != null) ?? 0; var slotMax = homeport.Admiral?.MaxSlotItemCount ?? 0; var slots = homeport.Itemyard?.SlotItemsCount; if (labelShipCount.InvokeRequired) { labelShipCount.Invoke(() => labelShipCount.Text = $"소속칸무스: {ships}/{shipsMax}"); labelSlotitemCount.Invoke(() => labelSlotitemCount.Text = $"보유장비: {slots}/{slotMax}"); } else { labelShipCount.Text = $"소속칸무스: {ships}/{shipsMax}"; labelSlotitemCount.Text = $"보유장비: {slots}/{slotMax}"; } }; // Resources homeport.PropertyEvent(nameof(homeport.Materials), () => { AttachResources(homeport.Materials); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Fuel), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Ammo), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Steel), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Bauxite), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.RepairBuckets), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.BuildMaterials), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.DevMaterials), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.ImproveMaterials), () => this.UpdateResources(homeport.Materials)); this.UpdateResources(homeport.Materials); }, true); // Fleets & Expedition homeport.Organization.PropertyEvent(nameof(homeport.Organization.Fleets), () => { homeport.Admiral.PropertyEvent(nameof(homeport.Organization.Ships), () => UpdateInfo(), true); var fleets = homeport.Organization.Fleets.Select(x => x.Value); foreach (var fleet in fleets) { UpdateFleetState(fleet); if (fleet != null) { fleet.Expedition.PropertyEvent(nameof(fleet.Expedition.Id), () => UpdateFleetState(fleet)); fleet.Expedition.PropertyEvent(nameof(fleet.Expedition.Remaining), () => UpdateFleetState(fleet)); fleet.State.Condition.PropertyEvent(nameof(fleet.State.Condition.Remaining), () => UpdateFleetState(fleet)); fleet.State.Updated += (s, e) => UpdateFleetState(fleet); } } }, true); // NDock homeport.Repairyard.PropertyEvent(nameof(homeport.Repairyard.Docks), () => { var nDocks = homeport.Repairyard.Docks.Select(x => x.Value); foreach (var dock in nDocks) { dock.PropertyEvent(nameof(dock.Ship), () => UpdateNDock(dock)); dock.PropertyEvent(nameof(dock.Remaining), () => UpdateNDock(dock)); UpdateNDock(dock); } }, true); // KDock homeport.Dockyard.PropertyEvent(nameof(homeport.Dockyard.Docks), () => { var kDocks = homeport.Dockyard.Docks.Select(x => x.Value); foreach (var dock in kDocks) { dock.PropertyEvent(nameof(dock.Ship), () => UpdateKDock(dock)); dock.PropertyEvent(nameof(dock.Remaining), () => UpdateKDock(dock)); UpdateKDock(dock); } }, true); // Quests homeport.Quests.PropertyEvent(nameof(homeport.Quests.Current), () => { if (homeport.Quests.All.Count == 0) { return; } UpdateQuests(homeport.Quests.Current); }, true); // Admiral homeport.PropertyEvent(nameof(homeport.Admiral), () => { this.UpdateHQRecord(this.homeport.Admiral); UpdateInfo(); }, true); // Itemyard homeport.PropertyEvent(nameof(homeport.Itemyard), () => { homeport.Itemyard.PropertyEvent(nameof(homeport.Itemyard.SlotItemsCount), () => UpdateInfo()); }); catalogCalculator?.SetHomeport(this.homeport); catalogShips?.SetHomeport(this.homeport); UpdateInfo(); }