public override void Initialize() { Progresses = new IDDictionary <ProgressData>(); var ao = APIObserver.Instance; ao.APIList["api_get_member/questlist"].ResponseReceived += QuestUpdated; ao.APIList["api_req_map/start"].ResponseReceived += StartSortie; ao.APIList["api_req_sortie/battleresult"].ResponseReceived += BattleFinished; ao.APIList["api_req_combined_battle/battleresult"].ResponseReceived += BattleFinished; ao.APIList["api_req_practice/battle_result"].ResponseReceived += PracticeFinished; ao.APIList["api_req_mission/result"].ResponseReceived += ExpeditionCompleted; ao.APIList["api_req_nyukyo/start"].RequestReceived += StartRepair; ao.APIList["api_req_hokyu/charge"].ResponseReceived += Supplied; ao.APIList["api_req_kousyou/createitem"].ResponseReceived += EquipmentDeveloped; ao.APIList["api_req_kousyou/createship"].RequestReceived += ShipConstructed; ao.APIList["api_req_kousyou/destroyship"].ResponseReceived += ShipDestructed; ao.APIList["api_req_kousyou/destroyitem2"].ResponseReceived += EquipmentDiscarded; ao.APIList["api_req_kousyou/remodel_slot"].ResponseReceived += EquipmentRemodeled; ao.APIList["api_req_kaisou/powerup"].ResponseReceived += Modernized; }
private static string SerializeList <TData>(IDDictionary <TData> dictionary) where TData : ResponseWrapper, IIdentifiable { var serialized = dictionary.Select(e => e.Value.RawData.ToString()); return($"[{string.Join(",", serialized)}]"); }
// Manually serialize stuff because DynamicJson does not play well with number-indexed objects. private static string SerializeDict <TData>(IDDictionary <TData> dictionary) where TData : ResponseWrapper, IIdentifiable { var serialized = dictionary.Select(e => $"\"{e.Key}\":{e.Value.RawData.ToString()}"); return($"{{{string.Join(",", serialized)}}}"); }
public override void Initialize() { Progresses = new IDDictionary<ProgressData>(); RemoveEvents(); //二重登録防止 var ao = APIObserver.Instance; ao.APIList["api_get_member/questlist"].ResponseReceived += QuestUpdated; ao.APIList["api_req_map/start"].ResponseReceived += StartSortie; ao.APIList["api_req_sortie/battleresult"].ResponseReceived += BattleFinished; ao.APIList["api_req_combined_battle/battleresult"].ResponseReceived += BattleFinished; ao.APIList["api_req_practice/battle_result"].ResponseReceived += PracticeFinished; ao.APIList["api_req_mission/result"].ResponseReceived += ExpeditionCompleted; ao.APIList["api_req_nyukyo/start"].RequestReceived += StartRepair; ao.APIList["api_req_hokyu/charge"].ResponseReceived += Supplied; ao.APIList["api_req_kousyou/createitem"].ResponseReceived += EquipmentDeveloped; ao.APIList["api_req_kousyou/createship"].RequestReceived += ShipConstructed; ao.APIList["api_req_kousyou/destroyship"].ResponseReceived += ShipDestructed; ao.APIList["api_req_kousyou/destroyitem2"].ResponseReceived += EquipmentDiscarded; ao.APIList["api_req_kousyou/remodel_slot"].ResponseReceived += EquipmentRemodeled; ao.APIList["api_req_kaisou/powerup"].ResponseReceived += Modernized; }
private static string SerializeList <TData>(IDDictionary <TData> dictionary, Action <TData, dynamic> transformer = null) where TData : ResponseWrapper, IIdentifiable { var serialized = dictionary.Select(e => SerializeWithTransformer(e.Value, transformer)); return($"[{string.Join(",", serialized)}]"); }
public override void Initialize() { Progresses = new IDDictionary <ProgressData>(); LastUpdateTime = DateTime.Now; RemoveEvents(); //二重登録防止 var ao = APIObserver.Instance; ao.APIList["api_get_member/questlist"].ResponseReceived += QuestUpdated; ao.APIList["api_req_map/start"].ResponseReceived += StartSortie; ao.APIList["api_req_map/next"].ResponseReceived += NextSortie; ao.APIList["api_req_sortie/battleresult"].ResponseReceived += BattleFinished; ao.APIList["api_req_combined_battle/battleresult"].ResponseReceived += BattleFinished; ao.APIList["api_req_practice/battle_result"].ResponseReceived += PracticeFinished; ao.APIList["api_req_mission/result"].ResponseReceived += ExpeditionCompleted; ao.APIList["api_req_nyukyo/start"].RequestReceived += StartRepair; ao.APIList["api_req_hokyu/charge"].ResponseReceived += Supplied; ao.APIList["api_req_kousyou/createitem"].ResponseReceived += EquipmentDeveloped; ao.APIList["api_req_kousyou/createship"].RequestReceived += ShipConstructed; ao.APIList["api_req_kousyou/destroyship"].RequestReceived += ShipDestructed; // 装備廃棄はイベント前に装備データが削除されてしまうので destroyitem2 から直接呼ばれる ao.APIList["api_req_kousyou/remodel_slot"].ResponseReceived += EquipmentRemodeled; ao.APIList["api_req_kaisou/powerup"].ResponseReceived += Modernized; ao.APIList["api_port/port"].ResponseReceived += TimerSave; _prevTime = DateTime.Now; }
public void ConfigurationChanged() { var c = Utility.Configuration.Config.BGMPlayer; Enabled = c.Enabled; if (c.Handles != null) { Handles = new IDDictionary <SoundHandle>(c.Handles); } if (!c.SyncBrowserMute) { IsMute = false; } // 設定変更を適用するためいったん閉じる _mp.Close(); }
public QuestManager() { Quests = new IDDictionary<QuestData>(); IsLoaded = false; _prevTime = DateTime.Now; }
/// <summary> /// 詳細ビューを更新します。 /// </summary> private void UpdateDetailView(int equipmentID) { DetailView.SuspendLayout(); DetailView.Rows.Clear(); //装備数カウント var eqs = KCDatabase.Instance.Equipments.Values.Where(eq => eq.EquipmentID == equipmentID); var countlist = new IDDictionary <DetailCounter>(); foreach (var eq in eqs) { var c = countlist[DetailCounter.CalculateID(eq)]; if (c == null) { countlist.Add(new DetailCounter(eq.Level, eq.AircraftLevel)); c = countlist[DetailCounter.CalculateID(eq)]; } c.countAll++; c.countRemain++; c.countRemainPrev++; } //装備艦集計 foreach (var ship in KCDatabase.Instance.Ships.Values) { foreach (var eq in ship.AllSlotInstance.Where(s => s != null && s.EquipmentID == equipmentID)) { countlist[DetailCounter.CalculateID(eq)].countRemain--; } foreach (var c in countlist.Values) { if (c.countRemain != c.countRemainPrev) { int diff = c.countRemainPrev - c.countRemain; c.equippedShips.Add(ship.NameWithLevel + (diff > 1 ? (" x" + diff) : "")); c.countRemainPrev = c.countRemain; } } } // 基地航空隊 - 配備中の装備を集計 foreach (var corps in KCDatabase.Instance.BaseAirCorps.Values) { foreach (var sq in corps.Squadrons.Values.Where(sq => sq != null && sq.EquipmentID == equipmentID)) { countlist[DetailCounter.CalculateID(sq.EquipmentInstance)].countRemain--; } foreach (var c in countlist.Values) { if (c.countRemain != c.countRemainPrev) { int diff = c.countRemainPrev - c.countRemain; c.equippedShips.Add(string.Format("#{0} {1}{2}", corps.MapAreaID, corps.Name, diff > 1 ? (" x" + diff) : "")); c.countRemainPrev = c.countRemain; } } } // 基地航空隊 - 配置転換中の装備を集計 foreach (var eq in KCDatabase.Instance.RelocatedEquipments.Values .Select(v => v.EquipmentInstance) .Where(eq => eq != null && eq.EquipmentID == equipmentID)) { countlist[DetailCounter.CalculateID(eq)].countRemain--; } foreach (var c in countlist.Values) { if (c.countRemain != c.countRemainPrev) { int diff = c.countRemainPrev - c.countRemain; c.equippedShips.Add("配置転換中" + (diff > 1 ? (" x" + diff) : "")); c.countRemainPrev = c.countRemain; } } //行に反映 var rows = new List <DataGridViewRow>(eqs.Count()); foreach (var c in countlist.Values) { if (c.equippedShips.Count() == 0) { c.equippedShips.Add(""); } foreach (var s in c.equippedShips) { var row = new DataGridViewRow(); row.CreateCells(DetailView); row.SetValues(c.level, c.aircraftLevel, c.countAll, c.countRemain, s); rows.Add(row); } } DetailView.Rows.AddRange(rows.ToArray()); DetailView.Sort(DetailView_AircraftLevel, ListSortDirection.Ascending); DetailView.Sort(DetailView_Level, ListSortDirection.Ascending); DetailView.ResumeLayout(); Text = EncycloRes.EquipmentList + " - " + KCDatabase.Instance.MasterEquipments[equipmentID].Name; }
public FleetManager() { Fleets = new IDDictionary<FleetData>(); AnchorageRepairingTimer = DateTime.Now; }
public QuestManager() { Quests = new IDDictionary<QuestData>(); IsLoaded = false; }
/// <summary> /// 詳細ビューを更新します。 /// </summary> private void UpdateDetailView(int equipmentID) { DetailView.SuspendLayout(); DetailView.Rows.Clear(); //装備数カウント var eqs = KCDatabase.Instance.Equipments.Values.Where(eq => eq.EquipmentID == equipmentID); var countlist = new IDDictionary <DetailCounter>(); foreach (var eq in eqs) { var c = countlist[eq.Level]; if (c == null) { countlist.Add(new DetailCounter(eq.Level)); c = countlist[eq.Level]; } c.countAll++; c.countRemain++; c.countRemainPrev++; } //装備艦集計 foreach (var ship in KCDatabase.Instance.Ships.Values) { foreach (var eq in ship.SlotInstance.Where(s => s != null && s.EquipmentID == equipmentID)) { countlist[eq.Level].countRemain--; } foreach (var c in countlist.Values) { if (c.countRemain != c.countRemainPrev) { int diff = c.countRemainPrev - c.countRemain; c.equippedShips.Add(ship.NameWithLevel + (diff > 1 ? (" x" + diff) : "")); c.countRemainPrev = c.countRemain; } } } //行に反映 var rows = new List <DataGridViewRow>(eqs.Count()); foreach (var c in countlist.Values) { if (c.equippedShips.Count() == 0) { c.equippedShips.Add(""); } foreach (var s in c.equippedShips) { var row = new DataGridViewRow(); row.CreateCells(DetailView); row.SetValues(c.level, c.countAll, c.countRemain, s); rows.Add(row); } } DetailView.Rows.AddRange(rows.ToArray()); DetailView.Sort(DetailView_Level, ListSortDirection.Ascending); DetailView.ResumeLayout(); Text = EncycloRes.EquipmentList + " - " + KCDatabase.Instance.MasterEquipments[equipmentID].Name; }
public SyncBGMPlayer() { _mp = new MediaPlayer(); if ( !_mp.IsAvailable ) Utility.Logger.Add( 3, "Windows Media Player のロードに失敗しました。音声の再生はできません。" ); _mp.AutoPlay = false; _isBoss = false; Enabled = false; Handles = new IDDictionary<SoundHandle>(); foreach ( SoundHandleID id in Enum.GetValues( typeof( SoundHandleID ) ) ) Handles.Add( new SoundHandle( id ) ); #region API register APIObserver o = APIObserver.Instance; o["api_port/port"].ResponseReceived += PlayPort; o["api_req_map/start"].ResponseReceived += PlaySortie; o["api_req_map/next"].ResponseReceived += PlaySortie; o["api_req_sortie/battle"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/battle"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/battle_water"].ResponseReceived += PlayBattleDay; o["api_req_battle_midnight/battle"].ResponseReceived += PlayBattleNight; o["api_req_battle_midnight/sp_midnight"].ResponseReceived += PlayBattleNight; o["api_req_combined_battle/midnight_battle"].ResponseReceived += PlayBattleNight; o["api_req_combined_battle/sp_midnight"].ResponseReceived += PlayBattleNight; o["api_req_sortie/airbattle"].ResponseReceived += PlayBattleAir; o["api_req_combined_battle/airbattle"].ResponseReceived += PlayBattleAir; o["api_req_sortie/ld_airbattle"].ResponseReceived += PlayBattleAir; o["api_req_combined_battle/ld_airbattle"].ResponseReceived += PlayBattleAir; o["api_req_practice/battle"].ResponseReceived += PlayPracticeDay; o["api_req_practice/midnight_battle"].ResponseReceived += PlayPracticeNight; o["api_req_sortie/battleresult"].ResponseReceived += PlayBattleResult; o["api_req_combined_battle/battleresult"].ResponseReceived += PlayBattleResult; o["api_req_practice/battle_result"].ResponseReceived += PlayBattleResult; o["api_get_member/record"].ResponseReceived += PlayRecord; o["api_get_member/payitem"].ResponseReceived += PlayItem; o["api_get_member/questlist"].ResponseReceived += PlayQuest; o["api_get_member/picture_book"].ResponseReceived += PlayAlbum; o["api_req_kousyou/remodel_slotlist"].ResponseReceived += PlayImprovementArsenal; #endregion Configuration.Instance.ConfigurationChanged += ConfigurationChanged; SystemEvents.SystemShuttingDown += SystemEvents_SystemShuttingDown; }
public void ConfigurationChanged() { var c = Utility.Configuration.Config.BGMPlayer; Enabled = c.Enabled; if ( c.Handles != null ) Handles = new IDDictionary<SoundHandle>( c.Handles ); if ( !c.SyncBrowserMute ) IsMute = false; // 設定変更を適用するためいったん閉じる _mp.Close(); }
private KCDatabase() { MasterShips = new IDDictionary<ShipDataMaster>(); ShipTypes = new IDDictionary<ShipType>(); MasterEquipments = new IDDictionary<EquipmentDataMaster>(); EquipmentTypes = new IDDictionary<EquipmentType>(); Ships = new IDDictionary<ShipData>(); Equipments = new IDDictionary<EquipmentData>(); Admiral = new AdmiralData(); MasterUseItems = new IDDictionary<UseItemMaster>(); UseItems = new IDDictionary<UseItem>(); Arsenals = new IDDictionary<ArsenalData>(); Docks = new IDDictionary<DockData>(); Fleet = new FleetManager(); Material = new MaterialData(); Quest = new QuestManager(); QuestProgress = new QuestProgressManager(); Battle = new BattleManager(); MapInfo = new IDDictionary<MapInfoData>(); Mission = new IDDictionary<MissionData>(); ShipGroup = new ShipGroupManager(); }
public SyncBGMPlayer() { _mp = new MediaPlayer(); if (!_mp.IsAvailable) { Utility.Logger.Add(3, "Windows Media Player のロードに失敗しました。音声の再生はできません。"); } _mp.AutoPlay = false; _mp.IsShuffle = true; _currentSoundHandleID = (SoundHandleID)(-1); _isBoss = false; Enabled = false; Handles = new IDDictionary <SoundHandle>(); foreach (SoundHandleID id in Enum.GetValues(typeof(SoundHandleID))) { Handles.Add(new SoundHandle(id)); } #region API register APIObserver o = APIObserver.Instance; o["api_port/port"].ResponseReceived += PlayPort; o["api_req_map/start"].ResponseReceived += PlaySortie; o["api_req_map/next"].ResponseReceived += PlaySortie; o["api_req_sortie/battle"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/battle"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/battle_water"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/ec_battle"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/each_battle"].ResponseReceived += PlayBattleDay; o["api_req_combined_battle/each_battle_water"].ResponseReceived += PlayBattleDay; o["api_req_battle_midnight/battle"].ResponseReceived += PlayBattleNight; o["api_req_battle_midnight/sp_midnight"].ResponseReceived += PlayBattleNight; o["api_req_combined_battle/midnight_battle"].ResponseReceived += PlayBattleNight; o["api_req_combined_battle/sp_midnight"].ResponseReceived += PlayBattleNight; o["api_req_combined_battle/ec_midnight_battle"].ResponseReceived += PlayBattleNight; o["api_req_sortie/airbattle"].ResponseReceived += PlayBattleAir; o["api_req_combined_battle/airbattle"].ResponseReceived += PlayBattleAir; o["api_req_sortie/ld_airbattle"].ResponseReceived += PlayBattleAir; o["api_req_combined_battle/ld_airbattle"].ResponseReceived += PlayBattleAir; o["api_req_practice/battle"].ResponseReceived += PlayPracticeDay; o["api_req_practice/midnight_battle"].ResponseReceived += PlayPracticeNight; o["api_req_sortie/battleresult"].ResponseReceived += PlayBattleResult; o["api_req_combined_battle/battleresult"].ResponseReceived += PlayBattleResult; o["api_req_practice/battle_result"].ResponseReceived += PlayBattleResult; o["api_get_member/record"].ResponseReceived += PlayRecord; o["api_get_member/payitem"].ResponseReceived += PlayItem; o["api_get_member/questlist"].ResponseReceived += PlayQuest; o["api_get_member/picture_book"].ResponseReceived += PlayAlbum; o["api_req_kousyou/remodel_slotlist"].ResponseReceived += PlayImprovementArsenal; #endregion Configuration.Instance.ConfigurationChanged += ConfigurationChanged; SystemEvents.SystemShuttingDown += SystemEvents_SystemShuttingDown; }
/// <summary> /// 詳細ビューを更新します。 /// </summary> private void UpdateDetailView( int equipmentID ) { DetailView.SuspendLayout(); DetailView.Rows.Clear(); //装備数カウント var eqs = KCDatabase.Instance.Equipments.Values.Where( eq => eq.EquipmentID == equipmentID ); var countlist = new IDDictionary<DetailCounter>(); foreach ( var eq in eqs ) { var c = countlist[DetailCounter.CalculateID( eq )]; if ( c == null ) { countlist.Add( new DetailCounter( eq.Level, eq.AircraftLevel ) ); c = countlist[DetailCounter.CalculateID( eq )]; } c.countAll++; c.countRemain++; c.countRemainPrev++; } //装備艦集計 foreach ( var ship in KCDatabase.Instance.Ships.Values ) { foreach ( var eq in ship.AllSlotInstance.Where( s => s != null && s.EquipmentID == equipmentID ) ) { countlist[DetailCounter.CalculateID( eq )].countRemain--; } foreach ( var c in countlist.Values ) { if ( c.countRemain != c.countRemainPrev ) { int diff = c.countRemainPrev - c.countRemain; c.equippedShips.Add( ship.NameWithLevel + ( diff > 1 ? ( " x" + diff ) : "" ) ); c.countRemainPrev = c.countRemain; } } } //行に反映 var rows = new List<DataGridViewRow>( eqs.Count() ); foreach ( var c in countlist.Values ) { if ( c.equippedShips.Count() == 0 ) { c.equippedShips.Add( "" ); } foreach ( var s in c.equippedShips ) { var row = new DataGridViewRow(); row.CreateCells( DetailView ); row.SetValues( c.level, c.aircraftLevel, c.countAll, c.countRemain, s ); rows.Add( row ); } } DetailView.Rows.AddRange( rows.ToArray() ); DetailView.Sort( DetailView_AircraftLevel, ListSortDirection.Ascending ); DetailView.Sort( DetailView_Level, ListSortDirection.Ascending ); DetailView.ResumeLayout(); Text = "装備一覧 - " + KCDatabase.Instance.MasterEquipments[equipmentID].Name; }
public override void Initialize() { ShipGroups = new IDDictionary<ShipGroupData>(); }