public BattleResultEventArgs(TrackerMapInfo MapInfo, TrackerEnemyShip[] enemyShips, kcsapi_combined_battle_battleresult data) { IsFirstCombat = MapInfo.IsFirstCombat; MapAreaId = MapInfo.MapId; EnemyName = data.api_enemy_info.api_deck_name; EnemyShips = enemyShips; Rank = data.api_win_rank; }
public BattleResultEventArgs(TrackerMapInfo MapInfo, ShipBattleInfo[] enemyFirstShips, ShipBattleInfo[] enemSecondShips, kcsapi_battle_result data) { var enemyShips = new ShipBattleInfo[0]; if (enemyFirstShips != null) { enemyShips = enemyShips.Concat(enemyFirstShips.Where(x => x != null)).ToArray(); } if (enemSecondShips != null) { enemyShips = enemyShips.Concat(enemSecondShips.Where(x => x != null)).ToArray(); } IsFirstCombat = MapInfo.IsFirstCombat; MapWorldId = MapInfo.WorldId; MapAreaId = MapInfo.MapId; MapNodeId = MapInfo.NodeId; IsBoss = MapInfo.IsBoss; EnemyName = data.api_enemy_info.api_deck_name; EnemyShips = enemyShips; Rank = data.api_win_rank; }
public TrackManager() { var proxy = KanColleClient.Current.Proxy; var MapInfo = new TrackerMapInfo(); var battleTracker = new BattleTracker(); // 연습전 종료 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/battle_result") .TryParse <kcsapi_practice_result>().Subscribe(x => PractiveResultEvent?.Invoke(this, new PracticeResultEventArgs(x.Data)) ); // 근대화 개수 proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>().Subscribe(x => PowerUpEvent?.Invoke(this, this.EmptyEventArg) ); // 개수공창 개수 proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => ReModelEvent?.Invoke(this, this.EmptyEventArg) ); // 폐기 proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(x => DestoryItemEvent?.Invoke(this, this.EmptyEventArg) ); // 해체 proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => DestoryShipEvent?.Invoke(this, this.EmptyEventArg) ); // 건조 proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => CreateShipEvent?.Invoke(this, this.EmptyEventArg) ); // 개발 proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => CreateItemEvent?.Invoke(this, this.EmptyEventArg) ); // 보급 proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => ChargeEvent?.Invoke(this, this.EmptyEventArg) ); // 입거 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_nyukyo/start") .Subscribe(x => RepairStartEvent?.Invoke(this, this.EmptyEventArg)); // 원정 proxy.api_req_mission_result.TryParse <kcsapi_mission_result>().Subscribe(x => MissionResultEvent?.Invoke(this, new MissionResultEventArgs(x.Data)) ); // 출격 (시작) proxy.api_req_map_start.TryParse <kcsapi_map_start>().Subscribe(x => MapInfo.Reset(x.Data.api_maparea_id)); // 통상 - 주간전 proxy.api_req_sortie_battle.TryParse <kcsapi_sortie_battle>().Subscribe(x => battleTracker.BattleProcess(x.Data)); // 통상 - 야전 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/battle") .TryParse <kcsapi_battle_midnight_battle>().Subscribe(x => battleTracker.BattleProcess(x.Data)); // 통상 - 개막야전 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/sp_midnight") .TryParse <kcsapi_battle_midnight_sp_midnight>().Subscribe(x => battleTracker.BattleProcess(x.Data)); // 전투 종료 (연합함대 포함) proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>() .Subscribe(x => BattleResultEvent?.Invoke(this, new BattleResultEventArgs(MapInfo.AfterCombat(), battleTracker.enemyShips, x.Data))); proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>() .Subscribe(x => BattleResultEvent?.Invoke(this, new BattleResultEventArgs(MapInfo.AfterCombat(), battleTracker.enemyShips, x.Data))); // Register all trackers trackingAvailable = new ObservableCollection <ITracker>(trackingAvailable.OrderBy(x => x.Id)); trackingAvailable.CollectionChanged += (sender, e) => { if (e.Action != NotifyCollectionChangedAction.Add) { return; } foreach (ITracker tracker in e.NewItems) { tracker.RegisterEvent(this); tracker.ResetQuest(); tracker.ProcessChanged += ((x, y) => { QuestsEventChanged?.Invoke(this, EmptyEventArg); WriteToStorage(KanColleClient.Current.Homeport.Quests); }); } }; Assembly.GetExecutingAssembly().GetTypes() .ToList().Where(x => x.Namespace == "Grabacr07.KanColleViewer.Models.QuestTracker.Tracker" && typeof(ITracker).IsAssignableFrom(x)) .ToList().ForEach(x => trackingAvailable.Add((ITracker)Activator.CreateInstance(x))); ReadFromStorage(); proxy.api_get_member_questlist.Subscribe(x => new System.Threading.Thread(ProcessQuests).Start()); QuestsEventChanged?.Invoke(this, EmptyEventArg); }