diff --git a/ElectronicObserver/Data/Battle/BattleAirBattle.cs b/ElectronicObserver/Data/Battle/BattleAirBattle.cs new file mode 100644 index 000000000..b35a70b25 --- /dev/null +++ b/ElectronicObserver/Data/Battle/BattleAirBattle.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Battle { + public class BattleAirBattle : BattleData { + + public override int FleetIDFriend { + get { return (int)RawData.api_dock_id; } + } + + public override int[] EmulateBattle() { + + int[] hp = new int[12]; + + KCDatabase db = KCDatabase.Instance; + + Action DealDamageFriend = ( int index, int damage ) => { + //if ( hp[index] == -1 ) return; + hp[index] -= Math.Max( damage, 0 ); + if ( hp[index] <= 0 ) { + ShipData ship = db.Ships[db.Fleet[FleetIDFriend].Members[index]]; + if ( ship == null ) return; + + foreach ( int id in ship.SlotMaster ) { + + if ( id == 42 ) { //応急修理要員 + hp[index] = (int)( ship.HPMax * 0.2 ); + break; + } else if ( id == 43 ) { //応急修理女神 + hp[index] = ship.HPMax; + break; + } + } + } + }; + + Action DealDamageEnemy = ( int index, int damage ) => { + //if ( hp[index + 6] == -1 ) return; + hp[index + 6] -= Math.Max( damage, 0 ); + }; + + + for ( int i = 0; i < 12; i++ ) { + hp[i] = (int)RawData.api_nowhps[i + 1]; + } + + + //第一次航空戦 + if ( (int)RawData.api_stage_flag[2] != 0 ) { + for ( int i = 0; i < 6; i++ ) { + DealDamageFriend( i, (int)RawData.api_kouku.api_stage3.api_fdam[i + 1] ); + DealDamageEnemy( i, (int)RawData.api_kouku.api_stage3.api_edam[i + 1] ); + } + } + + + //*/ //今のところ未実装だけど念のため + if ( RawData.api_support_flag() ) { + //支援艦隊(空撃) + if ( (int)RawData.api_support_flag == 1 ) { + for ( int i = 0; i < 6; i++ ) { + DealDamageEnemy( i, (int)RawData.api_support_info.api_support_airatack.api_stage3.api_edam[i + 1] ); + } + } + + //支援艦隊(砲雷撃) + if ( (int)RawData.api_support_flag == 2 || + (int)RawData.api_support_flag == 3 ) { + for ( int i = 0; i < 6; i++ ) { + DealDamageEnemy( i, (int)RawData.api_support_info.api_support_hourai.api_damage[i + 1] ); + } + } + } + //*/ + + //第二次航空戦 + if ( (int)RawData.api_stage_flag2[2] != 0 ) { + for ( int i = 0; i < 6; i++ ) { + DealDamageFriend( i, (int)RawData.api_kouku2.api_stage3.api_fdam[i + 1] ); + DealDamageEnemy( i, (int)RawData.api_kouku2.api_stage3.api_edam[i + 1] ); + } + } + + return hp; + + } + + public override string APIName { + get { return "api_req_sortie/airbattle"; } + } + + public override BattleData.BattleTypeFlag BattleType { + get { return BattleTypeFlag.Day; } + } + } +} diff --git a/ElectronicObserver/Data/Battle/BattleManager.cs b/ElectronicObserver/Data/Battle/BattleManager.cs index b55a1fa41..74552feeb 100644 --- a/ElectronicObserver/Data/Battle/BattleManager.cs +++ b/ElectronicObserver/Data/Battle/BattleManager.cs @@ -84,6 +84,12 @@ public override void LoadFromResponse( string apiname, dynamic data ) { BattleNight.LoadFromResponse( apiname, data ); break; + case "api_req_sortie/airbattle": + BattleMode = BattleModes.AirBattle; + BattleDay = new BattleAirBattle(); + BattleDay.LoadFromResponse( apiname, data ); + break; + case "api_req_combined_battle/battle": BattleMode = BattleModes.Normal | BattleModes.CombinedTaskForce; BattleDay = new BattleCombinedNormalDay(); diff --git a/ElectronicObserver/Data/Battle/BattleNormalDay.cs b/ElectronicObserver/Data/Battle/BattleNormalDay.cs index 245dfb98e..f33c372a2 100644 --- a/ElectronicObserver/Data/Battle/BattleNormalDay.cs +++ b/ElectronicObserver/Data/Battle/BattleNormalDay.cs @@ -8,7 +8,7 @@ namespace ElectronicObserver.Data.Battle { public class BattleNormalDay : BattleData { - + public override int[] EmulateBattle() { int[] hp = new int[12]; diff --git a/ElectronicObserver/Data/CompassData.cs b/ElectronicObserver/Data/CompassData.cs index 4bd32df3e..7ce3edebb 100644 --- a/ElectronicObserver/Data/CompassData.cs +++ b/ElectronicObserver/Data/CompassData.cs @@ -32,9 +32,16 @@ public int Destination { get { return (int)RawData.api_no; } } + /// + /// 次のセルのグラフィック + /// + public int ColorID { + get { return (int)RawData.api_color_no; } + } + /// /// イベントID - /// 0=初期位置, 2=資源, 3=渦潮, 4=通常戦闘, 5=ボス戦闘, 6=気のせいだった, 7=連合艦隊航空戦 + /// 0=初期位置, 2=資源, 3=渦潮, 4=通常戦闘, 5=ボス戦闘, 6=気のせいだった, 7=航空戦, 8=船団護衛成功 /// public int EventID { get { return (int)RawData.api_event_id; } @@ -62,6 +69,31 @@ public bool IsEndPoint { get { return NextBranchCount == 0; } } + /// + /// 吹き出しの内容 + /// 0=なし, 1="敵艦隊発見!", 2="攻撃目標発見!" + /// + public int CommentID { + get { + if ( RawData.api_comment_kind() ) //startには存在しないため + return (int)RawData.api_comment_kind; + else + return 0; + } + } + + /// + /// 索敵に成功したか 0=失敗, 1=成功(索敵機発艦) + /// + public int LaunchedRecon { + get { + if ( RawData.api_production_kind() ) + return (int)RawData.api_production_kind; + else + return 0; + } + } + /// /// 交戦する敵艦隊ID @@ -83,7 +115,9 @@ public int GetItemID { get { if ( RawData.api_itemget() ) { return (int)RawData.api_itemget.api_usemst; - } else { + } else if ( RawData.api_itemget_eo_comment() ) { + return (int)RawData.api_itemget_eo_comment.api_usemst; + } else { return -1; } } @@ -97,6 +131,8 @@ public int GetItemIDMetadata { get { if ( RawData.api_itemget() ) { return (int)RawData.api_itemget.api_id; + } else if ( RawData.api_itemget_eo_comment() ) { + return (int)RawData.api_itemget_eo_comment.api_id; } else { return 0; } @@ -110,6 +146,8 @@ public int GetItemAmount { get { if ( RawData.api_itemget() ) { return (int)RawData.api_itemget.api_getcount; + } else if ( RawData.api_itemget_eo_comment() ) { + return (int)RawData.api_itemget_eo_comment.api_getcount; } else { return 0; } diff --git a/ElectronicObserver/Data/Constants.cs b/ElectronicObserver/Data/Constants.cs index 341122712..1a05d44f2 100644 --- a/ElectronicObserver/Data/Constants.cs +++ b/ElectronicObserver/Data/Constants.cs @@ -192,7 +192,9 @@ public static string GetMapEventID( int value ) { case 6: return "気のせいだった"; case 7: - return "機動部隊航空戦"; + return "航空戦"; + case 8: + return "船団護衛成功"; default: return "不明"; } diff --git a/ElectronicObserver/Data/DockData.cs b/ElectronicObserver/Data/DockData.cs index 26ee24ad5..62d80fe24 100644 --- a/ElectronicObserver/Data/DockData.cs +++ b/ElectronicObserver/Data/DockData.cs @@ -68,7 +68,7 @@ public override void LoadFromResponse( string apiname, dynamic data ) { } break; } - + } @@ -81,7 +81,7 @@ public override string ToString() { case 0: sb.Append( "" ); break; case 1: - sb.Append( KCDatabase.Instance.MasterShips[ShipID].Name + ", at " + CompletionTime.ToString() ); break; + sb.Append( KCDatabase.Instance.Ships[ShipID].MasterShip.Name + ", at " + CompletionTime.ToString() ); break; } return sb.ToString(); diff --git a/ElectronicObserver/Data/FleetData.cs b/ElectronicObserver/Data/FleetData.cs index de52f761f..85f48daec 100644 --- a/ElectronicObserver/Data/FleetData.cs +++ b/ElectronicObserver/Data/FleetData.cs @@ -219,7 +219,7 @@ public override void LoadFromRequest( string apiname, Dictionary } } - + } @@ -236,7 +236,7 @@ public override void LoadFromRequest( string apiname, Dictionary _members[i] = replacedID; else RemoveShip( i ); - + break; } } @@ -404,6 +404,9 @@ public double GetSearchingAbility() { case 1: return Calculator.GetSearchingAbility_Autumn( this ); + + case 2: + return Calculator.GetSearchingAbility_TinyAutumn( this ); } } @@ -411,13 +414,24 @@ public double GetSearchingAbility() { /// 現在の設定に応じて、索敵能力を表す文字列を取得します。 /// public string GetSearchingAbilityString() { - switch ( Utility.Configuration.Config.FormFleet.SearchingAbilityMethod ) { + return this.GetSearchingAbilityString( Utility.Configuration.Config.FormFleet.SearchingAbilityMethod ); + } + + /// + /// 指定の計算式で、索敵能力を表す文字列を取得します。 + /// + /// 計算式。0-2 + public string GetSearchingAbilityString( int index ) { + switch ( index ) { default: case 0: return Calculator.GetSearchingAbility_Old( this ).ToString(); case 1: return Calculator.GetSearchingAbility_Autumn( this ).ToString( "F1" ); + + case 2: + return Calculator.GetSearchingAbility_TinyAutumn( this ).ToString(); } } @@ -473,14 +487,14 @@ public static FleetStates UpdateFleetState( FleetData fleet, ImageLabel label, T long ntime = db.Docks.Values.Max( dock => { if ( dock.State == 1 && fleet.Members.Count( ( id => id == dock.ShipID ) ) > 0 ) - return dock.CompletionTime.ToBinary(); + return dock.CompletionTime.Ticks; else return 0; } ); if ( ntime > 0 ) { //入渠中 - timer = DateTime.FromBinary( ntime ); + timer = new DateTime( ntime ); label.Text = "入渠中 " + DateTimeHelper.ToTimeRemainString( timer ); label.ImageIndex = (int)ResourceManager.IconContent.FleetDocking; diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index 0a2e25c69..0a499e172 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -84,6 +84,7 @@ + @@ -147,6 +148,7 @@ + diff --git a/ElectronicObserver/Notifier/NotifierDamage.cs b/ElectronicObserver/Notifier/NotifierDamage.cs index c3c1fb576..8597631b8 100644 --- a/ElectronicObserver/Notifier/NotifierDamage.cs +++ b/ElectronicObserver/Notifier/NotifierDamage.cs @@ -92,6 +92,7 @@ private void Initialize() { o["api_req_sortie/battle"].ResponseReceived += BattleStarted; o["api_req_battle_midnight/battle"].ResponseReceived += BattleStarted; o["api_req_battle_midnight/sp_midnight"].ResponseReceived += BattleStarted; + o["api_req_sortie/airbattle"].ResponseReceived += BattleStarted; o["api_req_combined_battle/battle"].ResponseReceived += BattleStarted; o["api_req_combined_battle/battle_water"].ResponseReceived += BattleStarted; o["api_req_combined_battle/airbattle"].ResponseReceived += BattleStarted; diff --git a/ElectronicObserver/Observer/APIObserver.cs b/ElectronicObserver/Observer/APIObserver.cs index 6764c4272..0d7a11c34 100644 --- a/ElectronicObserver/Observer/APIObserver.cs +++ b/ElectronicObserver/Observer/APIObserver.cs @@ -84,6 +84,7 @@ private APIObserver() { APIList.Add( new kcsapi.api_get_member.material() ); APIList.Add( new kcsapi.api_req_mission.result() ); APIList.Add( new kcsapi.api_req_ranking.getlist() ); + APIList.Add( new kcsapi.api_req_sortie.airbattle() ); APIList.Add( new kcsapi.api_req_quest.clearitemget() ); APIList.Add( new kcsapi.api_req_nyukyo.start() ); diff --git a/ElectronicObserver/Observer/kcsapi/api_req_sortie/airbattle.cs b/ElectronicObserver/Observer/kcsapi/api_req_sortie/airbattle.cs new file mode 100644 index 000000000..c4b4a434c --- /dev/null +++ b/ElectronicObserver/Observer/kcsapi/api_req_sortie/airbattle.cs @@ -0,0 +1,25 @@ +using ElectronicObserver.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Observer.kcsapi.api_req_sortie { + + public class airbattle : APIBase { + + public override void OnResponseReceived( dynamic data ) { + + KCDatabase.Instance.Battle.LoadFromResponse( APIName, data ); + + + base.OnResponseReceived( (object)data ); + } + + public override string APIName { + get { return "api_req_sortie/airbattle"; } + } + + } +} diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index e49c22a68..8c43df65d 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -358,7 +358,7 @@ api_start2 :艦娘・装備固有データその他 api_id :海域セルユニークID(全海域の通し番号) api_no :海域セルID(同海域内限定) api_color_no :セルの状態 - 0=初期位置, 1=(存在せず), 2=資源獲得, 3=渦潮, 4=通常戦闘, 5=ボス戦闘, 6=(気のせいだった, api_req_map/start|nextにのみ存在, ここでは4として扱われる?), 7=連合艦隊航空戦 + 0=初期位置, 1=(存在せず), 2=資源獲得, 3=渦潮, 4=通常戦闘, 5=ボス戦闘, 6=(気のせいだった, api_req_map/start|nextにのみ存在, ここでは4として扱われる?), 7=航空戦, 8=船団護衛成功 api_mst_mission :遠征データ api_id :遠征ID @@ -374,6 +374,9 @@ api_start2 :艦娘・装備固有データその他 api_return_flag :遠征中止可否 api_mst_const : + api_parallel_quest_max : + api_string_value : + api_int_value :「最大受領可能任務数」最大値? api_boko_max_ships : api_string_value : api_int_value :「最大保有艦娘数」最大値 @@ -491,6 +494,7 @@ api_port/port :母港情報 api_p_bgm_id :母港BGMのID api_event_object :秋イベで追加 api_m_flag : + api_parallel_quest_count :最大受領可能任務数 api_get_member/slot_item :装備品情報 api_id :装備固有ID @@ -1034,8 +1038,8 @@ api_req_map/next :進撃 api_next :次のマスでのルート分岐の本数 0=行き止まり api_bosscell_no :ボスセルID api_bosscomp :ボス到達済みフラグ?コード中にスペルミスがあり未使用 - api_comment_kind :0=なし 1=<敵艦隊発見!> 2=<攻撃目標発見!>? - api_production_kind :0=なし 1=索敵機発艦 + api_comment_kind :0=なし 1=<敵艦隊発見!> 2=<攻撃目標発見!>? startにはないので注意 + api_production_kind :0=なし 1=索敵機発艦 startにはないので注意 api_eventmap :イベント海域ゲージ情報 api_max_maphp :ゲージ最大値 api_now_maphp :ゲージ現在値 startとは異なり実際の値が入る @@ -1057,6 +1061,15 @@ api_req_map/next :進撃 api_mst_id :落とした資源の種類 2=弾薬 api_icon_id :表示アイコンID? 2=弾薬 api_dentan :電探による被害軽減フラグ(1=軽減) + api_get_eo_rate :獲得戦果 次が船団護衛成功マスのときのみ存在(ゲージ破壊時追加で) + api_itemget_eo_result :次が船団護衛成功マスのときのみ存在(ゲージ破壊時追加で) + api_usemst :5 + api_id :60=プレゼント箱 + api_getcount :入手個数 + api_itemget_eo_comment :次が船団護衛成功マスのときのみ存在 + api_usemst :4=資源 + api_id :多分api_itemgetと同じ(3=鋼材) + api_getcount :入手資源量 api_req_sortie/battle :戦闘(昼戦) api_dock_id :こちらの出撃艦隊ID @@ -1190,6 +1203,12 @@ api_req_battle_midnight/sp_midnight :開幕夜戦 api_deck_id :数値 api_formation :陣形 昼戦のそれと同じ api_eParamとapi_touch_planeの間 +api_req_sortie/airbattle :航空戦 + (全メンバが api_req_sortie/battle を継承) + api_support_flag :(存在せず) + api_support_info :(存在せず) + api_stage_flag2 :第二次航空戦フラグ + api_kouku2 :第二次航空戦 api_koukuに準じる api_req_sortie/battleresult :戦闘結果 api_ship_id :敵艦船ID diff --git a/ElectronicObserver/Other/Information/kcmemo.md b/ElectronicObserver/Other/Information/kcmemo.md index 839dc382a..86ca2c9a6 100644 --- a/ElectronicObserver/Other/Information/kcmemo.md +++ b/ElectronicObserver/Other/Information/kcmemo.md @@ -415,3 +415,8 @@ Bismarck dreiに対する魚雷装備・試製51cm連装砲の装備判定は、 * 輸送船5隻の変則デイリーと輸送船3隻のデイリーはカウンタが干渉。1隻撃沈で2増える * あ号作戦の「出撃」は文字通りであり、戦闘を行う必要はない(ex. 6-1で戦艦2を含めて即帰投しても増える) +#### EnemySlotItemImage + +敵艦装備グラフィックの置換処理?@commonAssets +550(ツ級砲)は10cm連装高角砲、551(戦艦水鬼砲)は試製51cm連装砲になる? + diff --git a/ElectronicObserver/Resource/Record/ShipParameterRecord.cs b/ElectronicObserver/Resource/Record/ShipParameterRecord.cs index 6282f0688..262460329 100644 --- a/ElectronicObserver/Resource/Record/ShipParameterRecord.cs +++ b/ElectronicObserver/Resource/Record/ShipParameterRecord.cs @@ -307,6 +307,7 @@ public ShipParameterRecord() ao.APIList["api_req_sortie/battle"].ResponseReceived += BattleStart; //ao.APIList["api_req_battle_midnight/battle"].ResponseReceived += BattleStart; ao.APIList["api_req_battle_midnight/sp_midnight"].ResponseReceived += BattleStart; + ao.APIList["api_req_sortie/airbattle"].ResponseReceived += BattleStart; ao.APIList["api_req_combined_battle/battle"].ResponseReceived += BattleStart; //ao.APIList["api_req_combined_battle/midnight_battle"].ResponseReceived += BattleStart; ao.APIList["api_req_combined_battle/sp_midnight"].ResponseReceived += BattleStart; diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index 1b6ee1a52..9d8df7e36 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -347,10 +347,33 @@ public class ConfigFormFleet : ConfigPartBase { /// public int SearchingAbilityMethod { get; set; } + /// + /// スクロール可能か + /// + public bool IsScrollable { get; set; } + + /// + /// 艦名表示の幅を固定するか + /// + public bool FixShipNameWidth { get; set; } + + /// + /// HPバーを短縮するか + /// + public bool ShortenHPBar { get; set; } + + /// + /// next lv. を表示するか + /// + public bool ShowNextExp { get; set; } public ConfigFormFleet() { ShowAircraft = true; SearchingAbilityMethod = 0; + IsScrollable = true; + FixShipNameWidth = false; + ShortenHPBar = false; + ShowNextExp = true; } } /// [艦隊]ウィンドウ diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index 0ddbb4c54..e385fc269 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -102,7 +102,7 @@ public static int GetAirSuperiority( int[] fleet, int[][] slot ) { public static int GetAirSuperiority( ShipData ship ) { return GetAirSuperiority( ship.SlotMaster.ToArray(), ship.Aircraft.ToArray() ); - + } /// @@ -222,7 +222,7 @@ public static double GetSearchingAbility_Autumn( FleetData fleet ) { case 13: //大型電探 ret += eq.LOS * 0.9906638; break; - + case 29: //探照灯 ret += eq.LOS * 0.9067950; break; @@ -236,6 +236,62 @@ public static double GetSearchingAbility_Autumn( FleetData fleet ) { } + /// + /// 索敵能力を求めます。「2-5式(秋)簡易式」です。 + /// + /// 対象の艦隊。 + public static double GetSearchingAbility_TinyAutumn( FleetData fleet ) { + + double ret = 0.0; + + foreach ( var ship in fleet.MembersWithoutEscaped ) { + if ( ship == null ) continue; + + double cur = Math.Sqrt( ship.LOSBase ); + + foreach ( var eq in ship.SlotInstanceMaster ) { + if ( eq == null ) continue; + + switch ( eq.CategoryType ) { + + case 7: //艦爆 + cur += eq.LOS * 0.6; break; + + case 8: //艦攻 + cur += eq.LOS * 0.8; break; + + case 9: //艦偵 + cur += eq.LOS * 1.0; break; + + case 10: //水偵 + cur += eq.LOS * 1.2; break; + + case 11: //水爆 + cur += eq.LOS * 1.0; break; + + case 12: //小型電探 + cur += eq.LOS * 0.6; break; + + case 13: //大型電探 + cur += eq.LOS * 0.6; break; + + case 29: //探照灯 + cur += eq.LOS * 0.5; break; + + default: //その他 + cur += eq.LOS * 0.5; break; + } + } + + ret += Math.Floor( cur ); + } + + ret -= Math.Floor( KCDatabase.Instance.Admiral.Level * 0.4 ); + + return Math.Round( ret, 1 ); + } + + /// @@ -404,7 +460,7 @@ public static int GetNightAttackKind( int[] slot, int attackerShipID, int defene else if ( slot.Length > 0 ) { EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[slot[0]]; if ( eq != null && eq.EquipmentType[2] == 5 ) { //最初のスロット==魚雷 (本来の判定とは微妙に異なるが無問題) - return 9; //雷撃 + return 9; //雷撃 } } diff --git a/ElectronicObserver/Utility/Mathematics/DateTimeHelper.cs b/ElectronicObserver/Utility/Mathematics/DateTimeHelper.cs index b0991ca7d..15ad1b11c 100644 --- a/ElectronicObserver/Utility/Mathematics/DateTimeHelper.cs +++ b/ElectronicObserver/Utility/Mathematics/DateTimeHelper.cs @@ -14,7 +14,7 @@ public static class DateTimeHelper { /// /// 起点となる日時。 /// - private static readonly DateTime origin = new DateTime( 1970, 1, 1, 9, 0, 0 ); + private static readonly long origin = new DateTime( 1970, 1, 1, 0, 0, 0 ).Ticks; /// @@ -23,7 +23,7 @@ public static class DateTimeHelper { /// 日時データ。 /// 変換された public static DateTime FromAPITime( long time ) { - return new DateTime( time * 10000 + origin.Ticks ); + return new DateTime( time * 10000 + origin, DateTimeKind.Utc ).ToLocalTime(); } /// @@ -32,7 +32,7 @@ public static DateTime FromAPITime( long time ) { /// 日時データ。 /// 変換された日時のAPIデータ。 public static long ToAPITime( DateTime time ) { - return ( time.Ticks - origin.Ticks ) / 10000; + return ( time.ToUniversalTime().Ticks - origin ) / 10000; } diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs index bd276d0f0..bf5f9d173 100644 --- a/ElectronicObserver/Utility/SoftwareInformation.cs +++ b/ElectronicObserver/Utility/SoftwareInformation.cs @@ -35,7 +35,7 @@ public static string SoftwareNameEnglish { /// public static string VersionJapanese { get { - return SoftwareNameJapanese + "一一型"; + return SoftwareNameJapanese + "一一型改"; } } @@ -44,7 +44,7 @@ public static string VersionJapanese { /// public static string VersionEnglish { get { - return "1.1.0"; + return "1.1.1"; } } @@ -54,7 +54,7 @@ public static string VersionEnglish { /// public static DateTime UpdateTime { get { - return DateTimeHelper.CSVStringToTime( "2015/03/28 12:00:00" ); + return DateTimeHelper.CSVStringToTime( "2015/04/11 18:00:00" ); } } diff --git a/ElectronicObserver/Window/Control/ShipStatusEquipment.cs b/ElectronicObserver/Window/Control/ShipStatusEquipment.cs index db87099f8..88edd7aac 100644 --- a/ElectronicObserver/Window/Control/ShipStatusEquipment.cs +++ b/ElectronicObserver/Window/Control/ShipStatusEquipment.cs @@ -21,17 +21,15 @@ private class SlotItem { public EquipmentDataMaster Equipment { get { - if ( EquipmentID != -1 ) - return KCDatabase.Instance.MasterEquipments[EquipmentID]; - else - return null; + return KCDatabase.Instance.MasterEquipments[EquipmentID]; } } public int EquipmentIconID { get { - if ( EquipmentID != -1 ) - return KCDatabase.Instance.MasterEquipments[EquipmentID].EquipmentType[3]; + var eq = KCDatabase.Instance.MasterEquipments[EquipmentID]; + if ( eq != null ) + return eq.IconType; else return -1; } @@ -52,11 +50,12 @@ public SlotItem() { private SlotItem[] SlotList; - + private int SlotSize { get; set; } + [Browsable( true )] [DefaultValue( typeof( Font ), "Meiryo UI, 10px" )] - public override Font Font { + public override Font Font { get { return base.Font; } set { base.Font = value; @@ -159,8 +158,6 @@ public int SlotMargin { } - private int SlotSize { get; set; } - #endregion @@ -172,10 +169,11 @@ public ShipStatusEquipment() { for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } + SlotSize = 0; base.Font = new Font( "Meiryo UI", 10, FontStyle.Regular, GraphicsUnit.Pixel ); - + _aircraftColorDisabled = Color.FromArgb( 0xAA, 0xAA, 0xAA ); _aircraftColorLost = Color.FromArgb( 0xFF, 0x00, 0xFF ); _aircraftColorDamaged = Color.FromArgb( 0xFF, 0x00, 0x00 ); @@ -187,7 +185,6 @@ public ShipStatusEquipment() { _overlayAircraft = false; _slotMargin = 3; - SlotSize = 0; } @@ -198,20 +195,23 @@ public ShipStatusEquipment() { /// 当該艦船。 public void SetSlotList( ShipData ship ) { - if ( SlotList.Length != ship.Slot.Count ) { - SlotList = new SlotItem[ship.Slot.Count]; + int slotCount = Math.Max( ship.MasterShip.SlotSize, 4 ); + + if ( SlotList.Length != slotCount ) { + SlotList = new SlotItem[slotCount]; for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } } for ( int i = 0; i < SlotList.Length; i++ ) { - SlotList[i].EquipmentID = ship.Slot[i] != -1 ? KCDatabase.Instance.Equipments[ship.Slot[i]].EquipmentID : -1; + var eq = ship.SlotInstance[i]; + SlotList[i].EquipmentID = eq != null ? eq.EquipmentID : -1; SlotList[i].AircraftCurrent = ship.Aircraft[i]; - SlotList[i].AircraftMax = KCDatabase.Instance.MasterShips[ship.ShipID].Aircraft[i]; + SlotList[i].AircraftMax = ship.MasterShip.Aircraft[i]; } - SlotSize = KCDatabase.Instance.MasterShips[ship.ShipID].SlotSize; + SlotSize = ship.MasterShip.SlotSize; PropertyChanged(); } @@ -273,7 +273,7 @@ private void PropertyChanged() { if ( AutoSize ) Size = GetPreferredSize( Size ); - + Refresh(); } @@ -292,16 +292,18 @@ private void ShipStatusEquipment_Paint( object sender, PaintEventArgs e ) { textformat |= TextFormatFlags.Top | TextFormatFlags.Left; } + // 艦載機スロット表示の予測サイズ(2桁) Size sz_eststr = TextRenderer.MeasureText( "99", Font, new Size( int.MaxValue, int.MaxValue ), textformat ); sz_eststr.Width -= (int)( Font.Size / 2.0 ); - + + // スロット1つ当たりのサイズ(右の余白含む) Size sz_unit = new Size( eqimages.ImageSize.Width + SlotMargin, eqimages.ImageSize.Height ); if ( ShowAircraft ) { if ( !OverlayAircraft ) sz_unit.Width += sz_eststr.Width; sz_unit.Height = Math.Max( sz_unit.Height, sz_eststr.Height ); } - + for ( int slotindex = 0; slotindex < SlotList.Length; slotindex++ ) { @@ -350,7 +352,7 @@ private void ShipStatusEquipment_Paint( object sender, PaintEventArgs e ) { if ( slot.EquipmentID != -1 ) { - switch ( slot.Equipment.EquipmentType[2] ) { + switch ( slot.Equipment.CategoryType ) { case 6: //艦戦 case 7: //艦爆 case 8: //艦攻 @@ -377,9 +379,6 @@ private void ShipStatusEquipment_Paint( object sender, PaintEventArgs e ) { break; } - } else if ( slotindex >= SlotSize && slot.AircraftMax == 0 ) { - drawAircraftSlot = false; - } else if ( slot.AircraftMax == 0 ) { drawAircraftSlot = false; } @@ -392,14 +391,37 @@ private void ShipStatusEquipment_Paint( object sender, PaintEventArgs e ) { using ( SolidBrush b = new SolidBrush( Color.FromArgb( 0x80, 0xFF, 0xFF, 0xFF ) ) ) { e.Graphics.FillRectangle( b, new Rectangle( textarea.X, textarea.Y, sz_eststr.Width, sz_eststr.Height ) ); } + + } else { + + if ( slot.AircraftCurrent < 10 ) { + //1桁なら画像に近づける + + textarea.Width -= sz_eststr.Width / 2 - 1; + + } else if ( slot.AircraftCurrent >= 100 ) { + //3桁以上ならオーバーレイを入れる + + Size sz_realstr = TextRenderer.MeasureText( slot.AircraftCurrent.ToString(), Font, new Size( int.MaxValue, int.MaxValue ), textformat ); + sz_realstr.Width -= (int)( Font.Size / 2.0 ); + + using ( SolidBrush b = new SolidBrush( Color.FromArgb( 0x80, 0xFF, 0xFF, 0xFF ) ) ) { + e.Graphics.FillRectangle( b, new Rectangle( + textarea.X + sz_unit.Width - sz_realstr.Width, + textarea.Y + sz_unit.Height - sz_realstr.Height, + sz_realstr.Width, sz_realstr.Height ) ); + } + + } + } - + TextRenderer.DrawText( e.Graphics, slot.AircraftCurrent.ToString(), Font, textarea, aircraftColor, textformat ); } } - + } @@ -426,7 +448,7 @@ public override Size GetPreferredSize( Size proposedSize ) { sz_unit.Width += sz_eststr.Width; sz_unit.Height = Math.Max( sz_unit.Height, sz_eststr.Height ); } - + return new Size( Padding.Horizontal + sz_unit.Width * SlotList.Length, Padding.Vertical + Math.Max( eqimages.ImageSize.Height, sz_unit.Height ) ); diff --git a/ElectronicObserver/Window/Control/ShipStatusHP.cs b/ElectronicObserver/Window/Control/ShipStatusHP.cs index 876cfcf1d..b85c767b7 100644 --- a/ElectronicObserver/Window/Control/ShipStatusHP.cs +++ b/ElectronicObserver/Window/Control/ShipStatusHP.cs @@ -293,7 +293,7 @@ private void ShipStatusHP_Paint( object sender, PaintEventArgs e ) { - Point p = new Point( basearea.X, basearea.Bottom - barSize.Height - sz_text.Height + 1 ); + Point p = new Point( basearea.X, basearea.Bottom - barSize.Height - Math.Max( sz_text.Height, sz_hpmax.Height ) + 1 ); TextRenderer.DrawText( g, Text, SubFont, new Rectangle( p, sz_text ), SubFontColor, TextFormatText ); //g.DrawRectangle( Pens.Orange, new Rectangle( p, sz_text ) ); @@ -319,7 +319,7 @@ private void ShipStatusHP_Paint( object sender, PaintEventArgs e ) { public override Size GetPreferredSize( Size proposedSize ) { - Size maxsize = new Size( 99999, 99999 ); + Size maxsize = new Size( int.MaxValue, int.MaxValue ); Size barSize = _HPBar.GetPreferredSize(); diff --git a/ElectronicObserver/Window/Control/ShipStatusLevel.cs b/ElectronicObserver/Window/Control/ShipStatusLevel.cs index dbdd26d74..46dfe6738 100644 --- a/ElectronicObserver/Window/Control/ShipStatusLevel.cs +++ b/ElectronicObserver/Window/Control/ShipStatusLevel.cs @@ -14,7 +14,7 @@ public partial class ShipStatusLevel : UserControl { private const TextFormatFlags TextFormatValue = TextFormatFlags.NoPadding | TextFormatFlags.Bottom | TextFormatFlags.Right; private const TextFormatFlags TextFormatText = TextFormatFlags.NoPadding | TextFormatFlags.Bottom | TextFormatFlags.Left; - + #region Property @@ -113,7 +113,7 @@ public Font SubFont { [DefaultValue( "Lv." )] [DesignerSerializationVisibility( DesignerSerializationVisibility.Visible )] [EditorBrowsable( EditorBrowsableState.Always )] - [Bindable( BindableSupport.Default ) ] + [Bindable( BindableSupport.Default )] public override string Text { get { return _text; } set { @@ -192,7 +192,7 @@ private void ShipStatusLevel_Paint( object sender, PaintEventArgs e ) { sz_valuenext.Height = 0; } //*/ - + //alignment.bottom Point p = new Point( basearea.X, basearea.Bottom - sz_text.Height ); @@ -218,10 +218,6 @@ private void ShipStatusLevel_Paint( object sender, PaintEventArgs e ) { //e.Graphics.DrawRectangle( Pens.Orange, new Rectangle( p, sz_valuenext ) ); } - - - - } @@ -252,9 +248,9 @@ public override Size GetPreferredSize( Size proposedSize ) { - return new Size( sz_value.Width + sz_text.Width + InnerHorizontalMargin + Math.Max( sz_textnext.Width, sz_valuenext.Width ) + Padding.Horizontal, + return new Size( sz_value.Width + sz_text.Width + ( TextNext == null ? 0 : InnerHorizontalMargin ) + Math.Max( sz_textnext.Width, sz_valuenext.Width ) + Padding.Horizontal, Math.Max( sz_value.Height, sz_textnext.Height + sz_valuenext.Height - (int)( SubFont.Size / 2.0 ) ) + Padding.Vertical - 1 ); - + } diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs index 3311243d2..59fcf3370 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs @@ -82,6 +82,10 @@ private void InitializeComponent() { this.tabPage7 = new System.Windows.Forms.TabPage(); this.tabControl2 = new System.Windows.Forms.TabControl(); this.tabPage8 = new System.Windows.Forms.TabPage(); + this.FormFleet_ShowNextExp = new System.Windows.Forms.CheckBox(); + this.FormFleet_ShortenHPBar = new System.Windows.Forms.CheckBox(); + this.FormFleet_FixShipNameWidth = new System.Windows.Forms.CheckBox(); + this.FormFleet_IsScrollable = new System.Windows.Forms.CheckBox(); this.FormFleet_SearchingAbilityMethod = new System.Windows.Forms.ComboBox(); this.label13 = new System.Windows.Forms.Label(); this.FormFleet_ShowAircraft = new System.Windows.Forms.CheckBox(); @@ -98,6 +102,7 @@ private void InitializeComponent() { this.FormShipGroup_ShowStatusBar = new System.Windows.Forms.CheckBox(); this.FormShipGroup_AutoUpdate = new System.Windows.Forms.CheckBox(); this.tabPage12 = new System.Windows.Forms.TabPage(); + this.FormBrowser_AppliesStyleSheet = new System.Windows.Forms.CheckBox(); this.FormBrowser_ConfirmAtRefresh = new System.Windows.Forms.CheckBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.label18 = new System.Windows.Forms.Label(); @@ -125,7 +130,6 @@ private void InitializeComponent() { this.FontSelector = new System.Windows.Forms.FontDialog(); this.LayoutFileBrowser = new System.Windows.Forms.OpenFileDialog(); this.APIListBrowser = new System.Windows.Forms.OpenFileDialog(); - this.FormBrowser_AppliesStyleSheet = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Connection_UpstreamProxyPort)).BeginInit(); @@ -819,6 +823,10 @@ private void InitializeComponent() { // // tabPage8 // + this.tabPage8.Controls.Add(this.FormFleet_ShowNextExp); + this.tabPage8.Controls.Add(this.FormFleet_ShortenHPBar); + this.tabPage8.Controls.Add(this.FormFleet_FixShipNameWidth); + this.tabPage8.Controls.Add(this.FormFleet_IsScrollable); this.tabPage8.Controls.Add(this.FormFleet_SearchingAbilityMethod); this.tabPage8.Controls.Add(this.label13); this.tabPage8.Controls.Add(this.FormFleet_ShowAircraft); @@ -830,13 +838,58 @@ private void InitializeComponent() { this.tabPage8.Text = "艦隊"; this.tabPage8.UseVisualStyleBackColor = true; // + // FormFleet_ShowNextExp + // + this.FormFleet_ShowNextExp.AutoSize = true; + this.FormFleet_ShowNextExp.Location = new System.Drawing.Point(6, 135); + this.FormFleet_ShowNextExp.Name = "FormFleet_ShowNextExp"; + this.FormFleet_ShowNextExp.Size = new System.Drawing.Size(112, 19); + this.FormFleet_ShowNextExp.TabIndex = 6; + this.FormFleet_ShowNextExp.Text = "next. を表示する"; + this.ToolTipInfo.SetToolTip(this.FormFleet_ShowNextExp, "「次のレベルまでに必要な経験値」を表示するかを指定します。\r\n省略した場合スペースを節約できます。"); + this.FormFleet_ShowNextExp.UseVisualStyleBackColor = true; + // + // FormFleet_ShortenHPBar + // + this.FormFleet_ShortenHPBar.AutoSize = true; + this.FormFleet_ShortenHPBar.Location = new System.Drawing.Point(6, 110); + this.FormFleet_ShortenHPBar.Name = "FormFleet_ShortenHPBar"; + this.FormFleet_ShortenHPBar.Size = new System.Drawing.Size(114, 19); + this.FormFleet_ShortenHPBar.TabIndex = 5; + this.FormFleet_ShortenHPBar.Text = "HPバーを短縮する"; + this.ToolTipInfo.SetToolTip(this.FormFleet_ShortenHPBar, "HPバーを短縮し、スペースを節約します。"); + this.FormFleet_ShortenHPBar.UseVisualStyleBackColor = true; + // + // FormFleet_FixShipNameWidth + // + this.FormFleet_FixShipNameWidth.AutoSize = true; + this.FormFleet_FixShipNameWidth.Location = new System.Drawing.Point(6, 85); + this.FormFleet_FixShipNameWidth.Name = "FormFleet_FixShipNameWidth"; + this.FormFleet_FixShipNameWidth.Size = new System.Drawing.Size(136, 19); + this.FormFleet_FixShipNameWidth.TabIndex = 4; + this.FormFleet_FixShipNameWidth.Text = "艦名の横幅を固定する"; + this.ToolTipInfo.SetToolTip(this.FormFleet_FixShipNameWidth, "艦名表示部の幅を固定し、スペースを節約します。\r\n代わりに長い名前を持つ艦娘は見切れます。"); + this.FormFleet_FixShipNameWidth.UseVisualStyleBackColor = true; + // + // FormFleet_IsScrollable + // + this.FormFleet_IsScrollable.AutoSize = true; + this.FormFleet_IsScrollable.Location = new System.Drawing.Point(6, 60); + this.FormFleet_IsScrollable.Name = "FormFleet_IsScrollable"; + this.FormFleet_IsScrollable.Size = new System.Drawing.Size(144, 19); + this.FormFleet_IsScrollable.TabIndex = 3; + this.FormFleet_IsScrollable.Text = "スクロールバーを表示する"; + this.ToolTipInfo.SetToolTip(this.FormFleet_IsScrollable, "表示エリアがはみ出した場合にスクロールバーを表示するかを指定します。\r\n収まりきった場合は表示しません。"); + this.FormFleet_IsScrollable.UseVisualStyleBackColor = true; + // // FormFleet_SearchingAbilityMethod // this.FormFleet_SearchingAbilityMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.FormFleet_SearchingAbilityMethod.FormattingEnabled = true; this.FormFleet_SearchingAbilityMethod.Items.AddRange(new object[] { "(旧)2-5式", - "2-5式(秋)"}); + "2-5式(秋)", + "2-5新秋簡易式"}); this.FormFleet_SearchingAbilityMethod.Location = new System.Drawing.Point(115, 31); this.FormFleet_SearchingAbilityMethod.Name = "FormFleet_SearchingAbilityMethod"; this.FormFleet_SearchingAbilityMethod.Size = new System.Drawing.Size(121, 23); @@ -1002,14 +1055,25 @@ private void InitializeComponent() { this.tabPage12.Controls.Add(this.FormBrowser_LogInPageURL); this.tabPage12.Controls.Add(this.FormBrowser_ZoomRate); this.tabPage12.Controls.Add(this.label15); - this.tabPage12.Location = new System.Drawing.Point(4, 24); + this.tabPage12.Location = new System.Drawing.Point(4, 22); this.tabPage12.Name = "tabPage12"; this.tabPage12.Padding = new System.Windows.Forms.Padding(3); - this.tabPage12.Size = new System.Drawing.Size(378, 177); + this.tabPage12.Size = new System.Drawing.Size(378, 179); this.tabPage12.TabIndex = 3; this.tabPage12.Text = "ブラウザ"; this.tabPage12.UseVisualStyleBackColor = true; // + // FormBrowser_AppliesStyleSheet + // + this.FormBrowser_AppliesStyleSheet.AutoSize = true; + this.FormBrowser_AppliesStyleSheet.Location = new System.Drawing.Point(180, 31); + this.FormBrowser_AppliesStyleSheet.Name = "FormBrowser_AppliesStyleSheet"; + this.FormBrowser_AppliesStyleSheet.Size = new System.Drawing.Size(142, 19); + this.FormBrowser_AppliesStyleSheet.TabIndex = 8; + this.FormBrowser_AppliesStyleSheet.Text = "スタイルシートを適用する"; + this.ToolTipInfo.SetToolTip(this.FormBrowser_AppliesStyleSheet, "艦これ画面のみを表示できるようにします。\r\n環境によっては表示が乱れます、その場合は無効にしてください。"); + this.FormBrowser_AppliesStyleSheet.UseVisualStyleBackColor = true; + // // FormBrowser_ConfirmAtRefresh // this.FormBrowser_ConfirmAtRefresh.AutoSize = true; @@ -1033,7 +1097,7 @@ private void InitializeComponent() { this.groupBox2.Controls.Add(this.FormBrowser_ScreenShotFormat_JPEG); this.groupBox2.Location = new System.Drawing.Point(6, 88); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(366, 83); + this.groupBox2.Size = new System.Drawing.Size(366, 85); this.groupBox2.TabIndex = 6; this.groupBox2.TabStop = false; this.groupBox2.Text = "スクリーンショット"; @@ -1280,17 +1344,6 @@ private void InitializeComponent() { this.APIListBrowser.Filter = "Text File|*.txt|File|*"; this.APIListBrowser.Title = "API リストを開く"; // - // FormBrowser_AppliesStyleSheet - // - this.FormBrowser_AppliesStyleSheet.AutoSize = true; - this.FormBrowser_AppliesStyleSheet.Location = new System.Drawing.Point(180, 31); - this.FormBrowser_AppliesStyleSheet.Name = "FormBrowser_AppliesStyleSheet"; - this.FormBrowser_AppliesStyleSheet.Size = new System.Drawing.Size(142, 19); - this.FormBrowser_AppliesStyleSheet.TabIndex = 8; - this.FormBrowser_AppliesStyleSheet.Text = "スタイルシートを適用する"; - this.ToolTipInfo.SetToolTip(this.FormBrowser_AppliesStyleSheet, "艦これ画面のみを表示できるようにします。\r\n環境によっては表示が乱れます、その場合は無効にしてください。"); - this.FormBrowser_AppliesStyleSheet.UseVisualStyleBackColor = true; - // // DialogConfiguration // this.AcceptButton = this.ButtonOK; @@ -1457,5 +1510,9 @@ private void InitializeComponent() { private System.Windows.Forms.Label label9; private System.Windows.Forms.CheckBox FormBrowser_ConfirmAtRefresh; private System.Windows.Forms.CheckBox FormBrowser_AppliesStyleSheet; + private System.Windows.Forms.CheckBox FormFleet_FixShipNameWidth; + private System.Windows.Forms.CheckBox FormFleet_IsScrollable; + private System.Windows.Forms.CheckBox FormFleet_ShowNextExp; + private System.Windows.Forms.CheckBox FormFleet_ShortenHPBar; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs index 810a16302..6254bf8da 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs @@ -291,6 +291,10 @@ public void FromConfiguration( Configuration.ConfigurationData config ) { FormFleet_ShowAircraft.Checked = config.FormFleet.ShowAircraft; FormFleet_SearchingAbilityMethod.SelectedIndex = config.FormFleet.SearchingAbilityMethod; + FormFleet_IsScrollable.Checked = config.FormFleet.IsScrollable; + FormFleet_FixShipNameWidth.Checked = config.FormFleet.FixShipNameWidth; + FormFleet_ShortenHPBar.Checked = config.FormFleet.ShortenHPBar; + FormFleet_ShowNextExp.Checked = config.FormFleet.ShowNextExp; FormQuest_ShowRunningOnly.Checked = config.FormQuest.ShowRunningOnly; FormQuest_ShowOnce.Checked = config.FormQuest.ShowOnce; @@ -378,6 +382,10 @@ public void ToConfiguration( Configuration.ConfigurationData config ) { config.FormFleet.ShowAircraft = FormFleet_ShowAircraft.Checked; config.FormFleet.SearchingAbilityMethod = FormFleet_SearchingAbilityMethod.SelectedIndex; + config.FormFleet.IsScrollable = FormFleet_IsScrollable.Checked; + config.FormFleet.FixShipNameWidth = FormFleet_FixShipNameWidth.Checked; + config.FormFleet.ShortenHPBar = FormFleet_ShortenHPBar.Checked; + config.FormFleet.ShowNextExp = FormFleet_ShowNextExp.Checked; config.FormQuest.ShowRunningOnly = FormQuest_ShowRunningOnly.Checked; config.FormQuest.ShowOnce = FormQuest_ShowOnce.Checked; diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index e4f55defd..62559fe26 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -94,6 +94,7 @@ private void FormBattle_Load( object sender, EventArgs e ) { o.APIList["api_req_sortie/battleresult"].ResponseReceived += Updated; o.APIList["api_req_battle_midnight/battle"].ResponseReceived += Updated; o.APIList["api_req_battle_midnight/sp_midnight"].ResponseReceived += Updated; + o.APIList["api_req_sortie/airbattle"].ResponseReceived += Updated; o.APIList["api_req_combined_battle/battle"].ResponseReceived += Updated; o.APIList["api_req_combined_battle/midnight_battle"].ResponseReceived += Updated; o.APIList["api_req_combined_battle/sp_midnight"].ResponseReceived += Updated; @@ -164,6 +165,18 @@ private void Updated( string apiname, dynamic data ) { BaseLayoutPanel.Visible = true; } break; + case "api_req_sortie/airbattle": { + int[] hp = bm.BattleDay.EmulateBattle(); + + SetFormation( bm.BattleDay ); + SetSearchingResult( bm.BattleDay ); + SetAerialWarfareAirBattle( bm.BattleDay ); + SetHPNormal( hp, bm.BattleDay ); + SetDamageRateNormal( hp, bm.BattleDay ); + + BaseLayoutPanel.Visible = true; + } break; + case "api_req_combined_battle/battle": case "api_req_combined_battle/battle_water": { int[] hp = bm.BattleDay.EmulateBattle(); @@ -387,13 +400,17 @@ private void SetAerialWarfare( BattleData bd ) { AirStage2Friend.ImageAlign = ContentAlignment.MiddleCenter; AirStage2Friend.ImageIndex = -1; + ToolTipInfo.SetToolTip( AirStage2Friend, null ); AirStage2Enemy.ImageAlign = ContentAlignment.MiddleCenter; AirStage2Enemy.ImageIndex = -1; + ToolTipInfo.SetToolTip( AirStage2Enemy, null ); + } /// - /// 航空戦情報(連合艦隊航空戦)を設定します。 + /// 航空戦情報(航空戦)を設定します。 + /// 通常艦隊・連合艦隊両用です。 /// private void SetAerialWarfareAirBattle( BattleData bd ) { @@ -405,28 +422,44 @@ private void SetAerialWarfareAirBattle( BattleData bd ) { AirSuperiority.Text = Constants.GetAirSuperiority( (int)bd.Data.api_kouku.api_stage1.api_disp_seiku ); if ( isBattle2Enabled ) { - ToolTipInfo.SetToolTip( AirSuperiority, "2回目: " + Constants.GetAirSuperiority( (int)bd.Data.api_kouku2.api_stage1.api_disp_seiku ) ); + ToolTipInfo.SetToolTip( AirSuperiority, "第2次: " + Constants.GetAirSuperiority( (int)bd.Data.api_kouku2.api_stage1.api_disp_seiku ) ); } else { ToolTipInfo.SetToolTip( AirSuperiority, null ); } + /* int[] planeFriend = { (int)bd.Data.api_kouku.api_stage1.api_f_lostcount + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage1.api_f_lostcount : 0 ), (int)bd.Data.api_kouku.api_stage1.api_f_count }; - AirStage1Friend.Text = string.Format( "-{0}/{1}", planeFriend[0], planeFriend[1] ); - - if ( planeFriend[1] > 0 && planeFriend[0] == planeFriend[1] ) + */ + int[] planeFriend = { + (int)bd.Data.api_kouku.api_stage1.api_f_lostcount, + (int)bd.Data.api_kouku.api_stage1.api_f_count, + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage1.api_f_lostcount : 0 ), + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage1.api_f_count : 0 ), + }; + AirStage1Friend.Text = string.Format( "-{0}/{1}", planeFriend[0] + planeFriend[2], planeFriend[1] ); + ToolTipInfo.SetToolTip( AirStage1Friend, string.Format( "第1次: -{0}/{1}\r\n第2次: -{2}/{3}\r\n", + planeFriend[0], planeFriend[1], planeFriend[2], planeFriend[3] ) ); + + if ( planeFriend[1] > 0 && ( planeFriend[0] == planeFriend[1] || planeFriend[2] == planeFriend[3] ) ) AirStage1Friend.ForeColor = Color.Red; else AirStage1Friend.ForeColor = SystemColors.ControlText; - int[] planeEnemy = { - (int)bd.Data.api_kouku.api_stage1.api_e_lostcount + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage1.api_e_lostcount : 0 ), - (int)bd.Data.api_kouku.api_stage1.api_e_count }; - AirStage1Enemy.Text = string.Format( "-{0}/{1}", planeEnemy[0], planeEnemy[1] ); - if ( planeEnemy[1] > 0 && planeEnemy[0] == planeEnemy[1] ) + int[] planeEnemy = { + (int)bd.Data.api_kouku.api_stage1.api_e_lostcount, + (int)bd.Data.api_kouku.api_stage1.api_e_count, + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage1.api_e_lostcount : 0 ), + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage1.api_e_count : 0 ), + }; + AirStage1Enemy.Text = string.Format( "-{0}/{1}", planeEnemy[0] + planeEnemy[2], planeEnemy[1] ); + ToolTipInfo.SetToolTip( AirStage1Enemy, string.Format( "第1次: -{0}/{1}\r\n第2次: -{2}/{3}\r\n", + planeEnemy[0], planeEnemy[1], planeEnemy[2], planeEnemy[3] ) ); + + if ( planeEnemy[1] > 0 && ( planeEnemy[0] == planeEnemy[1] || planeEnemy[2] == planeEnemy[3] ) ) AirStage1Enemy.ForeColor = Color.Red; else AirStage1Enemy.ForeColor = SystemColors.ControlText; @@ -443,14 +476,15 @@ private void SetAerialWarfareAirBattle( BattleData bd ) { EquipmentDataMaster[] planes = { KCDatabase.Instance.MasterEquipments[touchFriend[0]], KCDatabase.Instance.MasterEquipments[touchFriend[1]] }; ToolTipInfo.SetToolTip( AirStage1Friend, string.Format( - "触接中\r\n1回目: {0}\r\n2回目: {1}", + "{0}触接中\r\n第1次: {1}\r\n第2次: {2}", + ToolTipInfo.GetToolTip( AirStage1Friend ) ?? "", planes[0] != null ? planes[0].Name : "(なし)", planes[1] != null ? planes[1].Name : "(なし)" ) ); } else { AirStage1Friend.ImageAlign = ContentAlignment.MiddleCenter; AirStage1Friend.ImageIndex = -1; - ToolTipInfo.SetToolTip( AirStage1Friend, null ); + //ToolTipInfo.SetToolTip( AirStage1Friend, null ); } int[] touchEnemy = { @@ -463,14 +497,15 @@ private void SetAerialWarfareAirBattle( BattleData bd ) { EquipmentDataMaster[] planes = { KCDatabase.Instance.MasterEquipments[touchEnemy[0]], KCDatabase.Instance.MasterEquipments[touchEnemy[1]] }; ToolTipInfo.SetToolTip( AirStage1Enemy, string.Format( - "触接中\r\n1回目: {0}\r\n2回目: {1}", + "{0}触接中\r\n第1次: {1}\r\n第2次: {2}", + ToolTipInfo.GetToolTip( AirStage1Enemy ) ?? "", planes[0] != null ? planes[0].Name : "(なし)", planes[1] != null ? planes[1].Name : "(なし)" ) ); } else { AirStage1Enemy.ImageAlign = ContentAlignment.MiddleCenter; AirStage1Enemy.ImageIndex = -1; - ToolTipInfo.SetToolTip( AirStage1Enemy, null ); + //ToolTipInfo.SetToolTip( AirStage1Enemy, null ); } } else { //空対空戦闘発生せず(!?) @@ -490,50 +525,84 @@ private void SetAerialWarfareAirBattle( BattleData bd ) { int[] planeFriend = { - (int)bd.Data.api_kouku.api_stage2.api_f_lostcount + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage2.api_f_lostcount : 0 ), - (int)bd.Data.api_kouku.api_stage2.api_f_count }; - AirStage2Friend.Text = string.Format( "-{0}/{1}", planeFriend[0], planeFriend[1] ); - - if ( planeFriend[1] > 0 && planeFriend[0] == planeFriend[1] ) + (int)bd.Data.api_kouku.api_stage2.api_f_lostcount, + (int)bd.Data.api_kouku.api_stage2.api_f_count, + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage2.api_f_lostcount : 0 ), + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage2.api_f_count : 0 ), + }; + AirStage2Friend.Text = string.Format( "-{0}/{1}", planeFriend[0] + planeFriend[2], planeFriend[1] ); + ToolTipInfo.SetToolTip( AirStage2Friend, string.Format( "第1次: -{0}/{1}\r\n第2次: -{2}/{3}\r\n", + planeFriend[0], planeFriend[1], planeFriend[2], planeFriend[3] ) ); + + if ( planeFriend[1] > 0 && ( planeFriend[0] == planeFriend[1] || planeFriend[2] == planeFriend[3] ) ) AirStage2Friend.ForeColor = Color.Red; else AirStage2Friend.ForeColor = SystemColors.ControlText; - int[] planeEnemy = { - (int)bd.Data.api_kouku.api_stage2.api_e_lostcount + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage2.api_e_lostcount : 0 ), - (int)bd.Data.api_kouku.api_stage2.api_e_count }; - AirStage2Enemy.Text = string.Format( "-{0}/{1}", planeEnemy[0], planeEnemy[1] ); - if ( planeEnemy[1] > 0 && planeEnemy[0] == planeEnemy[1] ) + int[] planeEnemy = { + (int)bd.Data.api_kouku.api_stage2.api_e_lostcount, + (int)bd.Data.api_kouku.api_stage2.api_e_count, + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage2.api_e_lostcount : 0 ), + ( isBattle2Enabled ? (int)bd.Data.api_kouku2.api_stage2.api_e_count : 0 ), + }; + AirStage2Enemy.Text = string.Format( "-{0}/{1}", planeEnemy[0] + planeEnemy[2], planeEnemy[1] ); + ToolTipInfo.SetToolTip( AirStage2Enemy, string.Format( "第1次: -{0}/{1}\r\n第2次: -{2}/{3}\r\n", + planeEnemy[0], planeEnemy[1], planeEnemy[2], planeEnemy[3] ) ); + + if ( planeEnemy[1] > 0 && ( planeEnemy[0] == planeEnemy[1] || planeEnemy[2] == planeEnemy[3] ) ) AirStage2Enemy.ForeColor = Color.Red; else AirStage2Enemy.ForeColor = SystemColors.ControlText; //対空カットイン - //undone: 二回目の対空カットインの処理(2015/03/03時点で航空戦と対空カットインは両立しないため) - if ( bd.Data.api_kouku.api_stage2.api_air_fire() ) { - int cutinID = (int)bd.Data.api_kouku.api_stage2.api_air_fire.api_kind; - int cutinIndex = (int)bd.Data.api_kouku.api_stage2.api_air_fire.api_idx; + { + bool[] fire = new bool[] { bd.Data.api_kouku.api_stage2.api_air_fire(), isBattle2Enabled && bd.Data.api_kouku2.api_stage2.api_air_fire() }; + int[] cutinID = new int[] { + fire[0] ? (int)bd.Data.api_kouku.api_stage2.api_air_fire.api_kind : -1, + fire[1] ? (int)bd.Data.api_kouku2.api_stage2.api_air_fire.api_kind : -1, + }; + int[] cutinIndex = new int[] { + fire[0] ? (int)bd.Data.api_kouku.api_stage2.api_air_fire.api_idx : -1, + fire[1] ? (int)bd.Data.api_kouku2.api_stage2.api_air_fire.api_idx : -1, + }; - AACutin.Text = "#" + ( cutinIndex + 1 ); - AACutin.ImageAlign = ContentAlignment.MiddleLeft; - AACutin.ImageIndex = (int)ResourceManager.EquipmentContent.HighAngleGun; - ToolTipInfo.SetToolTip( AACutin, string.Format( - "対空カットイン: {0}\r\nカットイン種別: {1} ({2})", - KCDatabase.Instance.Fleet[cutinIndex >= 6 ? 2 : bd.FleetIDFriend].MembersInstance[cutinIndex % 6].NameWithLevel, - cutinID, - Constants.GetAACutinKind( cutinID ) ) ); - } else { - AACutin.Text = "対空砲火"; - AACutin.ImageAlign = ContentAlignment.MiddleCenter; - AACutin.ImageIndex = -1; - ToolTipInfo.SetToolTip( AACutin, null ); + if ( fire[0] || fire[1] ) { + + AACutin.Text = string.Format( "#{0}/{1}", fire[0] ? ( cutinIndex[0] + 1 ).ToString() : "-", fire[1] ? ( cutinIndex[1] + 1 ).ToString() : "-" ); + AACutin.ImageAlign = ContentAlignment.MiddleLeft; + AACutin.ImageIndex = (int)ResourceManager.EquipmentContent.HighAngleGun; + + StringBuilder sb = new StringBuilder(); + sb.AppendLine( "対空カットイン" ); + for ( int i = 0; i < 2; i++ ) { + if ( fire[i] ) { + sb.AppendFormat( "第{0}次: {1}\r\nカットイン種別: {2} ({3})\r\n", + i + 1, + KCDatabase.Instance.Fleet[cutinIndex[i] >= 6 ? 2 : bd.FleetIDFriend].MembersInstance[cutinIndex[i] % 6].NameWithLevel, + cutinID[i], + Constants.GetAACutinKind( cutinID[i] ) ); + } else { + sb.AppendFormat( "第{0}次: (発動せず)\r\n", + i + 1 ); + } + } + ToolTipInfo.SetToolTip( AACutin, sb.ToString() ); + + } else { + AACutin.Text = "対空砲火"; + AACutin.ImageAlign = ContentAlignment.MiddleCenter; + AACutin.ImageIndex = -1; + ToolTipInfo.SetToolTip( AACutin, null ); + } } } else { AirStage2Friend.Text = "-"; + ToolTipInfo.SetToolTip( AirStage2Friend, null ); AirStage2Enemy.Text = "-"; + ToolTipInfo.SetToolTip( AirStage2Enemy, null ); AACutin.Text = "対空砲火"; AACutin.ImageAlign = ContentAlignment.MiddleCenter; AACutin.ImageIndex = -1; @@ -941,13 +1010,13 @@ private void SetNightBattleEvent( int[] hp, bool isCombined, BattleData bd ) { id => KCDatabase.Instance.MasterEquipments.ContainsKey( id ) && KCDatabase.Instance.MasterEquipments[id].CategoryType == 29 ) > 0 ) { - index = i - 1; + index = i; break; } } if ( index != -1 ) { - AirStage1Enemy.Text = "#" + ( index + 1 ); + AirStage1Enemy.Text = "#" + ( index ); AirStage1Enemy.ImageAlign = ContentAlignment.MiddleLeft; AirStage1Enemy.ImageIndex = (int)ResourceManager.EquipmentContent.Searchlight; ToolTipInfo.SetToolTip( AirStage1Enemy, "探照灯照射: " + KCDatabase.Instance.MasterShips[bd.EnemyFleetMembers[index]].NameWithClass ); diff --git a/ElectronicObserver/Window/FormCompass.Designer.cs b/ElectronicObserver/Window/FormCompass.Designer.cs index ec6e07c55..fa620cf68 100644 --- a/ElectronicObserver/Window/FormCompass.Designer.cs +++ b/ElectronicObserver/Window/FormCompass.Designer.cs @@ -25,10 +25,6 @@ protected override void Dispose( bool disposing ) { private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.BasePanel = new System.Windows.Forms.FlowLayoutPanel(); - this.TextMapArea = new System.Windows.Forms.Label(); - this.TextDestination = new System.Windows.Forms.Label(); - this.TextEventKind = new System.Windows.Forms.Label(); - this.TextEventDetail = new System.Windows.Forms.Label(); this.PanelEnemyFleet = new System.Windows.Forms.Panel(); this.TableEnemyMember = new System.Windows.Forms.TableLayoutPanel(); this.TableEnemyFleet = new System.Windows.Forms.TableLayoutPanel(); @@ -36,6 +32,10 @@ private void InitializeComponent() { this.TextFormation = new ElectronicObserver.Window.Control.ImageLabel(); this.TextAirSuperiority = new ElectronicObserver.Window.Control.ImageLabel(); this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.TextMapArea = new ElectronicObserver.Window.Control.ImageLabel(); + this.TextDestination = new ElectronicObserver.Window.Control.ImageLabel(); + this.TextEventKind = new ElectronicObserver.Window.Control.ImageLabel(); + this.TextEventDetail = new ElectronicObserver.Window.Control.ImageLabel(); this.BasePanel.SuspendLayout(); this.PanelEnemyFleet.SuspendLayout(); this.TableEnemyFleet.SuspendLayout(); @@ -56,53 +56,13 @@ private void InitializeComponent() { this.BasePanel.Size = new System.Drawing.Size(300, 200); this.BasePanel.TabIndex = 0; // - // TextMapArea - // - this.TextMapArea.AutoSize = true; - this.TextMapArea.Location = new System.Drawing.Point(3, 3); - this.TextMapArea.Margin = new System.Windows.Forms.Padding(3); - this.TextMapArea.Name = "TextMapArea"; - this.TextMapArea.Size = new System.Drawing.Size(41, 15); - this.TextMapArea.TabIndex = 0; - this.TextMapArea.Text = "(海域)"; - // - // TextDestination - // - this.TextDestination.AutoSize = true; - this.TextDestination.Location = new System.Drawing.Point(50, 3); - this.TextDestination.Margin = new System.Windows.Forms.Padding(3); - this.TextDestination.Name = "TextDestination"; - this.TextDestination.Size = new System.Drawing.Size(41, 15); - this.TextDestination.TabIndex = 1; - this.TextDestination.Text = "(行先)"; - // - // TextEventKind - // - this.TextEventKind.AutoSize = true; - this.TextEventKind.Location = new System.Drawing.Point(97, 3); - this.TextEventKind.Margin = new System.Windows.Forms.Padding(3); - this.TextEventKind.Name = "TextEventKind"; - this.TextEventKind.Size = new System.Drawing.Size(53, 15); - this.TextEventKind.TabIndex = 2; - this.TextEventKind.Text = "(イベント)"; - // - // TextEventDetail - // - this.TextEventDetail.AutoSize = true; - this.TextEventDetail.Location = new System.Drawing.Point(156, 3); - this.TextEventDetail.Margin = new System.Windows.Forms.Padding(3); - this.TextEventDetail.Name = "TextEventDetail"; - this.TextEventDetail.Size = new System.Drawing.Size(99, 15); - this.TextEventDetail.TabIndex = 3; - this.TextEventDetail.Text = "(イベント詳細(仮))"; - // // PanelEnemyFleet // this.PanelEnemyFleet.AutoSize = true; this.PanelEnemyFleet.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.PanelEnemyFleet.Controls.Add(this.TableEnemyMember); this.PanelEnemyFleet.Controls.Add(this.TableEnemyFleet); - this.PanelEnemyFleet.Location = new System.Drawing.Point(3, 24); + this.PanelEnemyFleet.Location = new System.Drawing.Point(3, 25); this.PanelEnemyFleet.Name = "PanelEnemyFleet"; this.PanelEnemyFleet.Size = new System.Drawing.Size(190, 22); this.PanelEnemyFleet.TabIndex = 4; @@ -181,6 +141,46 @@ private void InitializeComponent() { this.ToolTipInfo.ReshowDelay = 100; this.ToolTipInfo.ShowAlways = true; // + // TextMapArea + // + this.TextMapArea.BackColor = System.Drawing.Color.Transparent; + this.TextMapArea.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.TextMapArea.Location = new System.Drawing.Point(3, 3); + this.TextMapArea.Name = "TextMapArea"; + this.TextMapArea.Size = new System.Drawing.Size(35, 16); + this.TextMapArea.TabIndex = 5; + this.TextMapArea.Text = "(海域)"; + // + // TextDestination + // + this.TextDestination.BackColor = System.Drawing.Color.Transparent; + this.TextDestination.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.TextDestination.Location = new System.Drawing.Point(44, 3); + this.TextDestination.Name = "TextDestination"; + this.TextDestination.Size = new System.Drawing.Size(44, 16); + this.TextDestination.TabIndex = 6; + this.TextDestination.Text = "(行き先)"; + // + // TextEventKind + // + this.TextEventKind.BackColor = System.Drawing.Color.Transparent; + this.TextEventKind.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.TextEventKind.Location = new System.Drawing.Point(94, 3); + this.TextEventKind.Name = "TextEventKind"; + this.TextEventKind.Size = new System.Drawing.Size(47, 16); + this.TextEventKind.TabIndex = 7; + this.TextEventKind.Text = "(イベント)"; + // + // TextEventDetail + // + this.TextEventDetail.BackColor = System.Drawing.Color.Transparent; + this.TextEventDetail.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.TextEventDetail.Location = new System.Drawing.Point(147, 3); + this.TextEventDetail.Name = "TextEventDetail"; + this.TextEventDetail.Size = new System.Drawing.Size(71, 16); + this.TextEventDetail.TabIndex = 8; + this.TextEventDetail.Text = "(イベント詳細)"; + // // FormCompass // this.AutoHidePortion = 150D; @@ -206,10 +206,6 @@ private void InitializeComponent() { #endregion private System.Windows.Forms.FlowLayoutPanel BasePanel; - private System.Windows.Forms.Label TextMapArea; - private System.Windows.Forms.Label TextDestination; - private System.Windows.Forms.Label TextEventKind; - private System.Windows.Forms.Label TextEventDetail; private System.Windows.Forms.Panel PanelEnemyFleet; private System.Windows.Forms.TableLayoutPanel TableEnemyFleet; private Control.ImageLabel TextEnemyFleetName; @@ -217,5 +213,9 @@ private void InitializeComponent() { private Control.ImageLabel TextAirSuperiority; private System.Windows.Forms.TableLayoutPanel TableEnemyMember; private System.Windows.Forms.ToolTip ToolTipInfo; + private Control.ImageLabel TextMapArea; + private Control.ImageLabel TextDestination; + private Control.ImageLabel TextEventKind; + private Control.ImageLabel TextEventDetail; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormCompass.cs b/ElectronicObserver/Window/FormCompass.cs index fbd06811e..d46d461de 100644 --- a/ElectronicObserver/Window/FormCompass.cs +++ b/ElectronicObserver/Window/FormCompass.cs @@ -22,7 +22,7 @@ namespace ElectronicObserver.Window { public partial class FormCompass : DockContent { - + private class TableEnemyMemberControl { public ImageLabel ShipName; @@ -63,7 +63,7 @@ public TableEnemyMemberControl( FormCompass parent ) { } - + public TableEnemyMemberControl( FormCompass parent, TableLayoutPanel table, int row ) : this( parent ) { @@ -133,7 +133,7 @@ public void Update( int shipID, int[] slot ) { public void UpdateEquipmentToolTip( int shipID, int[] slot, int level, int firepower, int torpedo, int aa, int armor ) { - + ToolTipInfo.SetToolTip( ShipName, GetShipString( shipID, slot, level, firepower, torpedo, aa, armor ) ); } @@ -158,7 +158,7 @@ private string GetShipString( int shipID, int[] slot, int level, int firepower, ship.ASW != null && ship.ASW.IsAvailable ? ship.ASW.GetParameter( level ) : -1, ship.Evasion != null && ship.Evasion.IsAvailable ? ship.Evasion.GetParameter( level ) : -1, ship.LOS != null && ship.LOS.IsAvailable ? ship.LOS.GetParameter( level ) : -1, - level > 99 ? Math.Min( ship.LuckMin + 3, ship.LuckMax ) : ship.LuckMin ); + level > 99 ? Math.Min( ship.LuckMin + 3, ship.LuckMax ) : ship.LuckMin ); } private string GetShipString( int shipID, int[] slot, int level, int hp, int firepower, int torpedo, int aa, int armor, int asw, int evasion, int los, int luck ) { @@ -258,7 +258,7 @@ void ShipName_MouseClick( object sender, MouseEventArgs e ) { private TableEnemyMemberControl[] ControlMember; - + public FormCompass( FormMain parent ) { InitializeComponent(); @@ -280,13 +280,14 @@ public FormCompass( FormMain parent ) { ControlMember[i] = new TableEnemyMemberControl( this, TableEnemyMember, i ); } TableEnemyMember.ResumeLayout(); - + //BasePanel.SetFlowBreak( TextMapArea, true ); BasePanel.SetFlowBreak( TextDestination, true ); //BasePanel.SetFlowBreak( TextEventKind, true ); BasePanel.SetFlowBreak( TextEventDetail, true ); + TextDestination.ImageList = ResourceManager.Instance.Equipments; Icon = ResourceManager.ImageToIcon( ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormCompass] ); } @@ -315,6 +316,7 @@ private void FormCompass_Load( object sender, EventArgs e ) { o.APIList["api_req_sortie/battle"].ResponseReceived += BattleStarted; o.APIList["api_req_battle_midnight/sp_midnight"].ResponseReceived += BattleStarted; + o.APIList["api_req_sortie/airbattle"].ResponseReceived += BattleStarted; o.APIList["api_req_combined_battle/battle"].ResponseReceived += BattleStarted; o.APIList["api_req_combined_battle/sp_midnight"].ResponseReceived += BattleStarted; o.APIList["api_req_combined_battle/airbattle"].ResponseReceived += BattleStarted; @@ -325,7 +327,7 @@ private void FormCompass_Load( object sender, EventArgs e ) { Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged; } - + private void Updated( string apiname, dynamic data ) { Color colorNormal = SystemColors.ControlText; @@ -353,27 +355,41 @@ private void Updated( string apiname, dynamic data ) { BasePanel.SuspendLayout(); PanelEnemyFleet.Visible = false; - TextMapArea.Text = "出撃海域 : " + compass.MapAreaID + "-" + compass.MapInfoID; - TextDestination.Text = "次のセル : " + compass.Destination + ( compass.IsEndPoint ? " (終点)" : "" ); - TextEventKind.ForeColor = colorNormal; + + TextMapArea.Text = string.Format( "出撃海域 : {0}-{1}", compass.MapAreaID, compass.MapInfoID ); + TextDestination.Text = string.Format( "次のセル : {0}{1}", compass.Destination, ( compass.IsEndPoint ? " (終点)" : "" ) ); + if ( compass.LaunchedRecon != 0 ) { + TextDestination.ImageAlign = ContentAlignment.MiddleRight; + TextDestination.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane; + ToolTipInfo.SetToolTip( TextDestination, "索敵機発艦!" ); + } else { + TextDestination.ImageAlign = ContentAlignment.MiddleCenter; + TextDestination.ImageIndex = -1; + ToolTipInfo.SetToolTip( TextDestination, null ); + } + + + TextEventKind.ForeColor = colorNormal; + { string eventkind = Constants.GetMapEventID( compass.EventID ); switch ( compass.EventID ) { - + case 0: //初期位置 case 1: //不明 TextEventDetail.Text = "どうしてこうなった"; break; case 2: //資源 + case 8: //船団護衛成功 { string materialname; if ( compass.GetItemID == 4 ) { //"※" 大方資源専用ID materialname = Constants.GetMaterialName( compass.GetItemIDMetadata ); - + } else { UseItemMaster item = KCDatabase.Instance.MasterUseItems[compass.GetItemIDMetadata]; if ( item != null ) @@ -404,9 +420,9 @@ private void Updated( string apiname, dynamic data ) { } } ); - TextEventDetail.Text = string.Format( "{0} x {1} ({2:p0})", - Constants.GetMaterialName( compass.WhirlpoolItemID ), - compass.WhirlpoolItemAmount, + TextEventDetail.Text = string.Format( "{0} x {1} ({2:p0})", + Constants.GetMaterialName( compass.WhirlpoolItemID ), + compass.WhirlpoolItemAmount, (double)compass.WhirlpoolItemAmount / Math.Max( materialmax, 1 ) ); } @@ -414,7 +430,7 @@ private void Updated( string apiname, dynamic data ) { case 4: //通常戦闘 case 5: //ボス戦闘 - if ( compass.EventKind >= 2 ) { + if ( compass.EventKind >= 2 ) { eventkind += "/" + Constants.GetMapEventKind( compass.EventKind ); if ( compass.EventKind == 2 || compass.EventKind == 3 ) { @@ -428,12 +444,13 @@ private void Updated( string apiname, dynamic data ) { TextEventDetail.Text = ""; break; - case 7: //機動部隊航空戦 + case 7: //航空戦(連合艦隊) if ( compass.EventKind >= 2 && compass.EventKind != 4 ) //必ず"航空戦"のはずなので除外 eventkind += "/" + Constants.GetMapEventKind( compass.EventKind ); UpdateEnemyFleet( compass.EnemyFleetID ); break; + default: eventkind += "不明"; TextEventDetail.Text = ""; @@ -465,7 +482,7 @@ private void UpdateEnemyFleet( int fleetID ) { var efleet = RecordManager.Instance.EnemyFleet; - + if ( !efleet.Record.ContainsKey( fleetID ) ) { //unknown diff --git a/ElectronicObserver/Window/FormFleet.Designer.cs b/ElectronicObserver/Window/FormFleet.Designer.cs index be537d804..621d8e21e 100644 --- a/ElectronicObserver/Window/FormFleet.Designer.cs +++ b/ElectronicObserver/Window/FormFleet.Designer.cs @@ -29,6 +29,9 @@ private void InitializeComponent() { this.ContextMenuFleet = new System.Windows.Forms.ContextMenuStrip(this.components); this.ContextMenuFleet_CopyFleet = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_Capture = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.ContextMenuFleet_IsScrollable = new System.Windows.Forms.ToolStripMenuItem(); + this.ContextMenuFleet_FixShipNameWidth = new System.Windows.Forms.ToolStripMenuItem(); this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); this.ContextMenuFleet.SuspendLayout(); this.SuspendLayout(); @@ -73,9 +76,12 @@ private void InitializeComponent() { // this.ContextMenuFleet.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.ContextMenuFleet_CopyFleet, - this.ContextMenuFleet_Capture}); + this.ContextMenuFleet_Capture, + this.toolStripSeparator1, + this.ContextMenuFleet_IsScrollable, + this.ContextMenuFleet_FixShipNameWidth}); this.ContextMenuFleet.Name = "ContextMenuFleet"; - this.ContextMenuFleet.Size = new System.Drawing.Size(227, 48); + this.ContextMenuFleet.Size = new System.Drawing.Size(227, 98); this.ContextMenuFleet.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuFleet_Opening); // // ContextMenuFleet_CopyFleet @@ -92,6 +98,32 @@ private void InitializeComponent() { this.ContextMenuFleet_Capture.Text = "この画面をキャプチャ(&S)"; this.ContextMenuFleet_Capture.Click += new System.EventHandler(this.ContextMenuFleet_Capture_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(223, 6); + this.toolStripSeparator1.Visible = false; + // + // ContextMenuFleet_IsScrollable + // + this.ContextMenuFleet_IsScrollable.CheckOnClick = true; + this.ContextMenuFleet_IsScrollable.Enabled = false; + this.ContextMenuFleet_IsScrollable.Name = "ContextMenuFleet_IsScrollable"; + this.ContextMenuFleet_IsScrollable.Size = new System.Drawing.Size(226, 22); + this.ContextMenuFleet_IsScrollable.Text = "スクロール可能"; + this.ContextMenuFleet_IsScrollable.Visible = false; + this.ContextMenuFleet_IsScrollable.Click += new System.EventHandler(this.ContextMenuFleet_IsScrollable_Click); + // + // ContextMenuFleet_FixShipNameWidth + // + this.ContextMenuFleet_FixShipNameWidth.CheckOnClick = true; + this.ContextMenuFleet_FixShipNameWidth.Enabled = false; + this.ContextMenuFleet_FixShipNameWidth.Name = "ContextMenuFleet_FixShipNameWidth"; + this.ContextMenuFleet_FixShipNameWidth.Size = new System.Drawing.Size(226, 22); + this.ContextMenuFleet_FixShipNameWidth.Text = "艦名の幅を固定する"; + this.ContextMenuFleet_FixShipNameWidth.Visible = false; + this.ContextMenuFleet_FixShipNameWidth.Click += new System.EventHandler(this.ContextMenuFleet_FixShipNameWidth_Click); + // // ToolTipInfo // this.ToolTipInfo.AutoPopDelay = 30000; @@ -130,5 +162,8 @@ private void InitializeComponent() { private System.Windows.Forms.ContextMenuStrip ContextMenuFleet; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_CopyFleet; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_Capture; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_IsScrollable; + private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_FixShipNameWidth; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index 82aa0743f..26e36f822 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -117,7 +117,7 @@ public void Update( FleetData fleet ) { if ( fleet == null ) return; - + Name.Text = fleet.Name; { @@ -158,6 +158,11 @@ public void Update( FleetData fleet ) { //索敵能力計算 SearchingAbility.Text = fleet.GetSearchingAbilityString(); + ToolTipInfo.SetToolTip( SearchingAbility, + string.Format( "(旧)2-5式: {0}\r\n2-5式(秋): {1}\r\n2-5新秋簡易式: {2}\r\n", + fleet.GetSearchingAbilityString( 0 ), + fleet.GetSearchingAbilityString( 1 ), + fleet.GetSearchingAbilityString( 2 ) ) ); } @@ -177,7 +182,7 @@ public void Refresh() { private class TableMemberControl { - public Label Name; + public ImageLabel Name; public ShipStatusLevel Level; public ShipStatusHP HP; public ImageLabel Condition; @@ -192,15 +197,18 @@ public TableMemberControl( FormFleet parent ) { #region Initialize - Name = new Label(); + Name = new ImageLabel(); Name.SuspendLayout(); Name.Text = "*nothing*"; Name.Anchor = AnchorStyles.Left; + Name.TextAlign = ContentAlignment.MiddleLeft; + Name.ImageAlign = ContentAlignment.MiddleCenter; Name.Font = parent.MainFont; Name.ForeColor = parent.MainFontColor; Name.Padding = new Padding( 0, 1, 0, 1 ); Name.Margin = new Padding( 2, 0, 2, 0 ); Name.AutoSize = true; + //Name.AutoEllipsis = true; Name.Visible = false; Name.Cursor = Cursors.Help; Name.MouseDown += Name_MouseDown; @@ -208,7 +216,7 @@ public TableMemberControl( FormFleet parent ) { Level = new ShipStatusLevel(); Level.SuspendLayout(); - Level.Anchor = AnchorStyles.Left; + Level.Anchor = AnchorStyles.Left | AnchorStyles.Bottom; Level.Value = 0; Level.MaximumValue = 150; Level.ValueNext = 0; @@ -218,7 +226,7 @@ public TableMemberControl( FormFleet parent ) { Level.SubFontColor = parent.SubFontColor; //Level.TextNext = "n."; Level.Padding = new Padding( 0, 0, 0, 0 ); - Level.Margin = new Padding( 2, 0, 2, 0 ); + Level.Margin = new Padding( 2, 0, 2, 1 ); Level.AutoSize = true; Level.Visible = false; Name.ResumeLayout(); @@ -265,7 +273,7 @@ public TableMemberControl( FormFleet parent ) { ShipResource.Anchor = AnchorStyles.Left; ShipResource.Padding = new Padding( 0, 2, 0, 1 ); ShipResource.Margin = new Padding( 2, 0, 2, 0 ); - ShipResource.Size = new Size( 40, 20 ); + ShipResource.Size = new Size( 30, 20 ); ShipResource.AutoSize = false; ShipResource.Visible = false; ShipResource.ResumeLayout(); @@ -348,12 +356,23 @@ public void Update( int shipMasterID ) { Level.Value = ship.Level; Level.ValueNext = ship.ExpNext; - if ( ship.MasterShip.RemodelAfterShipID != 0 && ship.Level < ship.MasterShip.RemodelAfterLevel ) { - ToolTipInfo.SetToolTip( Level, string.Format( "改装まで: {0}", ship.ExpNextRemodel ) ); - } else if ( ship.Level <= 99 ) { - ToolTipInfo.SetToolTip( Level, string.Format( "Lv99まで: {0}", Math.Max( ExpTable.GetExpToLevelShip( ship.ExpTotal, 99 ), 0 ) ) ); - } else { - ToolTipInfo.SetToolTip( Level, string.Format( "Lv150まで: {0}", Math.Max( ExpTable.GetExpToLevelShip( ship.ExpTotal, 150 ), 0 ) ) ); + { + StringBuilder tip = new StringBuilder(); + if ( !Utility.Configuration.Config.FormFleet.ShowNextExp ) + tip.AppendFormat( "次のレベルまで: {0}\n", ship.ExpNext ); + + if ( ship.MasterShip.RemodelAfterShipID != 0 && ship.Level < ship.MasterShip.RemodelAfterLevel ) { + tip.AppendFormat( "改装まで: {0}", ship.ExpNextRemodel ); + + } else if ( ship.Level <= 99 ) { + tip.AppendFormat( "Lv99まで: {0}", Math.Max( ExpTable.GetExpToLevelShip( ship.ExpTotal, 99 ), 0 ) ); + + } else { + tip.AppendFormat( "Lv150まで: {0}", Math.Max( ExpTable.GetExpToLevelShip( ship.ExpTotal, 150 ), 0 ) ); + + } + + ToolTipInfo.SetToolTip( Level, tip.ToString() ); } @@ -501,8 +520,8 @@ public FormFleet( FormMain parent, int fleetID ) { FleetID = fleetID; Utility.SystemEvents.UpdateTimerTick += UpdateTimerTick; - ConfigurationChanged(); + MainFontColor = Color.FromArgb( 0x00, 0x00, 0x00 ); SubFontColor = Color.FromArgb( 0x88, 0x88, 0x88 ); @@ -528,6 +547,8 @@ public FormFleet( FormMain parent, int fleetID ) { TableMember.ResumeLayout(); + ConfigurationChanged(); //fixme: 苦渋の決断 + Icon = ResourceManager.ImageToIcon( ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet] ); } @@ -709,19 +730,52 @@ private void ContextMenuFleet_Capture_Click( object sender, EventArgs e ) { void ConfigurationChanged() { - MainFont = Font = Utility.Configuration.Config.UI.MainFont; - SubFont = Utility.Configuration.Config.UI.SubFont; + + var c = Utility.Configuration.Config; + + MainFont = Font = c.UI.MainFont; + SubFont = c.UI.SubFont; + + AutoScroll = ContextMenuFleet_IsScrollable.Checked = c.FormFleet.IsScrollable; + ContextMenuFleet_FixShipNameWidth.Checked = c.FormFleet.FixShipNameWidth; if ( ControlFleet != null && KCDatabase.Instance.Fleet[FleetID] != null ) { ControlFleet.Update( KCDatabase.Instance.Fleet[FleetID] ); } if ( ControlMember != null ) { - bool flag = Utility.Configuration.Config.FormFleet.ShowAircraft; + bool showAircraft = c.FormFleet.ShowAircraft; + bool fixShipNameWidth = c.FormFleet.FixShipNameWidth; + bool shortHPBar = c.FormFleet.ShortenHPBar; + bool showNext = c.FormFleet.ShowNextExp; + for ( int i = 0; i < ControlMember.Length; i++ ) { - ControlMember[i].Equipments.ShowAircraft = flag; + ControlMember[i].Equipments.ShowAircraft = showAircraft; + if ( fixShipNameWidth ) { + ControlMember[i].Name.AutoSize = false; + ControlMember[i].Name.Size = new Size( 40, 20 ); + } else { + ControlMember[i].Name.AutoSize = true; + } + + ControlMember[i].HP.Text = shortHPBar ? "" : "HP:"; + ControlMember[i].Level.TextNext = showNext ? "next:" : null; } } + TableMember.PerformLayout(); //fixme:サイズ変更に親パネルが追随しない + + } + + + //よく考えたら別の艦隊タブと同期しないといけないので封印 + private void ContextMenuFleet_IsScrollable_Click( object sender, EventArgs e ) { + Utility.Configuration.Config.FormFleet.IsScrollable = ContextMenuFleet_IsScrollable.Checked; + ConfigurationChanged(); + } + + private void ContextMenuFleet_FixShipNameWidth_Click( object sender, EventArgs e ) { + Utility.Configuration.Config.FormFleet.FixShipNameWidth = ContextMenuFleet_FixShipNameWidth.Checked; + ConfigurationChanged(); } @@ -736,7 +790,6 @@ protected override string GetPersistString() { - } } diff --git a/ElectronicObserver/Window/FormQuest.cs b/ElectronicObserver/Window/FormQuest.cs index bd0821566..90c3e0454 100644 --- a/ElectronicObserver/Window/FormQuest.cs +++ b/ElectronicObserver/Window/FormQuest.cs @@ -225,7 +225,8 @@ private void QuestView_CellFormatting( object sender, DataGridViewCellFormatting e.FormattingApplied = true; } else if ( e.ColumnIndex == QuestView_Name.Index ) { - e.Value = KCDatabase.Instance.Quest[(int)e.Value].Name; + var quest = KCDatabase.Instance.Quest[(int)e.Value]; + e.Value = quest != null ? quest.Name : "???"; e.FormattingApplied = true; } diff --git a/README.md b/README.md index d4d241ed9..6757a626e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ *このリンクの更新は遅れる可能性があります。最新版は[こちら](http://electronicobserver.blog.fc2.com/)で確認してください。* -[ver. 1.1.0 (2015/03/28)](http://bit.ly/1Cigczx) +[ver. 1.1.1 (2015/04/11)](http://bit.ly/1DSY4QD) 更新内容・履歴は[こちら](https://github.com/andanteyk/ElectronicObserver/wiki/ChangeLog)で確認できます。