public Organization(Homeport parent, KanColleProxy proxy) { this.homeport = parent; this.Ships = new MemberTable <Ship>(); this.Fleets = new MemberTable <Fleet>(); proxy.api_get_member_ship.TryParse <kcsapi_ship2[]>().Subscribe(x => this.Update(x.Data)); proxy.api_get_member_ship2.TryParse <kcsapi_ship2[]>().Subscribe(x => { this.Update(x.Data); this.Update(x.Fleets); }); proxy.api_get_member_ship3.TryParse <kcsapi_ship3>().Subscribe(x => { this.Update(x.Data.api_ship_data); this.Update(x.Data.api_deck_data); }); proxy.api_get_member_deck.TryParse <kcsapi_deck[]>().Subscribe(x => this.Update(x.Data)); proxy.api_get_member_deck_port.TryParse <kcsapi_deck[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_hensei_change.TryParse().Subscribe(this.Change); proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.Charge(x.Data)); proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>().Subscribe(this.Powerup); proxy.api_req_kousyou_getship.TryParse <kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data)); proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(this.DestoryShip); }
internal Homeport(KanColleProxy proxy) { this.SlotItems = new MemberTable <SlotItem>(); this.UseItems = new MemberTable <UseItem>(); this.Materials = new Materials(proxy); this.Organization = new Organization(this, proxy); this.Repairyard = new Repairyard(this, proxy); this.Dockyard = new Dockyard(proxy); this.Quests = new Quests(proxy); this.Logger = new Logger(proxy); proxy.api_port.TryParse <kcsapi_port>().Subscribe(x => { this.Organization.Update(x.Data.api_ship); this.Repairyard.Update(x.Data.api_ndock); this.Organization.Update(x.Data.api_deck_port); this.Materials.Update(x.Data.api_material); }); proxy.api_get_member_basic.TryParse <kcsapi_basic>().Subscribe(x => this.UpdateAdmiral(x.Data)); proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.UpdateSlotItems(x.Data)); proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.UpdateUseItems(x.Data)); this.Rankings = new Rankings(proxy); }
internal Dockyard(KanColleProxy proxy) { this.Docks = new MemberTable <BuildingDock>(); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/kdock") .TryParse <kcsapi_kdock[]>() .Subscribe(this.Update); }
internal Dockyard(KanColleProxy proxy) { this.Docks = new MemberTable <BuildingDock>(); proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_kousyou_getship.TryParse <kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data)); proxy.api_req_kousyou_createship_speedchange.TryParse().Subscribe(this.ChangeSpeed); }
internal Repairyard(Homeport parent, KanColleProxy proxy) { this.homeport = parent; this.Docks = new MemberTable <RepairingDock>(); proxy.api_get_member_ndock.TryParse <kcsapi_ndock[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_nyukyo_start.TryParse().Subscribe(this.Start); proxy.api_req_nyukyo_speedchange.TryParse().Subscribe(this.ChangeSpeed); }
internal Repairyard(Homeport parent, KanColleProxy proxy) { this.homeport = parent; this.Docks = new MemberTable <RepairingDock>(); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ndock") .TryParse <kcsapi_ndock[]>() .Subscribe(this.Update); }
internal Homeport(KanColleProxy proxy) { proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/basic") .TryParse <kcsapi_basic>() .Subscribe(x => this.Admiral = new Admiral(x)); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/material") .TryParse <kcsapi_material[]>() .Subscribe(x => this.Materials = new Materials(x.Select(m => new Material(m)).ToArray())); this.Ships = new MemberTable <Ship>(); this.Fleets = new MemberTable <Fleet>(); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship") .Select(x => { SvData <kcsapi_ship2[]> result; return(SvData.TryParse(x, out result) ? result : null); }) .Where(x => x != null && x.IsSuccess) .Subscribe(x => this.Ships = new MemberTable <Ship>(x.Data.Select(s => new Ship(this, s)))); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship2") .Select(x => { SvData <kcsapi_ship2[]> result; return(SvData.TryParse(x, out result) ? result : null); }) .Where(x => x != null && x.IsSuccess) .Subscribe(x => { this.Ships = new MemberTable <Ship>(x.Data.Select(s => new Ship(this, s))); this.UpdateFleets(x.Fleets); }); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship3") .TryParse <kcsapi_ship3>() .Subscribe(x => { this.Ships = new MemberTable <Ship>(x.api_ship_data.Select(s => new Ship(this, s))); this.UpdateFleets(x.api_deck_data); }); this.SlotItems = new MemberTable <SlotItem>(); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/slotitem") .TryParse <kcsapi_slotitem[]>() .Subscribe(x => this.SlotItems = new MemberTable <SlotItem>(x.Select(s => new SlotItem(s)))); this.UseItems = new MemberTable <UseItem>(); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/useitem") .TryParse <kcsapi_useitem[]>() .Subscribe(x => this.UseItems = new MemberTable <UseItem>(x.Select(s => new UseItem(s)))); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck") .TryParse <kcsapi_deck[]>() .Subscribe(this.UpdateFleets); proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck_port") .TryParse <kcsapi_deck[]>() .Subscribe(this.UpdateFleets); this.Dockyard = new Dockyard(proxy); this.Repairyard = new Repairyard(this, proxy); this.Quests = new Quests(proxy); this.Logger = new Logger(proxy); }
internal Itemyard(KanColleProxy proxy) { this.SlotItems = new MemberTable <SlotItem>(); this.UseItems = new MemberTable <UseItem>(); 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_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.DropShip(x.Data)); proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data)); }
internal Itemyard(KanColleProxy proxy) { this.SlotItems = new MemberTable <SlotItem>(); this.UseItems = new MemberTable <UseItem>(); 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); // API no longer provides stock equipment list in mst_ship // proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.DropShip(x.Data)); proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => this.RemoveFromRemodel(x.Data)); }
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))); } }
internal Itemyard(KanColleProxy proxy) { this.SlotItems = new MemberTable <SlotItem>(); this.UseItems = new MemberTable <UseItem>(); 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_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => { this.RemoveFromRemodel(x.Data); this.RemodelSlotItem(x.Data); }); }
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(this.homeport, x))); } }
private void Update(kcsapi_kdock[] 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 <BuildingDock>(source.Select(x => new BuildingDock(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()); }
public Organization(Homeport parent, KanColleProxy proxy) { this.homeport = parent; this.Ships = new MemberTable <Ship>(); this.Fleets = new MemberTable <Fleet>(); proxy.api_get_member_ship.TryParse <kcsapi_ship2[]>().Subscribe(x => this.Update(x.Data)); proxy.api_get_member_ship2.TryParse <kcsapi_ship2[]>().Subscribe(x => { this.Update(x.Data); this.Update(x.Fleets); }); proxy.api_get_member_ship3.TryParse <kcsapi_ship3>().Subscribe(x => { this.Update(x.Data.api_ship_data); this.Update(x.Data.api_deck_data); }); proxy.api_get_member_deck.TryParse <kcsapi_deck[]>().Subscribe(x => this.Update(x.Data)); proxy.api_get_member_deck_port.TryParse <kcsapi_deck[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_hensei_change.TryParse().Subscribe(this.Change); proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.Charge(x.Data)); proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>().Subscribe(this.Powerup); proxy.api_req_kousyou_getship.TryParse <kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data)); proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(this.DestoryShip); proxy.api_req_member_updatedeckname.TryParse().Subscribe(this.UpdateFleetName); proxy.ApiSessionSource .SkipUntil(proxy.api_req_sortie_battle.TryParse <kcsapi_battle>().Do(this.Sortie)) .TakeUntil(proxy.api_port) .Finally(this.Homing) .Repeat() .Subscribe(); }
internal void Update(kcsapi_useitem[] source) { this.UseItems = new MemberTable <UseItem>(source.Select(x => new UseItem(x))); }